diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/Allwmake b/applications/utilities/mesh/conversion/ccm26ToFoam/Allwmake index d9b55b3b5f..c37eb78a66 100755 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/Allwmake +++ b/applications/utilities/mesh/conversion/ccm26ToFoam/Allwmake @@ -1,9 +1,4 @@ #!/bin/sh set -x -# compile cd-adapco's CCM library -wmake libso libccmio/libadf -wmake libso libccmio/libccmio -wmake libso libccmio/libcgns - wmake ccm26ToFoam diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/ccm26ToFoam/Make/options b/applications/utilities/mesh/conversion/ccm26ToFoam/ccm26ToFoam/Make/options index 1ff5ad56d5..94b98d0a69 100644 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/ccm26ToFoam/Make/options +++ b/applications/utilities/mesh/conversion/ccm26ToFoam/ccm26ToFoam/Make/options @@ -1,12 +1,10 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I../libccmio/libadf \ - -I../libccmio \ - -I../libccmio/libccmio + -I$(LIB_SRC)/other/libccmio \ + -I$(LIB_SRC)/other/libccmio/lnInclude EXE_LIBS = \ -lfiniteVolume \ -lmeshTools \ - -ladf \ -lccmio diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/CCMFileFormat.pdf b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/CCMFileFormat.pdf deleted file mode 100644 index b1eb5d639d..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/CCMFileFormat.pdf and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/CHANGELOG b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/CHANGELOG deleted file mode 100644 index ecb2aa5c0f..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/CHANGELOG +++ /dev/null @@ -1,120 +0,0 @@ -2.6.1 -- Fixed a 1 byte buffer overrun if reading a node involves converting to a different data type than is stored. - -2.6.0 -- Altered CCM format to allow entries that are up to 2^64 bytes. This involves - a number of changes to the core API: - - CCMIOGetDimensions and CCMIO*SetDataType* now take a CCMIOIndex. - - All CCMIORead(1|2|3)* and CCMIOWrite(1|2|3)* functions take a CCMIOIndex - for start and end, and x, y, z (as applicable). - - CCMIOSetDataType() requires all arguments in the variable-length argument - to be a CCMIOIndex. -- Removed CCMIOWriteData, CCMIOWriteDataPoint, CCMIOReadData, CCMIOReadDataPoint -- Removed CCMIOBuffer interface. - -2.5.12 -- Fixed failure in CCMIOGetDimensions on AIX. - -2.5.11 -- Fixed corruption problem on Solaris. - -2.5.10 -- Fixed problem reading old (pre-2.3.0) files with index != 0. - -2.5.9 -- Changed CCMIOCompress() to use mktemp() instead of tempnam(); this - eliminates any effects of the TMPDIR environment variable. - -2.5.8 -- Changed CCMIOWriteState() to no longer clear the problem state; this - ensures that the .ccm file can be exactly overwritten in place. (Otherwise - CCMIOWriteState() deletes stuff, and then ADF loses disk space) -- Added CCMIOInvalidateEntity(), which guarantees that an entity is invalid. -- Fixed a rare data corruption problem with fwrite caching. - -2.5.7 -- Added the adfdump program to help in debugging. It makes an ascii file out - of the adf file. - -2.5.6 -- Changed code to allow the interface node to be either under cells or - topology. This will be changed to just topology in a month. 2005-Sept-02 -- Also contains a fix to a crash caused by fwrite caching. - -2.5.5 -- Added fwrite/fread caching to the ADF library. This improves NFS performance - on Linux 2.4 by an order of magnitude. -- Fixed ADF library to properly handle the same file open multiple times. - -2.5.4 -- Added CCMIONewProstarSet() and CCMIOGetProstarSet() to store Prostar-type - cell sets, vertex sets, etc. - -2.5.3 -- Changed all Write functions to only write the dimension information when - start == kCCMIOStart, so buffered writing must now start from 0. - This significantly speeds up buffered writes. -- Fixed a few bugs in the caching that was introduced in 2.5.0 - -2.5.2 -- Changed ADF to only write the modification time when the file is closed. - This helps performance over Linux 2.4 NFS by 10 - 20%. - -2.5.1 -- ADF library updated from CGNS. - -2.5.0 -- Normalized sizes to be unsigned ints in function prototypes. -- Fixed n^2 bug when writing large numbers of nodes. -- Added processor nodes to allowed nodes for CCMIOGetEntityIndex(). -- Removed CCMIOWriteTop(): Use CCMIOWriteOpt1i() instead - -2.4.4 -- Added CCMIOWriteTop() (WRO). - -2.4.3 -2.4.2 -- Changes to the Makefiles and installation structure. Also Wayne's private - functions. - -2.4.1 -- Fixed crash while reading old files and translating to a different data type - than stored on disk. -2.4.0 -- Added solver restart node (kCCMIORestart), solver-specific restart data - (kCCMIORestartData), reference data node (kCCMIOReferenceData), and - physical constants (kCCMIOModelConstants). -- Modified the ADF library to now write binary information at the beginning - of the file so that email clients and WinZip detect the file as binary. -- Changed the format of multidimensional post data (e.g. vectors and tensors) - to be stored by component. -- Added CCMIOWriteConstantFieldData*() to write a set of data that is all - the same value. Reading this field will expand it back into copies of - that value in the resulting array. - -2.3.0 -- Added start and end parameters to all read and write functions for - buffered I/O. -- All arrays must now be in C order (and dimensions in C dimensions) so - that buffering works properly. -- CCMIOWriteFaces() has been split into CCMIOWriteFaces() and - CCMIOWriteFaceCells() (likewise for the read functions) in order to - properly buffer the face stream and the cells. - -2.2.0 -- Added kCCMIOFieldPhase node as a parent of the field data. -- Added short names for prostar. -- Tied file version node to library version. - -2.1.1 -- Added CCMIOGetOptInfo(). -- Added kCCMIOInterfaces as a node type. - -2.1.0 -- Changed name to CCM. -- Added integer field data. -- Added Lagrangian support. -- State node now has a description. - -2.0.0 -- New SFF API requiring arrays to be written directly. diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/Makefile b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/Makefile deleted file mode 100644 index b7785dd29d..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -all copy clean qmake test: - if [ -d libadf ]; then cd libadf; ${MAKE} -f Makefile.qmake $@; fi - if [ -d libccmio ]; then cd libccmio; ${MAKE} -f Makefile.qmake $@; fi - if [ -d libcgns ]; then cd libcgns; ${MAKE} -f Makefile.qmake $@; fi - -install: - @if [ -z "$(MK_BUILDNAME)" ]; then \ - echo "MK_BUILDNAME must be set to the computer type you are installing."; \ - else \ - set -x; \ - echo "MK_BUILDNAME=$${MK_BUILDNAME}"; \ - ./Makefile.install.sc $${MK_BUILDNAME}; \ - fi - -docs: - if [ -d docs ]; then cd docs; ${MAKE} all; fi - -# Internal target suitable for batch building -batch: all - if [ -d libadf ]; then cd libadf; RELEASE=1 ${MAKE} -f Makefile.qmake all; fi - if [ -d libccmio ]; then cd libccmio; RELEASE=1 ${MAKE} -f Makefile.qmake all; fi - if [ -d libcgns ]; then cd libcgns; RELEASE=1 ${MAKE} -f Makefile.qmake all; fi - if [ -d libadf ]; then cd libadf; RELEASE=1 STATIC=1 ${MAKE} -f Makefile.qmake all; fi - if [ -d libccmio ]; then cd libccmio; RELEASE=1 STATIC=1 ${MAKE} -f Makefile.qmake all; fi - if [ -d libcgns ]; then cd libcgns; RELEASE=1 STATIC=1 ${MAKE} -f Makefile.qmake all; fi - rm -f *.a - rm -f *.so - -# Copy all the .a and .so from each directory in lib. This should - -# only be one directory, but cp lib/*/release-shared/lib*.so doesn't - -# work on AIX and HPUX. Also copy the static libraries first, because - -# they are always named .a, but the shared objects may fail on AIX - libdirs=`ls lib`; for dir in $$libdirs; do cp lib/$${dir}/release-static/lib*.a .; cp lib/$${dir}/release-shared/lib*.s* .; done - -dist: docs - ./makedist - -# -# Automatic setting of emacs local variables. -# Local Variables: -# tab-width: 2 -# End: diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/README b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/README deleted file mode 100644 index a1f4bda3ed..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/README +++ /dev/null @@ -1,69 +0,0 @@ -This is the CD-adapco CCM file I/O library, libccmio. - -The library is built with qmake (www.trolltech.com), which is included in -this distribution. The following platforms are supported, although other -platforms can likely be made to work with tweaks to the -config//qmake.conf file: - - aix64_4.3-pwr3 - aix64_5.1-pwr4 - aix_4.3-com - hpux64_11.00-pa8000 - hpux64_11.22-itanium2 - hpux_11.00-pa8000 - irix64_6.5-mips4 - irix_6.5-mips3 - linux64_2.4-itanium-glibc_2.2.4 - linux64_2.4-x86-glibc_2.2.5 - linux64_2.6-pwr4-glibc_2.3.3 - linux_2.2-x86-glibc_2.2.0 - linux_2.4-x86-glibc_2.3.2 - osf1_5.1-com - sunos64_5.8-ultra - sunos_5.8-ultra - windows-x86-gcc - windows-vc.net - -The library can be built on Windows with either the Cygwin Unix emulation layer -(www.cygwin.com), MinGW (www.mingw.org), Win32 gcc using the -windows-x86-gcc profile, or with Visual Studio .NET using windows-vc.net. -Directions for VS .NET are given at the end of this file. - -By default static libraries in release mode of the library will be compiled. -Other versions can be compiled with the following commands: - `make` static, release - `make shared` shared, release - `make debug-static` static, debug - `make debug-shared` shared, debug -Binaries will be located in -lib/// -Only release-static is available on Windows. - -Documentation is located in docs/html/index.html and can be regenerated -with `make docs`, assuming that doxygen >= 1.3.6 is in your path. -The file format itself is documented in docs/CCMFileFormat.pdf. - -Sample CCM files are located in the data/ directory, including files from -older versions of the library that require special-case code to read with -newer versions (please see the "Backwards Compatibility" section of the -documentation for more details). Note that .sff files are old CCM files. - -ADF library: -This distribution includes a copy of the ADF library that has been modified -from the original code to greatly increase performance over NFS. It should be -completely interchangeable with the official ADF library (available at -http://sourceforge.net/projects/cgns/). If you wish to use the standard -distribution, simply copy the appropriate ADF files into the libadf/ directory -before building. - -Compiling with VC.NET: -In order to compile with VC.NET, the VC.NET command line environment must -be properly set up (Microsoft includes a batch script for precisely this -purpose). Specifically, nmake and devenv must be in your path. Once your -environment is correctly set up, execute the following: - - cd libccmio-x.y.z - set QTDIR=%CD%\config\windows-vc.net - set QMAKESPEC=%QTDIR% - set PATH=%QTDIR%;%PATH% - nmake /f Makefile.win32 diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.all b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.all deleted file mode 100755 index 7de315f1cd..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.all +++ /dev/null @@ -1,130 +0,0 @@ -#!/bin/sh - -set -x - -CWD=`pwd` -if expr ${CWD} : /tmp_mnt 1>/dev/null 2>&1; then - CWD=`expr ${CWD} : "/tmp_mnt\(.*\)"`; -fi - -# What version of MeshKernel are we going to compile? -DATE=`date "+%F"` -VERS=V`awk '/^#define kCCMIOMajorVersion/ { major = $3; } /^#define kCCMIOMinorVersion/ { minor = $3; } /^#define kCCMIORevision/ { revision = $3 } END { printf "%d-%02d-%03d\n", major, minor, revision; }' libccmio/ccmioversion.h` -DELT=`cvs status -v README.make | awk "/${VERS}/ { print \\\$1; }"` -VERS="${VERS}_${DATE}" -if [ "${DELT}" ]; then - cvs tag -d "${DELT}" -fi -cvs tag "${VERS}" - - - -# Compile aix64_5.1-pwr4 -echo Job submitted `date` > make.ibm36.list.batch -REMDIR=/u/xeon25/ibm36/starusers/wayne/libs/libccmio -rsh ibm36 "\ - cd ${CWD}; \ - /usr/local/bin/qclient -q 4 -t 2 \ - -s \"${REMDIR}/compile.ibm36 ${REMDIR} ${CWD} ${VERS}\" \ - -f make.ibm36.list.qlogerr -F make.ibm36.list.qlogerr \ -" - - - -# Compile hpux_11.00-pa8000 -# Compile hpux64_11.00-pa8000 -echo Job submitted `date` > make.hp9.list.batch -REMDIR=/u1/hp9/starusers/wayne/libs/libccmio -rsh hp9 "\ - cd ${CWD}; \ - /usr/local/bin/qclient -s \"${REMDIR}/compile.hp9 ${REMDIR} ${CWD} ${VERS}\" \ - -f make.hp9.list.qlogerr -F make.hp9.list.qlogerr \ -" - - - -# Compile hpux64_11.22-itanium2 -echo Job submitted `date` > make.hp10.list.batch -REMDIR=/u1/hp10/starusers/wayne/libs/libccmio -rsh hp10 "\ - cd ${CWD}; \ - /usr/local/bin/qclient -q 0 -s \"${REMDIR}/compile.hp10 ${REMDIR} ${CWD} ${VERS}\" \ - -f make.hp10.list.qlogerr -F make.hp10.list.qlogerr \ -" - - - -# Compile irix_6.5-mips3 -# Compile irix64_6.5-mips4 -echo Job submitted `date` > make.sg3.list.batch -REMDIR=/u/xeon25/sg3/starusers/wayne/libs/libccmio -rsh sg3 "\ - cd ${CWD}; \ - /usr/local/bin/qclient -q 1 -s \"${REMDIR}/compile.sg3 ${REMDIR} ${CWD} ${VERS}\" \ - -f make.sg3.list.qlogerr -F make.sg3.list.qlogerr \ -" - - - -# Compile linux_2.2-x86-glibc_2.2.0 -echo Job submitted `date` > make.linux1.list.batch -REMDIR=/u/linux1/wayne/libs/libccmio -rsh linux1 "\ - cd ${CWD}; \ - /usr/local/bin/qclient -q 1 -s \"${REMDIR}/compile.linux1 ${REMDIR} ${CWD} ${VERS}\" \ - -f make.linux1.list.qlogerr -F make.linux1.list.qlogerr \ -" - - - -# Compile linux_2.4-x86-glibc_2.3.2 -echo Job submitted `date` > make.linux17.list.batch -REMDIR=/u1/linux17/starusers/wayne/libs/libccmio -rsh linux17 "\ - cd ${CWD}; \ - /usr/local/bin/qclient -q 1 -s \"${REMDIR}/compile.linux17 ${REMDIR} ${CWD} ${VERS}\" \ - -f make.linux17.list.qlogerr -F make.linux17.list.qlogerr \ -" - - - -# Compile linux64_2.4-itanium-glibc_2.2.4 -echo Job submitted `date` > make.itanium.list.batch -REMDIR=/u/itanium/starusers/wayne/libs/libccmio -rsh itanium "\ - cd ${CWD}; \ - /usr/local/bin/qclient -q 0 -s \"${REMDIR}/compile.itanium ${REMDIR} ${CWD} ${VERS}\" \ - -f make.itanium.list.qlogerr -F make.itanium.list.qlogerr \ -" - - - -# Compile linux64_2.4-x86-glibc_2.2.5 -echo Job submitted `date` > make.hammer.list.batch -REMDIR=/u/hammer/wayne/libs/libccmio -rsh hammer "\ - cd ${CWD}; \ - /usr/local/bin/qclient -s \"${REMDIR}/compile.hammer ${REMDIR} ${CWD} ${VERS}\" \ - -f make.hammer.list.qlogerr -F make.hammer.list.qlogerr \ -" - - - -# Compile osf1_5.1-com -echo Job submitted `date` > make.alpha24.list.batch -REMDIR=/u/alpha24/starusers/wayne/libs/libccmio -rsh alpha24 "\ - cd ${CWD}; \ - /usr/local/bin/qclient -s \"${REMDIR}/compile.alpha24 ${REMDIR} ${CWD} ${VERS}\" \ - -f make.alpha24.list.qlogerr -F make.alpha24.list.qlogerr \ -" - - -# Compile sunos64_5.8-ultra -echo Job submitted `date` > make.sun7.list.batch -REMDIR=/u3/sun7/starusers/wayne/libs/libccmio -rsh sun7 "\ - cd ${CWD}; \ - /usr/local/bin/qclient -s \"${REMDIR}/compile.sun7 ${REMDIR} ${CWD} ${VERS}\" \ - -f make.sun7.list.qlogerr -F make.sun7.list.qlogerr \ -" diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.all.erase b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.all.erase deleted file mode 100755 index 2c83db7c9e..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.all.erase +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh - -set -x - -# Compile aix64_5.1-pwr4 -cd /u2/regatta1/starusers/wayne/libs/libccmio -'rm' -r include lib obj - -# Compile hpux_11.00-pa8000 -# Compile hpux64_11.00-pa8000 -cd /u1/hp9/starusers/wayne/libs/libccmio -'rm' -r include lib obj - -# Compile hpux64_11.22-itanium2 -cd /u1/hp10/starusers/wayne/libs/libccmio -'rm' -r include lib obj - -# Compile irix_6.5-mips3 -# Compile irix64_6.5-mips4 -cd /usr1/sg14/wayne/libs/libccmio -'rm' -r include lib obj - -# Compile linux_2.2-x86-glibc_2.2.0 -cd /u/linux1/wayne/libs/libccmio -'rm' -r include lib obj - -# Compile linux_2.4-x86-glibc_2.3.2 -cd /u1/linux17/starusers/wayne/libs/libccmio -'rm' -r include lib obj - -# Compile linux64_2.4-itanium-glibc_2.2.4 -cd /u/itanium/starusers/wayne/libs/libccmio -'rm' -r include lib obj - -# Compile linux64_2.4-x86-glibc_2.2.5 -cd /u/hammer/wayne/libs/libccmio -'rm' -r include lib obj - -# Compile osf1_5.1-com -cd /u/alpha24/starusers/wayne/libs/libccmio -'rm' -r include lib obj - -# Compile sunos_5.8-ultra -# Compile sunos64_5.8-ultra -cd /u/sun5/wayne/libs/libccmio -'rm' -r include lib obj diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.alpha24 b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.alpha24 deleted file mode 100755 index d538685b07..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.alpha24 +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -x - -PATH=/adapco/prog/bin:$PATH:/lnxsrv/prog; export PATH - -# Compile osf1_5.1-com -MK_BUILDNAME=osf1_5.1-com; export MK_BUILDNAME; - -separator() -{ - set +x - echo - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo - set -x -} - -exec > make.alpha24.list 2>&1 - -cd $1 - -cvs update -r $3 -d -P - -separator -make -k -f Makefile.qmake RELEASE=1 STATIC=1 all - -separator -make -k -f Makefile.qmake RELEASE=1 STATIC=0 all - -separator -make -f Makefile.qmake install - -echo Job "finished " `date` >> $2/make.alpha24.list.batch diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.hammer b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.hammer deleted file mode 100755 index 3917d2a4eb..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.hammer +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -x - -PATH=/adapco/prog/bin:$PATH:/lnxsrv/prog; export PATH - -# Compile linux64_2.4-x86-glibc_2.2.5 -MK_BUILDNAME=linux64_2.4-x86-glibc_2.2.5; export MK_BUILDNAME; - -separator() -{ - set +x - echo - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo - set -x -} - -exec > make.hammer.list 2>&1 - -cd $1 - -cvs update -r $3 -d -P - -separator -make -k -f Makefile.qmake RELEASE=1 STATIC=1 all - -separator -make -k -f Makefile.qmake RELEASE=1 STATIC=0 all - -separator -make -f Makefile.qmake install - -echo Job "finished " `date` >> $2/make.hammer.list.batch diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.hp10 b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.hp10 deleted file mode 100755 index 84773d1c55..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.hp10 +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -x - -PATH=/adapco/prog/bin:$PATH:/lnxsrv/prog; export PATH - -# Compile hpux64_11.22-itanium2 -MK_BUILDNAME=hpux64_11.22-itanium2; export MK_BUILDNAME; - -separator() -{ - set +x - echo - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo - set -x -} - -exec > make.hp10.list 2>&1 - -cd $1 - -cvs update -r $3 -d -P - -separator -make -k -f Makefile.qmake RELEASE=1 STATIC=1 all - -separator -make -k -f Makefile.qmake RELEASE=1 STATIC=0 all - -separator -make -f Makefile.qmake install - -echo Job "finished " `date` >> $2/make.hp10.list.batch diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.hp9 b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.hp9 deleted file mode 100755 index a072d9180d..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.hp9 +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -x - -PATH=/adapco/prog/bin:$PATH:/lnxsrv/prog; export PATH - -separator() -{ - set +x - echo - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo - set -x -} - -exec > make.hp9.list 2>&1 - -cd $1 - -cvs update -r $3 -d -P - - - -separator -# Compile hpux_11.00-pa8000 -MK_BUILDNAME=hpux_11.00-pa8000; export MK_BUILDNAME; -make -k -f Makefile.qmake RELEASE=1 STATIC=1 MACH_MOD=32 all - -separator -make -k -f Makefile.qmake RELEASE=1 STATIC=0 MACH_MOD=32 all - -separator -make -f Makefile.qmake install - - - -separator -# Compile hpux64_11.00-pa8000 -MK_BUILDNAME=hpux64_11.00-pa8000; export MK_BUILDNAME; -make -k -f Makefile.qmake RELEASE=1 STATIC=1 all - -separator -make -k -f Makefile.qmake RELEASE=1 STATIC=0 all - -separator -make -f Makefile.qmake install - -echo Job "finished " `date` >> $2/make.hp9.list.batch diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.ibm36 b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.ibm36 deleted file mode 100755 index c95b83dfba..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.ibm36 +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -x - -PATH=/adapco/prog/bin:/usr/vacpp/bin:$PATH:/lnxsrv/prog; export PATH - -# Compile aix64_5.1-pwr4 -MK_BUILDNAME=aix64_5.1-pwr4; export MK_BUILDNAME; - -separator() -{ - set +x - echo - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo - set -x -} - -exec > make.ibm36.list 2>&1 - -cd $1 - -cvs update -r $3 -d -P - -separator -make -k -f Makefile.qmake RELEASE=1 STATIC=1 all - -separator -make -k -f Makefile.qmake RELEASE=1 STATIC=0 all - -separator -make -f Makefile.qmake install - -echo Job "finished " `date` >> $2/make.ibm36.list.batch diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.itanium b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.itanium deleted file mode 100755 index 74a1f5e509..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.itanium +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -x - -PATH=/adapco/prog/bin:$PATH:/lnxsrv/prog; export PATH - -# Compile linux64_2.4-itanium-glibc_2.2.4 -MK_BUILDNAME=linux64_2.4-itanium-glibc_2.2.4; export MK_BUILDNAME; - -separator() -{ - set +x - echo - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo - set -x -} - -exec > make.itanium.list 2>&1 - -cd $1 - -cvs update -r $3 -d -P - -separator -make -k -f Makefile.qmake RELEASE=1 STATIC=1 all - -separator -make -k -f Makefile.qmake RELEASE=1 STATIC=0 all - -separator -make -f Makefile.qmake install - -echo Job "finished " `date` >> $2/make.itanium.list.batch diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.linux1 b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.linux1 deleted file mode 100755 index 36280d3717..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.linux1 +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -x - -PATH=/adapco/prog/bin:$PATH:/lnxsrv/prog; export PATH - -# Compile linux_2.2-x86-glibc_2.2.0 -MK_BUILDNAME=linux_2.2-x86-glibc_2.2.0; export MK_BUILDNAME; - -separator() -{ - set +x - echo - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo - set -x -} - -exec > make.linux1.list 2>&1 - -cd $1 - -cvs update -r $3 -d -P - -separator -make -k -f Makefile.qmake RELEASE=1 STATIC=1 all - -separator -make -k -f Makefile.qmake RELEASE=1 STATIC=0 all - -separator -make -f Makefile.qmake install - -echo Job "finished " `date` >> $2/make.linux1.list.batch diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.linux17 b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.linux17 deleted file mode 100755 index 0cc33fedc1..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.linux17 +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -x - -PATH=/adapco/prog/bin:$PATH:/lnxsrv/prog; export PATH - -# Compile linux_2.4-x86-glibc_2.3.2 -MK_BUILDNAME=linux_2.4-x86-glibc_2.3.2; export MK_BUILDNAME; - -separator() -{ - set +x - echo - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo - set -x -} - -exec > make.linux17.list 2>&1 - -cd $1 - -cvs update -r $3 -d -P - -separator -make -k -f Makefile.qmake RELEASE=1 STATIC=1 all - -separator -make -k -f Makefile.qmake RELEASE=1 STATIC=0 all - -separator -make -f Makefile.qmake install - -echo Job "finished " `date` >> $2/make.linux17.list.batch diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.sg3 b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.sg3 deleted file mode 100755 index b41a4ec61d..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.sg3 +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -x - -PATH=/adapco/prog/bin:$PATH:/lnxsrv/prog; export PATH - -separator() -{ - set +x - echo - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo - set -x -} - -exec > make.sg3.list 2>&1 - -cd $1 - -cvs update -r $3 -d -P - - - -separator -# Compile irix_6.5-mips3 -MK_BUILDNAME=irix_6.5-mips3; export MK_BUILDNAME; -make -k -f Makefile.qmake RELEASE=1 STATIC=1 MACH_MOD=32 all - -separator -make -k -f Makefile.qmake RELEASE=1 STATIC=0 MACH_MOD=32 all - -separator -make -f Makefile.qmake install - - - -separator -# Compile irix64_6.5-mips4 -MK_BUILDNAME=irix64_6.5-mips4; export MK_BUILDNAME; -make -k -f Makefile.qmake RELEASE=1 STATIC=1 all - -separator -make -k -f Makefile.qmake RELEASE=1 STATIC=0 all - -separator -make -f Makefile.qmake install - -echo Job "finished " `date` >> $2/make.sg3.list.batch diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.sun7 b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.sun7 deleted file mode 100755 index f0f6a0fdb1..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/compile.sun7 +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -x - -PATH=/adapco/prog/bin:/opt/SUNWspro/bin:$PATH:/lnxsrv/prog; export PATH - -separator() -{ - set +x - echo - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<< separator >>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - echo - set -x -} - -exec > make.sun7.list 2>&1 - -cd $1 - -cvs update -r $3 -d -P - - - -#separator -## Compile sunos_5.8-ultra -#MK_BUILDNAME=sunos_5.8-ultra; export MK_BUILDNAME; -#make -k -f Makefile.qmake RELEASE=1 STATIC=1 MACH_MOD=32 all -# -#separator -#make -k -f Makefile.qmake RELEASE=1 STATIC=0 MACH_MOD=32 all -# -#separator -#make install - - - -separator -# Compile sunos64_5.8-ultra -MK_BUILDNAME=sunos64_5.8-ultra; export MK_BUILDNAME; -make -k -f Makefile.qmake RELEASE=1 STATIC=1 all - -separator -make -k -f Makefile.qmake RELEASE=1 STATIC=0 all - -separator -make -f Makefile.qmake install - -echo Job "finished " `date` >> $2/make.sun7.list.batch diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/Makefile.main b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/Makefile.main deleted file mode 100644 index 538260eae1..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/Makefile.main +++ /dev/null @@ -1,73 +0,0 @@ -all: qmake copy - @eval `grep export qmake.vars | awk '{ $$1=""; $$2=""; print; }'`; \ - if [ x$$MK_BUILDNAME = xwindows-x86 ]; then \ - MAKE="nmake -nologo"; \ - MAKEFLAGS=; \ - else \ - MAKE=$(MAKE); \ - fi; \ - $${MAKE} -f Makefile.$(PROJECT) - -copy: qmake - @eval `grep export qmake.vars | awk '{ $$1=""; $$2=""; print; }'`; \ - if [ x$$MK_BUILDNAME = xwindows-x86 ]; then \ - MAKE="nmake -nologo"; \ - MAKEFLAGS=; \ - else \ - MAKE=$(MAKE); \ - fi; \ - #$${MAKE} -f Makefile.$(PROJECT) install_headers - -qmake: - $(PATHTOSRC)/config/runqmake $(PATHTOSRC) \ - -o Makefile.$(PROJECT) $(PROJECT).pro 2>&1 | tee qmake.vars - - - -test: tqmake tcopy -# We need to make sure the main portion is build before we build the test. - @eval `grep export qmake.vars | awk '{ $$1=""; $$2=""; print; }'`; \ - if [ x$$MK_BUILDNAME = xwindows-x86 ]; then \ - MAKE="nmake -nologo"; \ - MAKEFLAGS=; \ - else \ - MAKE=$(MAKE); \ - fi; \ - $${MAKE} -f Makefile.$(PROJECT); \ - if [ -d test ]; then cd test; $(MAKE) $@; fi - -tcopy: tqmake - @eval `grep export qmake.vars | awk '{ $$1=""; $$2=""; print; }'`; \ - if [ x$$MK_BUILDNAME = xwindows-x86 ]; then \ - MAKE="nmake -nologo"; \ - MAKEFLAGS=; \ - else \ - MAKE=$(MAKE); \ - fi; \ - #$${MAKE} -f Makefile.$(PROJECT) install_headers - -tqmake: - TEST=1; export TEST; \ - $(PATHTOSRC)/config/runqmake $(PATHTOSRC) \ - -o Makefile.$(PROJECT) $(PROJECT).pro 2>&1 | tee qmake.vars - - - -clean: qmake - @eval `grep export qmake.vars | awk '{ $$1=""; $$2=""; print; }'`; \ - if [ x$$MK_BUILDNAME = xwindows-x86 ]; then \ - MAKE="nmake -nologo"; \ - MAKEFLAGS=; \ - else \ - MAKE=$(MAKE); \ - fi; \ - $${MAKE} -f Makefile.$(PROJECT) distclean; \ - if [ -d test ]; then cd test; $(MAKE) $@; fi - - - -tags: - etags *.h *.cpp - -FORCE: - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/Makefile.test b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/Makefile.test deleted file mode 100644 index 9a678ad4be..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/Makefile.test +++ /dev/null @@ -1,58 +0,0 @@ -all: qmake - @eval `grep export qmake.vars | awk '{ $$1=""; $$2=""; print; }'`; \ - if [ x$$MK_BUILDNAME = xwindows-x86 ]; then \ - MAKE="nmake -nologo"; \ - MAKEFLAGS=; \ - else \ - MAKE=$(MAKE); \ - fi; \ - $${MAKE} -f Makefile.$(PROJECT); \ - if [ -x ./run.test ]; then \ - ./run.test "$${TEST}" "$${test}" "$(PATHTOSRC)"; \ - else \ - exit 0; \ - fi - -qmake: - $(PATHTOSRC)/config/runqmake $(PATHTOSRC) \ - -o Makefile.$(PROJECT) $(PROJECT).pro 2>&1 | tee qmake.vars - - - -test: tqmake - @eval `grep export qmake.vars | awk '{ $$1=""; $$2=""; print; }'`; \ - if [ x$$MK_BUILDNAME = xwindows-x86 ]; then \ - MAKE="nmake -nologo"; \ - MAKEFLAGS=; \ - else \ - MAKE=$(MAKE); \ - fi; \ - $${MAKE} -f Makefile.$(PROJECT); \ - TEST=1; export TEST; \ - if [ -x ./run.test ]; then \ - ./run.test "$${TEST}" "$${test}" "$(PATHTOSRC)"; \ - else \ - exit 0; \ - fi - -tqmake: - TEST=1; export TEST; \ - $(PATHTOSRC)/config/runqmake $(PATHTOSRC) \ - -o Makefile.$(PROJECT) $(PROJECT).pro 2>&1 | tee qmake.vars - - - -clean: qmake - @eval `grep export qmake.vars | awk '{ $$1=""; $$2=""; print; }'`; \ - if [ x$$MK_BUILDNAME = xwindows-x86 ]; then \ - MAKE="nmake -nologo"; \ - MAKEFLAGS=; \ - else \ - MAKE=$(MAKE); \ - fi; \ - $${MAKE} -f Makefile.$(PROJECT) distclean - -tags: - etags *.h *.cpp - -copy: diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/aix64_5.1-pwr4/.cvsignore b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/aix64_5.1-pwr4/.cvsignore deleted file mode 100644 index aa6c7eb936..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/aix64_5.1-pwr4/.cvsignore +++ /dev/null @@ -1,36 +0,0 @@ -*.pro -*~ -Makefile.cartesian -Makefile.cfev -Makefile.cfevtest -Makefile.collapser -Makefile.common -Makefile.compatibility -Makefile.convex_decomp -Makefile.core -Makefile.corealg -Makefile.coreio -Makefile.geometry -Makefile.interf -Makefile.license -Makefile.linalg -Makefile.meshercommon -Makefile.mkprogen -Makefile.mkprospec -Makefile.newsurface -Makefile.newvolume -Makefile.octree -Makefile.pipeline -Makefile.resurfacer -Makefile.robustgeometry -Makefile.surface -Makefile.surfacerepair -Makefile.surfacewrapper -Makefile.test -Makefile.viewcommon -Makefile.voxelmesher -make.*.list* -qmake.vars -test.general.log -test.specific.log -zzzz* diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/aix64_5.1-pwr4/qmake b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/aix64_5.1-pwr4/qmake deleted file mode 100755 index 2080359e25..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/aix64_5.1-pwr4/qmake and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/aix64_5.1-pwr4/qmake.conf b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/aix64_5.1-pwr4/qmake.conf deleted file mode 100644 index eb1575296f..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/aix64_5.1-pwr4/qmake.conf +++ /dev/null @@ -1,97 +0,0 @@ - -# -# $Id: qmake.conf,v 1.3 2004/08/24 14:06:52 wayne Exp $ -# -# qmake configuration for aix-xlc -# - -MAKEFILE_GENERATOR = UNIX -TEMPLATE = app -CONFIG += qt warn_on release link_prl - -QMAKE_CC = xlc -QMAKE_CC_THREAD = xlc_r -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = yacc -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -q64 -ma -qrndsngl -qnomaf -qstrict -DLARGE_FILES -# -qwarn64 turns on too many bogus warnings and shadows real warnings -#QMAKE_CFLAGS_WARN_ON = -qwarn64 -QMAKE_CFLAGS_WARN_ON = -QMAKE_CFLAGS_WARN_OFF = -QMAKE_CFLAGS_RELEASE = -O3 -QMAKE_CFLAGS_DEBUG = -g -QMAKE_CFLAGS_SHLIB = -QMAKE_CFLAGS_YACC = -QMAKE_CFLAGS_THREAD = -qthreaded - -QMAKE_CXX = xlC -QMAKE_CXX_THREAD = xlC_r -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -qrtti=all -qnotempinc -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD - -QMAKE_INCDIR = -QMAKE_LIBDIR = -QMAKE_INCDIR_X11 = -QMAKE_LIBDIR_X11 = -QMAKE_INCDIR_QT = $(QTDIR)/include -QMAKE_LIBDIR_QT = $(QTDIR)/lib -QMAKE_INCDIR_OPENGL = -QMAKE_LIBDIR_OPENGL = - -QMAKE_LINK = xlC -QMAKE_LINK_THREAD = xlC_r -QMAKE_LINK_SHLIB = ld -QMAKE_LINK_SHLIB_CMD = makeC++SharedLib -p 0 -X64 \ - -o $(TARGETD) \ - $(LFLAGS) $(OBJECTS) $(OBJMOC) $(LIBS); \ - $(AR) lib$(QMAKE_TARGET).a $(TARGETD); \ - $(RANLIB) lib$(QMAKE_TARGET).a; \ - mv lib$(QMAKE_TARGET).a $(DESTDIR) -QMAKE_LFLAGS = -q64 -qnotempinc -QMAKE_LFLAGS_RELEASE = -QMAKE_LFLAGS_DEBUG = -QMAKE_LFLAGS_SHLIB = -QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_SONAME = -QMAKE_LFLAGS_THREAD = -L/usr/lib/threads -QMAKE_AIX_SHLIB = 1 - -QMAKE_LIBS = -QMAKE_LIBS_DYNLOAD = -ldl -QMAKE_LIBS_X11 = -lXext -lX11 -lm -lbind -QMAKE_LIBS_X11SM = -lSM -lICE -QMAKE_LIBS_QT = -lqt -QMAKE_LIBS_QT_THREAD = -lqt-mt -QMAKE_LIBS_OPENGL = -lGLU -lGL -lXmu -QMAKE_LIBS_OPENGL_QT = -lGL -lXmu -QMAKE_LIBS_THREAD = -lpthreads - -QMAKE_MOC = $(QTDIR)/bin/moc -QMAKE_UIC = $(QTDIR)/bin/uic - -QMAKE_AR = ar -X64 cq -QMAKE_RANLIB = ranlib -X64 - -QMAKE_TAR = tar -cf -QMAKE_GZIP = gzip -9f - -QMAKE_COPY = cp -f -p -QMAKE_MOVE = mv -f -QMAKE_DEL_FILE = rm -f -QMAKE_DEL_DIR = rmdir -QMAKE_CHK_DIR_EXISTS = test -d -QMAKE_MKDIR = mkdir -p - -# added options for MeshKernel: -DEFINES += AIX64_5_1_PWR4 -MK_BUILDNAME = aix64_5.1-pwr4 -MK_LIBS_STLPORT = -lstlport_xlC50 -MK_LIBS_STLPORT_DEBUG = -lstlport_xlC50 diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/aix64_5.1-pwr4/qplatformdefs.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/aix64_5.1-pwr4/qplatformdefs.h deleted file mode 100644 index b5582c5917..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/aix64_5.1-pwr4/qplatformdefs.h +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H - -// Get Qt defines/settings - -#include "qglobal.h" - -// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs - -#include - - -// We are hot - unistd.h should have turned on the specific APIs we requested - - -#ifdef QT_THREAD_SUPPORT -#include -#endif - -#include -#include -#include -#include -#include -#include -#include // AIX X11 headers define FD_ZERO using bzero() - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// DNS header files are not fully covered by X/Open specifications. -// In particular nothing is said about res_* :/ -// On AIX header files and are not -// included by . Note that must be included -// before . -#include -#define class nsrr_class // AIX 4.3.1.0 -#include -#undef class -#include - - -#if !defined(QT_NO_COMPAT) -#define QT_STATBUF struct stat -#define QT_STATBUF4TSTAT struct stat -#define QT_STAT ::stat -#define QT_FSTAT ::fstat -#define QT_STAT_REG S_IFREG -#define QT_STAT_DIR S_IFDIR -#define QT_STAT_MASK S_IFMT -#define QT_STAT_LNK S_IFLNK -#define QT_FILENO fileno -#define QT_OPEN ::open -#define QT_CLOSE ::close -#define QT_LSEEK ::lseek -#define QT_READ ::read -#define QT_WRITE ::write -#define QT_ACCESS ::access -#define QT_GETCWD ::getcwd -#define QT_CHDIR ::chdir -#define QT_MKDIR ::mkdir -#define QT_RMDIR ::rmdir -#define QT_OPEN_RDONLY O_RDONLY -#define QT_OPEN_WRONLY O_WRONLY -#define QT_OPEN_RDWR O_RDWR -#define QT_OPEN_CREAT O_CREAT -#define QT_OPEN_TRUNC O_TRUNC -#define QT_OPEN_APPEND O_APPEND -#endif - -#define QT_SIGNAL_RETTYPE void -#define QT_SIGNAL_ARGS int -#define QT_SIGNAL_IGNORE SIG_IGN - -// Only AIX 4.3 and better supports 64-bit. -// The AIX 4.3 online documentation says 'size_t' but a user asked IBM -// and they told him the documentation is wrong. Indeed 'size_t' is -// obviously wrong for 64-bit programming. And anyway 'socklen_t' -// reportedly works for all AIX 4.3 users. -#define QT_SOCKLEN_T socklen_t - -#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500) -// Only AIX 4.3 and better supports 64-bit. -#define QT_SNPRINTF ::snprintf -#define QT_VSNPRINTF ::vsnprintf -#endif - - -#endif // QPLATFORMDEFS_H diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/aix_5.1-pwr4/qmake b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/aix_5.1-pwr4/qmake deleted file mode 100755 index 2080359e25..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/aix_5.1-pwr4/qmake and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/aix_5.1-pwr4/qmake.conf b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/aix_5.1-pwr4/qmake.conf deleted file mode 100644 index d3ba16e2f1..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/aix_5.1-pwr4/qmake.conf +++ /dev/null @@ -1,97 +0,0 @@ - -# -# $Id: qmake.conf,v 1.1 2005/09/29 22:19:19 geoffp Exp $ -# -# qmake configuration for aix-xlc -# - -MAKEFILE_GENERATOR = UNIX -TEMPLATE = app -CONFIG += qt warn_on release link_prl - -QMAKE_CC = xlc -QMAKE_CC_THREAD = xlc_r -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = yacc -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -q32 -ma -qrndsngl -qnomaf -qstrict -DLARGE_FILES -# -qwarn64 turns on too many bogus warnings and shadows real warnings -#QMAKE_CFLAGS_WARN_ON = -qwarn64 -QMAKE_CFLAGS_WARN_ON = -QMAKE_CFLAGS_WARN_OFF = -QMAKE_CFLAGS_RELEASE = -O3 -QMAKE_CFLAGS_DEBUG = -g -QMAKE_CFLAGS_SHLIB = -QMAKE_CFLAGS_YACC = -QMAKE_CFLAGS_THREAD = -qthreaded - -QMAKE_CXX = xlC -QMAKE_CXX_THREAD = xlC_r -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -qrtti=all -qnotempinc -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD - -QMAKE_INCDIR = -QMAKE_LIBDIR = -QMAKE_INCDIR_X11 = -QMAKE_LIBDIR_X11 = -QMAKE_INCDIR_QT = $(QTDIR)/include -QMAKE_LIBDIR_QT = $(QTDIR)/lib -QMAKE_INCDIR_OPENGL = -QMAKE_LIBDIR_OPENGL = - -QMAKE_LINK = xlC -QMAKE_LINK_THREAD = xlC_r -QMAKE_LINK_SHLIB = ld -QMAKE_LINK_SHLIB_CMD = makeC++SharedLib -p 0 -X32 \ - -o $(TARGETD) \ - $(LFLAGS) $(OBJECTS) $(OBJMOC) $(LIBS); \ - $(AR) lib$(QMAKE_TARGET).a $(TARGETD); \ - $(RANLIB) lib$(QMAKE_TARGET).a; \ - mv lib$(QMAKE_TARGET).a $(DESTDIR) -QMAKE_LFLAGS = -q32 -qnotempinc -QMAKE_LFLAGS_RELEASE = -QMAKE_LFLAGS_DEBUG = -QMAKE_LFLAGS_SHLIB = -QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_SONAME = -QMAKE_LFLAGS_THREAD = -L/usr/lib/threads -QMAKE_AIX_SHLIB = 1 - -QMAKE_LIBS = -QMAKE_LIBS_DYNLOAD = -ldl -QMAKE_LIBS_X11 = -lXext -lX11 -lm -lbind -QMAKE_LIBS_X11SM = -lSM -lICE -QMAKE_LIBS_QT = -lqt -QMAKE_LIBS_QT_THREAD = -lqt-mt -QMAKE_LIBS_OPENGL = -lGLU -lGL -lXmu -QMAKE_LIBS_OPENGL_QT = -lGL -lXmu -QMAKE_LIBS_THREAD = -lpthreads - -QMAKE_MOC = $(QTDIR)/bin/moc -QMAKE_UIC = $(QTDIR)/bin/uic - -QMAKE_AR = ar -X32 cq -QMAKE_RANLIB = ranlib -X32 - -QMAKE_TAR = tar -cf -QMAKE_GZIP = gzip -9f - -QMAKE_COPY = cp -f -p -QMAKE_MOVE = mv -f -QMAKE_DEL_FILE = rm -f -QMAKE_DEL_DIR = rmdir -QMAKE_CHK_DIR_EXISTS = test -d -QMAKE_MKDIR = mkdir -p - -# added options for MeshKernel: -DEFINES += AIX_5_1_PWR4 -MK_BUILDNAME = aix_5.1-pwr4 -MK_LIBS_STLPORT = -lstlport_xlC50 -MK_LIBS_STLPORT_DEBUG = -lstlport_xlC50 diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/aix_5.1-pwr4/qplatformdefs.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/aix_5.1-pwr4/qplatformdefs.h deleted file mode 100644 index 3b438985c0..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/aix_5.1-pwr4/qplatformdefs.h +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H - -// Get Qt defines/settings - -#include "qglobal.h" - -// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs - -#include - - -// We are hot - unistd.h should have turned on the specific APIs we requested - - -#ifdef QT_THREAD_SUPPORT -#include -#endif - -#include -#include -#include -#include -#include -#include -#include // AIX X11 headers define FD_ZERO using bzero() - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// DNS header files are not fully covered by X/Open specifications. -// In particular nothing is said about res_* :/ -// On AIX header files and are not -// included by . Note that must be included -// before . -#include -#define class nsrr_class // AIX 4.3.1.0 -#include -#undef class -#include - - -#if !defined(QT_NO_COMPAT) -#define QT_STATBUF struct stat -#define QT_STATBUF4TSTAT struct stat -#define QT_STAT ::stat -#define QT_FSTAT ::fstat -#define QT_STAT_REG S_IFREG -#define QT_STAT_DIR S_IFDIR -#define QT_STAT_MASK S_IFMT -#define QT_STAT_LNK S_IFLNK -#define QT_FILENO fileno -#define QT_OPEN ::open -#define QT_CLOSE ::close -#define QT_LSEEK ::lseek -#define QT_READ ::read -#define QT_WRITE ::write -#define QT_ACCESS ::access -#define QT_GETCWD ::getcwd -#define QT_CHDIR ::chdir -#define QT_MKDIR ::mkdir -#define QT_RMDIR ::rmdir -#define QT_OPEN_RDONLY O_RDONLY -#define QT_OPEN_WRONLY O_WRONLY -#define QT_OPEN_RDWR O_RDWR -#define QT_OPEN_CREAT O_CREAT -#define QT_OPEN_TRUNC O_TRUNC -#define QT_OPEN_APPEND O_APPEND -#endif - -#define QT_SIGNAL_RETTYPE void -#define QT_SIGNAL_ARGS int -#define QT_SIGNAL_IGNORE SIG_IGN - -// Only AIX 4.3 and better supports 64-bit. -// The AIX 4.3 online documentation says 'size_t' but a user asked IBM -// and they told him the documentation is wrong. Indeed 'size_t' is -// obviously wrong for 64-bit programming. And anyway 'socklen_t' -// reportedly works for all AIX 4.3 users. -#define QT_SOCKLEN_T socklen_t - -#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500) -// Only AIX 4.3 and better supports 64-bit. -#define QT_SNPRINTF ::snprintf -#define QT_VSNPRINTF ::vsnprintf -#endif - - -#endif // QPLATFORMDEFS_H diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/ccm.pro b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/ccm.pro deleted file mode 100644 index b3a2a6d2f0..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/ccm.pro +++ /dev/null @@ -1,107 +0,0 @@ -include($${PATHTOSRC}version.pro) -include($${PATHTOSRC}config/config.pro) - -aix_4.3-com:CONFIG += thread -aix64_4.3-pwr3:CONFIG += thread - -# Put the current build name in CONFIG so I can branch off it. -CONFIG += $$MK_BUILDNAME - -contains(RELEASEMODE, release) { - CONFIG -= debug - CONFIG += release - message("Building in release mode") -} -contains(RELEASEMODE, debug) { - CONFIG -= release - CONFIG += debug - message("Building in Debug mode") -} - -CONFIG -= qt -equals( LIBMODE, dynamic ) { - CONFIG -= staticlib - CONFIG += dll - windows-x86-gcc:QMAKE_EXTENSION_SHLIB = dll - message( "Building dynamic libraries" ) -} else { - CONFIG -= dll - CONFIG += staticlib - message( "Building static libraries" ) -} - -dll:RELEASEMODE = $$RELEASEMODE-shared -else:RELEASEMODE = $$RELEASEMODE-static - -#equals( TESTMODE, test ) { -# DEFINES += TESTING -# RELEASEMODE = $${RELEASEMODE}-testing -# message( "Building in test mode" ) -#} - - -# This define is needed to compile cgns correctly on HP. WRO 2005-Feb-28 -hpux_11.00-pa8000: DEFINES += LOWERCASE -hpux64_11.00-pa8000: DEFINES += LOWERCASE -hpux64_11.22-itanium2: DEFINES += LOWERCASE - - -# Is profiling requested? -!isEmpty(PROFILEMODE) { - RELEASEMODE = $$RELEASEMODE$$PROFILEMODE - QMAKE_CFLAGS += $$PROFILEMODE - QMAKE_CXXFLAGS += $$PROFILEMODE - QMAKE_LFLAGS += $$PROFILEMODE - message( "Building in profile mode: $$PROFILEMODE" ) -} - -# Where is qmake? -QMAKE_QMAKE = $${PATHTOSRC}config/$$MK_BUILDNAME/qmake - -########################## Compiler Options ####################### -# Allow user to override the default compiler options with -# environmental variables. -!isEmpty( CC ) { - QMAKE_CC = $$CC -} -!isEmpty( CXX ) { - equals( QMAKE_LINK, $$QMAKE_CXX ) { - QMAKE_LINK = $$CXX - } - equals( QMAKE_LINK_SHLIB, $$QMAKE_CXX ) { - QMAKE_LINK_SHLIB = $$CXX - } - QMAKE_CXX = $$CXX -} - -################################################################## - -CCMBASE = $$PATHTOSRC -CCMINC = $$CCMBASE/include -CCMLIB = $$CCMBASE/lib/$$MK_BUILDNAME/$$RELEASEMODE -CCMBIN = $$CCMBASE/bin/$$MK_BUILDNAME/$$RELEASEMODE -CCMOBJ = $$CCMBASE/obj/$$MK_BUILDNAME/$$RELEASEMODE - -################################################################## - -INCLUDEPATH += \ - $$PATHTOSRC \ - $$CCMINC - -#DEPENDPATH += $$CCMINC - -DESTDIR = $$CCMLIB -contains(TEMPLATE,app) { - DESTDIR = $$CCMBIN -} - -OBJECTS_DIR = $$CCMOBJ - - -#headers.path = $$CCMINC -#headers.files = *.h -#INSTALLS += headers - -#message ( "CONFIG=$$CONFIG" ) -message ( "MK_BUILDNAME=$$MK_BUILDNAME; export MK_BUILDNAME;" ) -message ( "RELEASEMODE=$$RELEASEMODE; export RELEASEMODE;" ) diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/config.gnu.to.star b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/config.gnu.to.star deleted file mode 100755 index 6c78823d76..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/config.gnu.to.star +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh - -# $Id: config.gnu.to.star,v 1.4 2006/06/05 21:12:16 geoffp Exp $ - -# Convert the modified gnu machine type used in ammbatch from the config.system -# script to the star machine type. Return unknown if there is no known match. - -# Also process MACHMOD ($2) to see if we want to compile with different than -# the default options. - -# echo Input is ${1:-null}-${2:-null} - -case ${1:-null}-${2:-null} in - rs6000-ibm-aix4.3.0-32) echo aix_4.3-com ;; - rs6000-ibm-aix4.3.0-null) echo aix64_4.3-pwr3 ;; - rs6000-ibm-aix5.1.0-32) echo aix_5.1-pwr4 ;; - rs6000-ibm-aix5.1.0-null) echo aix64_5.1-pwr4 ;; - hppa1.1-hp-hpux-10.20-null) echo hpux_10.20-com ;; - hppa2.0-hp-hpux-11.00-32) echo hpux_11.00-pa8000 ;; - hppa2.0-hp-hpux-11.00-null) echo hpux64_11.00-pa8000 ;; - ia64-hp-hpux11.22-null) echo hpux64_11.22-itanium2 ;; - mips-sgi-irix6-32) echo irix_6.5-mips3 ;; - mips-sgi-irix64_6-32) echo irix_6.5-mips3 ;; - mips-sgi-irix64_6-null) echo irix64_6.5-mips4 ;; - i586-unknown-linux_2.2-glibc-null) echo linux_2.2-x86-glibc_2.2.0 ;; - i586-unknown-linux_2.4-glibc-null) echo linux_2.4-x86-glibc_2.3.2 ;; - ia64-unknown-linux-null) echo linux64_2.4-itanium-glibc_2.2.4 ;; - alpha-dec-osf3-null) echo osf1_4.0-com ;; - alpha-dec-osf5-null) echo osf1_5.1-com ;; - sparc-sun-sunos-5.8-32) echo sunos_5.8-ultra ;; - sparc-sun-sunos-5.8-null) echo sunos64_5.8-ultra ;; - i686-pc-mingw32-null) echo windows-x86-gcc ;; - i686-pc-mingw32-vc) echo windows-x86 ;; - x86_64-unknown-linux-gnu-null) echo linux64_2.4-x86-glibc_2.2.5 ;; - ppc64-unknown-linux-gnu-null) echo linux64_2.6-pwr4-glibc_2.3.3 ;; - *) echo unknown ;; -esac - -# Automatic setting of emacs local variables. -# Local Variables: -# tab-width: 8 -# End: diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/config.pro b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/config.pro deleted file mode 100644 index db9fe5c92c..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/config.pro +++ /dev/null @@ -1,25 +0,0 @@ -# Settings in this file will override those in the default configuration. -# - -######################### Compilation Options ##################### -# Default release/debug options. -isEmpty(RELEASEMODE) { - RELEASEMODE = debug -} - -######################### MeshKernel Options ##################### -# The base directory to install includes, libs, and objects -# Defaults to PATH_TO_SRC/.. -KERNELBASE= - -# Directory to install include (header) files. -# Defaults to KERNELBASE/include -KERNELINC= - -# Directory to install library files. -# Defaults to KERNELBASE/lib/BUILDNAME/RELEASEMODE -KERNELLIB= - -# Directory to store object files. -# Defaults to KERNELBASE/obj/BUILDNAME/RELEASEMODE -KERNELOBJ= diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux64_11.00-pa8000/.cvsignore b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux64_11.00-pa8000/.cvsignore deleted file mode 100644 index aa6c7eb936..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux64_11.00-pa8000/.cvsignore +++ /dev/null @@ -1,36 +0,0 @@ -*.pro -*~ -Makefile.cartesian -Makefile.cfev -Makefile.cfevtest -Makefile.collapser -Makefile.common -Makefile.compatibility -Makefile.convex_decomp -Makefile.core -Makefile.corealg -Makefile.coreio -Makefile.geometry -Makefile.interf -Makefile.license -Makefile.linalg -Makefile.meshercommon -Makefile.mkprogen -Makefile.mkprospec -Makefile.newsurface -Makefile.newvolume -Makefile.octree -Makefile.pipeline -Makefile.resurfacer -Makefile.robustgeometry -Makefile.surface -Makefile.surfacerepair -Makefile.surfacewrapper -Makefile.test -Makefile.viewcommon -Makefile.voxelmesher -make.*.list* -qmake.vars -test.general.log -test.specific.log -zzzz* diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux64_11.00-pa8000/qmake b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux64_11.00-pa8000/qmake deleted file mode 100755 index 603558ecca..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux64_11.00-pa8000/qmake and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux64_11.00-pa8000/qmake.conf b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux64_11.00-pa8000/qmake.conf deleted file mode 100644 index e123e19b44..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux64_11.00-pa8000/qmake.conf +++ /dev/null @@ -1,111 +0,0 @@ -# -# $Id: qmake.conf,v 1.5 2006/03/24 13:51:52 wo Exp $ -# -# qmake configuration for hpux-acc -# -# We define _POSIX_C_SOURCE to 199506L when using threads, therefore -# we also need to redefine _HPUX_SOURCE. See pthread(3t) for more details. -# -# From the "HP aC++ Online Programmer's Guide": -# Using +DS to Specify Instruction Scheduling: -# * By default, the compiler performs scheduling tuned for the system -# on which you are compiling, or, if specified, tuned for the setting -# of the +DA option. -# -# From the online "C/HP-UX Reference Manual": -# -Aa -# Enables strict ANSI C compliance. -# -Ae -# Enables ANSI C compliance, HP value-added features (as described -# for +e option), and _HPUX_SOURCE name space macro. It is equivalent -# to -Aa +e -D_HPUX_SOURCE. -# +e -# Enables the following HP value added features while compiling in -# ANSI C mode: sized enum, long long, long pointers, compiler supplied -# defaults for missing arguments to intrinsic calls, and $ in identifier -# HP C extensions. -# - -MAKEFILE_GENERATOR = UNIX -TEMPLATE = app -CONFIG += qt warn_on release link_prl - -QMAKE_CC = /opt/ansic/bin/cc -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = yacc -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = +DA2.0W +DS2.0W +z +p +Olibcalls -D_LARGEFILE64_SOURCE -DLARGE_FILES -w -QMAKE_CFLAGS_WARN_ON = -QMAKE_CFLAGS_WARN_OFF = -w -QMAKE_CFLAGS_RELEASE = +O2 +Odataprefetch -QMAKE_CFLAGS_DEBUG = -g -QMAKE_CFLAGS_SHLIB = +Z -QMAKE_CFLAGS_YACC = -QMAKE_CFLAGS_THREAD = -D_POSIX_C_SOURCE=199506L -D_HPUX_SOURCE - -QMAKE_CXX = /opt/aCC/bin/aCC -QMAKE_CXXFLAGS = -AA $$QMAKE_CFLAGS -D__STRICT_ANSI__ -D_HPUX_SOURCE -QMAKE_CXXFLAGS_DEPS = +M -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD - -QMAKE_INCDIR = -QMAKE_LIBDIR = -QMAKE_INCDIR_X11 = /usr/include/X11R6 -QMAKE_LIBDIR_X11 = /usr/lib/X11R6 -QMAKE_INCDIR_QT = $(QTDIR)/include -QMAKE_LIBDIR_QT = $(QTDIR)/lib -QMAKE_INCDIR_OPENGL = /opt/graphics/OpenGL/include /usr/contrib/X11R6/include -QMAKE_LIBDIR_OPENGL = /opt/graphics/OpenGL/lib /usr/contrib/X11R6/lib - -QMAKE_LINK = /opt/aCC/bin/aCC -QMAKE_LINK_SHLIB = /opt/aCC/bin/aCC -QMAKE_LFLAGS = -AA +DA2.0W +DS2.0W -Wl,+s -QMAKE_LFLAGS_RELEASE = +O2 -QMAKE_LFLAGS_DEBUG = -g -QMAKE_LFLAGS_SHLIB = -b -Wl,-a,shared_archive -QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_SONAME = -Wl,+h, -QMAKE_LFLAGS_THREAD = -QMAKE_RPATH = -Wl,+b, -QMAKE_HPUX_SHLIB = 1 -QMAKE_EXTENSION_SHLIB = sl - -QMAKE_LIBS = -lm -lnsl -QMAKE_LIBS_DYNLOAD = -ldld -QMAKE_LIBS_X11 = -lXext -lX11 -QMAKE_LIBS_X11SM = -lSM -lICE -QMAKE_LIBS_QT = -lqt -QMAKE_LIBS_QT_THREAD = -lqt-mt -QMAKE_LIBS_OPENGL = -lGLU -lGL -lXmu -lXt -QMAKE_LIBS_OPENGL_QT = -lGL -lXmu -lXt -QMAKE_LIBS_THREAD = -lpthread -QMAKE_LIBS_YACC = -ly - -QMAKE_MOC = $(QTDIR)/bin/moc -QMAKE_UIC = $(QTDIR)/bin/uic - -QMAKE_AR = ar cqs -QMAKE_RANLIB = - -QMAKE_TAR = tar -cf -QMAKE_GZIP = gzip -9f - -QMAKE_COPY = cp -f -p -QMAKE_MOVE = mv -f -QMAKE_DEL_FILE = rm -f -QMAKE_DEL_DIR = rmdir -QMAKE_CHK_DIR_EXISTS = test -d -QMAKE_MKDIR = mkdir -p - -# added options for ccmio library: -DEFINES += HPUX64_11_00_PA8000 -MK_BUILDNAME = hpux64_11.00-pa8000 -MK_LIBS_STLPORT = -lstlport_aCC -MK_LIBS_STLPORT_DEBUG = -lstlport_aCC_stldebug diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux64_11.00-pa8000/qplatformdefs.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux64_11.00-pa8000/qplatformdefs.h deleted file mode 100644 index d6dc587222..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux64_11.00-pa8000/qplatformdefs.h +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H - -// Get Qt defines/settings - -#include "qglobal.h" - -// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs - -#include - - -// We are hot - unistd.h should have turned on the specific APIs we requested - - -#ifdef QT_THREAD_SUPPORT -#include -#endif - -#include -#include -#include -#include -#include -#include -#define QT_HPUX_LD -#define QT_NO_LIBRARY_UNLOAD - -#include -#include -#include -#include -#include -#include -#include -#include - -// DNS header files are not fully covered by X/Open specifications. -// In particular nothing is said about res_* :/ -// #ifdef __cplusplus -// extern "C" { -// #endif -// getres() is mangled because of missing extern "C" on -// HP-UX 11.x systems missing PHCO_23963 -#include -// #ifdef __cplusplus -// } -// #endif -// Undeclared - at least on HP-UX 10.20. -extern "C" int res_init(); - -#define QT_NO_LIBRARY_UNLOAD - -#if !defined(QT_NO_COMPAT) -#define QT_STATBUF struct stat -#define QT_STATBUF4TSTAT struct stat -#define QT_STAT ::stat -#define QT_FSTAT ::fstat -#define QT_STAT_REG S_IFREG -#define QT_STAT_DIR S_IFDIR -#define QT_STAT_MASK S_IFMT -#define QT_STAT_LNK S_IFLNK -#define QT_FILENO fileno -#define QT_OPEN ::open -#define QT_CLOSE ::close -#define QT_LSEEK ::lseek -#define QT_READ ::read -#define QT_WRITE ::write -#define QT_ACCESS ::access -#define QT_GETCWD ::getcwd -#define QT_CHDIR ::chdir -#define QT_MKDIR ::mkdir -#define QT_RMDIR ::rmdir -#define QT_OPEN_RDONLY O_RDONLY -#define QT_OPEN_WRONLY O_WRONLY -#define QT_OPEN_RDWR O_RDWR -#define QT_OPEN_CREAT O_CREAT -#define QT_OPEN_TRUNC O_TRUNC -#define QT_OPEN_APPEND O_APPEND -#endif - -#define QT_SIGNAL_RETTYPE void -#define QT_SIGNAL_ARGS int -#define QT_SIGNAL_IGNORE SIG_IGN - -#define QT_SOCKLEN_T int - -// presence of _XOPEN_UNIX can be used to detect HP-UX 10 or higher -#if !defined(_XOPEN_UNIX) -// HP-UX 9's select() didn't accept fd_set, yet. -#define select(a,b,c,d,e) select((a), (int *)(b), (int *)(c), (int *)(d), (e)) -#endif - - -#endif // QPLATFORMDEFS_H diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux64_11.22-itanium2/.cvsignore b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux64_11.22-itanium2/.cvsignore deleted file mode 100644 index aa6c7eb936..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux64_11.22-itanium2/.cvsignore +++ /dev/null @@ -1,36 +0,0 @@ -*.pro -*~ -Makefile.cartesian -Makefile.cfev -Makefile.cfevtest -Makefile.collapser -Makefile.common -Makefile.compatibility -Makefile.convex_decomp -Makefile.core -Makefile.corealg -Makefile.coreio -Makefile.geometry -Makefile.interf -Makefile.license -Makefile.linalg -Makefile.meshercommon -Makefile.mkprogen -Makefile.mkprospec -Makefile.newsurface -Makefile.newvolume -Makefile.octree -Makefile.pipeline -Makefile.resurfacer -Makefile.robustgeometry -Makefile.surface -Makefile.surfacerepair -Makefile.surfacewrapper -Makefile.test -Makefile.viewcommon -Makefile.voxelmesher -make.*.list* -qmake.vars -test.general.log -test.specific.log -zzzz* diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux64_11.22-itanium2/qmake b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux64_11.22-itanium2/qmake deleted file mode 100755 index b826421080..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux64_11.22-itanium2/qmake and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux64_11.22-itanium2/qmake.conf b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux64_11.22-itanium2/qmake.conf deleted file mode 100644 index 66ed2f982c..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux64_11.22-itanium2/qmake.conf +++ /dev/null @@ -1,130 +0,0 @@ -# -# $Id: qmake.conf,v 1.2 2004/08/24 20:11:19 wayne Exp $ -# -# qmake configuration for hpuxi-acc-64 -# -# We define _POSIX_C_SOURCE to 199506L when using threads, therefore -# we also need to redefine _HPUX_SOURCE. -# From pthread(3t): -# Some documentation will recommend the use of -D_REENTRANT for -# compilation. While this also functions properly, it is considered -# an obsolescent form. -# See pthread(3t) for more details. -# -# From the "HP aC++ Online Programmer's Guide": -# When +DA2.0W is specified: -# * 64-bit SVR4 Executable and Linking Format (ELF) object files -# are generated for PA-RISC 2.0. -# * The preprocessor predefined macro, __LP64__ is defined. -# * The correct path for 64-bit system and language libraries is -# selected. -# When +DD32 is specified: -# * The size of an int, long, or pointer data type is 32-bits. -# The size of an int data type is 32-bits. The size of a long or -# pointer data type is 64-bits. -# * This is the default, currently equivalent to +DA1.1 architecture. -# When +DD64 is specified: -# * The size of an int data type is 32-bits. The size of a long or -# pointer data type is 64-bits. -# * This is currently equivalent to +DA2.OW architecture. -# * The preprocessor predefined macro, __LP64__ is defined. -# Using +DS to Specify Instruction Scheduling: -# * By default, the compiler performs scheduling tuned for the system -# on which you are compiling, or, if specified, tuned for the setting -# of the +DA option. -# -# From the online "C/HP-UX Reference Manual": -# -Aa -# Enables strict ANSI C compliance. -# -Ae -# Enables ANSI C compliance, HP value-added features (as described -# for +e option), and _HPUX_SOURCE name space macro. It is equivalent -# to -Aa +e -D_HPUX_SOURCE. -# +e -# Enables the following HP value added features while compiling in -# ANSI C mode: sized enum, long long, long pointers, compiler supplied -# defaults for missing arguments to intrinsic calls, and $ in identifier -# HP C extensions. -# - -MAKEFILE_GENERATOR = UNIX -TEMPLATE = app -CONFIG += qt warn_on release plugin_no_soname - -QMAKE_CC = /opt/ansic/bin/cc -QMAKE_LEX = lex -QMAKE_LEXFLAGS = -QMAKE_YACC = yacc -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = +DD64 +DSitanium -w -D_LARGEFILE64_SOURCE -DLARGE_FILES -QMAKE_CFLAGS_WARN_ON = -QMAKE_CFLAGS_WARN_OFF = -w -QMAKE_CFLAGS_RELEASE = +O3 +Osize -QMAKE_CFLAGS_DEBUG = -g -QMAKE_CFLAGS_SHLIB = +Z -QMAKE_CFLAGS_YACC = -QMAKE_CFLAGS_THREAD = -D_POSIX_C_SOURCE=199506L -D_HPUX_SOURCE - -QMAKE_CXX = /opt/aCC/bin/aCC -QMAKE_CXXFLAGS = -AA $$QMAKE_CFLAGS -w -D__STRICT_ANSI__ -D_HPUX_SOURCE -QMAKE_CXXFLAGS_DEPS = +M -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD - -QMAKE_INCDIR = -QMAKE_LIBDIR = -QMAKE_INCDIR_X11 = /usr/include/X11R6 -QMAKE_LIBDIR_X11 = /usr/lib/hpux64/X11R6 -QMAKE_INCDIR_QT = $(QTDIR)/include -QMAKE_LIBDIR_QT = $(QTDIR)/lib -QMAKE_INCDIR_OPENGL = /opt/graphics/OpenGL/include /usr/contrib/X11R6/include -QMAKE_LIBDIR_OPENGL = /opt/graphics/OpenGL/lib/hpux64 /usr/contrib/X11R6/lib/hpux64 - -QMAKE_LINK = /opt/aCC/bin/aCC -QMAKE_LINK_SHLIB = /opt/aCC/bin/aCC -QMAKE_LFLAGS = -AA +DD64 +DSitanium -Wl,+s -QMAKE_LFLAGS_RELEASE = +O3 -QMAKE_LFLAGS_DEBUG = -g -QMAKE_LFLAGS_SHLIB = -b -Wl,-a,shared -QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_SONAME = -Wl,+h, -QMAKE_LFLAGS_THREAD = -QMAKE_RPATH = - -QMAKE_LIBS = -lm -lnsl -QMAKE_LIBS_DYNLOAD = -ldl -QMAKE_LIBS_X11 = -lXext -lX11 -QMAKE_LIBS_X11SM = -lSM -lICE -QMAKE_LIBS_QT = -lqt -QMAKE_LIBS_QT_THREAD = -lqt-mt -QMAKE_LIBS_OPENGL = -lGLU -lGL -lXmu -lXt -QMAKE_LIBS_OPENGL_QT = -lGL -lXmu -lXt -QMAKE_LIBS_THREAD = -lpthread -QMAKE_LIBS_YACC = -ly - -QMAKE_MOC = $(QTDIR)/bin/moc -QMAKE_UIC = $(QTDIR)/bin/uic - -QMAKE_AR = ar cqs -QMAKE_RANLIB = - -QMAKE_TAR = tar -cf -QMAKE_GZIP = gzip -9f - -QMAKE_COPY = cp -f -p -QMAKE_MOVE = mv -f -QMAKE_DEL_FILE = rm -f -QMAKE_DEL_DIR = rmdir -QMAKE_CHK_DIR_EXISTS = test -d -QMAKE_MKDIR = mkdir -p - -# added options for MeshKernel: -DEFINES += HPUX64_11_22_ITANIUM2 -MK_BUILDNAME = hpux64_11.22-itanium2 -MK_LIBS_STLPORT = -lstlport_aCC -MK_LIBS_STLPORT_DEBUG = -lstlport_aCC_stldebug diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux64_11.22-itanium2/qplatformdefs.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux64_11.22-itanium2/qplatformdefs.h deleted file mode 100644 index 6307fc043f..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux64_11.22-itanium2/qplatformdefs.h +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H - -// Get Qt defines/settings - -#include "qglobal.h" - -// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs - -#include - - -// We are hot - unistd.h should have turned on the specific APIs we requested - - -#ifdef QT_THREAD_SUPPORT -#include -#endif - -#include -#include -#include -#include -#include -#include -#define QT_HPUX_LD -#define QT_NO_LIBRARY_UNLOAD - -#include -#include -#include -#include -#include -#include -#include -#include - -// DNS header files are not fully covered by X/Open specifications. -// In particular nothing is said about res_* :/ -// #ifdef __cplusplus -// extern "C" { -// #endif -// getres() is mangled because of missing extern "C" on -// HP-UX 11.x systems missing PHCO_23963 -#include -// #ifdef __cplusplus -// } -// #endif -// Undeclared - at least on HP-UX 10.20. -extern "C" int res_init(); - - -#if !defined(QT_NO_COMPAT) -#define QT_STATBUF struct stat -#define QT_STATBUF4TSTAT struct stat -#define QT_STAT ::stat -#define QT_FSTAT ::fstat -#define QT_STAT_REG S_IFREG -#define QT_STAT_DIR S_IFDIR -#define QT_STAT_MASK S_IFMT -#define QT_STAT_LNK S_IFLNK -#define QT_FILENO fileno -#define QT_OPEN ::open -#define QT_CLOSE ::close -#define QT_LSEEK ::lseek -#define QT_READ ::read -#define QT_WRITE ::write -#define QT_ACCESS ::access -#define QT_GETCWD ::getcwd -#define QT_CHDIR ::chdir -#define QT_MKDIR ::mkdir -#define QT_RMDIR ::rmdir -#define QT_OPEN_RDONLY O_RDONLY -#define QT_OPEN_WRONLY O_WRONLY -#define QT_OPEN_RDWR O_RDWR -#define QT_OPEN_CREAT O_CREAT -#define QT_OPEN_TRUNC O_TRUNC -#define QT_OPEN_APPEND O_APPEND -#endif - -#define QT_SIGNAL_RETTYPE void -#define QT_SIGNAL_ARGS int -#define QT_SIGNAL_IGNORE SIG_IGN - -#define QT_SOCKLEN_T int - - -#endif // QPLATFORMDEFS_H diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux_11.00-pa8000/.cvsignore b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux_11.00-pa8000/.cvsignore deleted file mode 100644 index aa6c7eb936..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux_11.00-pa8000/.cvsignore +++ /dev/null @@ -1,36 +0,0 @@ -*.pro -*~ -Makefile.cartesian -Makefile.cfev -Makefile.cfevtest -Makefile.collapser -Makefile.common -Makefile.compatibility -Makefile.convex_decomp -Makefile.core -Makefile.corealg -Makefile.coreio -Makefile.geometry -Makefile.interf -Makefile.license -Makefile.linalg -Makefile.meshercommon -Makefile.mkprogen -Makefile.mkprospec -Makefile.newsurface -Makefile.newvolume -Makefile.octree -Makefile.pipeline -Makefile.resurfacer -Makefile.robustgeometry -Makefile.surface -Makefile.surfacerepair -Makefile.surfacewrapper -Makefile.test -Makefile.viewcommon -Makefile.voxelmesher -make.*.list* -qmake.vars -test.general.log -test.specific.log -zzzz* diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux_11.00-pa8000/qmake b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux_11.00-pa8000/qmake deleted file mode 100755 index 72555f1851..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux_11.00-pa8000/qmake and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux_11.00-pa8000/qmake.conf b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux_11.00-pa8000/qmake.conf deleted file mode 100644 index 246230166c..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux_11.00-pa8000/qmake.conf +++ /dev/null @@ -1,111 +0,0 @@ -# -# $Id: qmake.conf,v 1.2 2004/08/24 20:11:19 wayne Exp $ -# -# qmake configuration for hpux-acc -# -# We define _POSIX_C_SOURCE to 199506L when using threads, therefore -# we also need to redefine _HPUX_SOURCE. See pthread(3t) for more details. -# -# From the "HP aC++ Online Programmer's Guide": -# Using +DS to Specify Instruction Scheduling: -# * By default, the compiler performs scheduling tuned for the system -# on which you are compiling, or, if specified, tuned for the setting -# of the +DA option. -# -# From the online "C/HP-UX Reference Manual": -# -Aa -# Enables strict ANSI C compliance. -# -Ae -# Enables ANSI C compliance, HP value-added features (as described -# for +e option), and _HPUX_SOURCE name space macro. It is equivalent -# to -Aa +e -D_HPUX_SOURCE. -# +e -# Enables the following HP value added features while compiling in -# ANSI C mode: sized enum, long long, long pointers, compiler supplied -# defaults for missing arguments to intrinsic calls, and $ in identifier -# HP C extensions. -# - -MAKEFILE_GENERATOR = UNIX -TEMPLATE = app -CONFIG += qt warn_on release link_prl - -QMAKE_CC = /opt/ansic/bin/cc -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = yacc -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = +DA2.0N +DS2.0N +z +p +Olibcalls -D_LARGEFILE64_SOURCE -DLARGE_FILES -w -QMAKE_CFLAGS_WARN_ON = -QMAKE_CFLAGS_WARN_OFF = -w -QMAKE_CFLAGS_RELEASE = +O3 +Odataprefetch -QMAKE_CFLAGS_DEBUG = -g -QMAKE_CFLAGS_SHLIB = +Z -QMAKE_CFLAGS_YACC = -QMAKE_CFLAGS_THREAD = -D_POSIX_C_SOURCE=199506L -D_HPUX_SOURCE - -QMAKE_CXX = /opt/aCC/bin/aCC -QMAKE_CXXFLAGS = -AA $$QMAKE_CFLAGS -D__STRICT_ANSI__ -D_HPUX_SOURCE -QMAKE_CXXFLAGS_DEPS = +M -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD - -QMAKE_INCDIR = -QMAKE_LIBDIR = -QMAKE_INCDIR_X11 = /usr/include/X11R6 -QMAKE_LIBDIR_X11 = /usr/lib/X11R6 -QMAKE_INCDIR_QT = $(QTDIR)/include -QMAKE_LIBDIR_QT = $(QTDIR)/lib -QMAKE_INCDIR_OPENGL = /opt/graphics/OpenGL/include /usr/contrib/X11R6/include -QMAKE_LIBDIR_OPENGL = /opt/graphics/OpenGL/lib /usr/contrib/X11R6/lib - -QMAKE_LINK = /opt/aCC/bin/aCC -QMAKE_LINK_SHLIB = /opt/aCC/bin/aCC -QMAKE_LFLAGS = -AA +nostl -Wl,+s -QMAKE_LFLAGS_RELEASE = +O3 -QMAKE_LFLAGS_DEBUG = -g -QMAKE_LFLAGS_SHLIB = -b -Wl,-a,shared_archive -QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_SONAME = -Wl,+h, -QMAKE_LFLAGS_THREAD = -QMAKE_RPATH = -Wl,+b, -QMAKE_HPUX_SHLIB = 1 -QMAKE_EXTENSION_SHLIB = sl - -QMAKE_LIBS = -lm -lnsl -QMAKE_LIBS_DYNLOAD = -ldld -QMAKE_LIBS_X11 = -lXext -lX11 -QMAKE_LIBS_X11SM = -lSM -lICE -QMAKE_LIBS_QT = -lqt -QMAKE_LIBS_QT_THREAD = -lqt-mt -QMAKE_LIBS_OPENGL = -lGLU -lGL -lXmu -lXt -QMAKE_LIBS_OPENGL_QT = -lGL -lXmu -lXt -QMAKE_LIBS_THREAD = -lpthread -QMAKE_LIBS_YACC = -ly - -QMAKE_MOC = $(QTDIR)/bin/moc -QMAKE_UIC = $(QTDIR)/bin/uic - -QMAKE_AR = ar cqs -QMAKE_RANLIB = - -QMAKE_TAR = tar -cf -QMAKE_GZIP = gzip -9f - -QMAKE_COPY = cp -f -p -QMAKE_MOVE = mv -f -QMAKE_DEL_FILE = rm -f -QMAKE_DEL_DIR = rmdir -QMAKE_CHK_DIR_EXISTS = test -d -QMAKE_MKDIR = mkdir -p - -# added options for MeshKernel: -DEFINES += HPUX_11_00_PA8000 -MK_BUILDNAME = hpux_11.00-pa8000 -MK_LIBS_STLPORT = -lstlport_aCC -MK_LIBS_STLPORT_DEBUG = -lstlport_aCC_stldebug diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux_11.00-pa8000/qplatformdefs.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux_11.00-pa8000/qplatformdefs.h deleted file mode 100644 index d6dc587222..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/hpux_11.00-pa8000/qplatformdefs.h +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H - -// Get Qt defines/settings - -#include "qglobal.h" - -// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs - -#include - - -// We are hot - unistd.h should have turned on the specific APIs we requested - - -#ifdef QT_THREAD_SUPPORT -#include -#endif - -#include -#include -#include -#include -#include -#include -#define QT_HPUX_LD -#define QT_NO_LIBRARY_UNLOAD - -#include -#include -#include -#include -#include -#include -#include -#include - -// DNS header files are not fully covered by X/Open specifications. -// In particular nothing is said about res_* :/ -// #ifdef __cplusplus -// extern "C" { -// #endif -// getres() is mangled because of missing extern "C" on -// HP-UX 11.x systems missing PHCO_23963 -#include -// #ifdef __cplusplus -// } -// #endif -// Undeclared - at least on HP-UX 10.20. -extern "C" int res_init(); - -#define QT_NO_LIBRARY_UNLOAD - -#if !defined(QT_NO_COMPAT) -#define QT_STATBUF struct stat -#define QT_STATBUF4TSTAT struct stat -#define QT_STAT ::stat -#define QT_FSTAT ::fstat -#define QT_STAT_REG S_IFREG -#define QT_STAT_DIR S_IFDIR -#define QT_STAT_MASK S_IFMT -#define QT_STAT_LNK S_IFLNK -#define QT_FILENO fileno -#define QT_OPEN ::open -#define QT_CLOSE ::close -#define QT_LSEEK ::lseek -#define QT_READ ::read -#define QT_WRITE ::write -#define QT_ACCESS ::access -#define QT_GETCWD ::getcwd -#define QT_CHDIR ::chdir -#define QT_MKDIR ::mkdir -#define QT_RMDIR ::rmdir -#define QT_OPEN_RDONLY O_RDONLY -#define QT_OPEN_WRONLY O_WRONLY -#define QT_OPEN_RDWR O_RDWR -#define QT_OPEN_CREAT O_CREAT -#define QT_OPEN_TRUNC O_TRUNC -#define QT_OPEN_APPEND O_APPEND -#endif - -#define QT_SIGNAL_RETTYPE void -#define QT_SIGNAL_ARGS int -#define QT_SIGNAL_IGNORE SIG_IGN - -#define QT_SOCKLEN_T int - -// presence of _XOPEN_UNIX can be used to detect HP-UX 10 or higher -#if !defined(_XOPEN_UNIX) -// HP-UX 9's select() didn't accept fd_set, yet. -#define select(a,b,c,d,e) select((a), (int *)(b), (int *)(c), (int *)(d), (e)) -#endif - - -#endif // QPLATFORMDEFS_H diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/irix64_6.5-mips4/.cvsignore b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/irix64_6.5-mips4/.cvsignore deleted file mode 100644 index aa6c7eb936..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/irix64_6.5-mips4/.cvsignore +++ /dev/null @@ -1,36 +0,0 @@ -*.pro -*~ -Makefile.cartesian -Makefile.cfev -Makefile.cfevtest -Makefile.collapser -Makefile.common -Makefile.compatibility -Makefile.convex_decomp -Makefile.core -Makefile.corealg -Makefile.coreio -Makefile.geometry -Makefile.interf -Makefile.license -Makefile.linalg -Makefile.meshercommon -Makefile.mkprogen -Makefile.mkprospec -Makefile.newsurface -Makefile.newvolume -Makefile.octree -Makefile.pipeline -Makefile.resurfacer -Makefile.robustgeometry -Makefile.surface -Makefile.surfacerepair -Makefile.surfacewrapper -Makefile.test -Makefile.viewcommon -Makefile.voxelmesher -make.*.list* -qmake.vars -test.general.log -test.specific.log -zzzz* diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/irix64_6.5-mips4/qmake b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/irix64_6.5-mips4/qmake deleted file mode 100755 index d1e387e99c..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/irix64_6.5-mips4/qmake and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/irix64_6.5-mips4/qmake.conf b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/irix64_6.5-mips4/qmake.conf deleted file mode 100644 index 86271bd367..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/irix64_6.5-mips4/qmake.conf +++ /dev/null @@ -1,92 +0,0 @@ -# -# $Id: qmake.conf,v 1.2 2005/09/21 18:55:39 wo Exp $ -# -# qmake configuration for irix-g++ -# - -MAKEFILE_GENERATOR = UNIX -TEMPLATE = app -CONFIG += qt warn_on release link_prl - -QMAKE_CC = gcc -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = yacc -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -mips4 -mabi=64 -QMAKE_CFLAGS_DEPS = -M -QMAKE_CFLAGS_WARN_ON = -Wall -W -QMAKE_CFLAGS_WARN_OFF = -w -QMAKE_CFLAGS_RELEASE = -O2 -QMAKE_CFLAGS_DEBUG = -g -QMAKE_CFLAGS_SHLIB = -fPIC -QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses -QMAKE_CFLAGS_THREAD = - -QMAKE_CXX = g++ -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_THREAD = - -QMAKE_INCDIR = -QMAKE_LIBDIR = -QMAKE_INCDIR_X11 = -QMAKE_LIBDIR_X11 = -QMAKE_INCDIR_QT = $(QTDIR)/include -QMAKE_LIBDIR_QT = $(QTDIR)/lib -QMAKE_INCDIR_OPENGL = -QMAKE_LIBDIR_OPENGL = - -QMAKE_LINK = g++ -QMAKE_LINK_SHLIB = g++ -QMAKE_LFLAGS = -mips4 -mabi=64 -QMAKE_LFLAGS_RELEASE = -QMAKE_LFLAGS_DEBUG = -QMAKE_LFLAGS_SHLIB = -shared -Wl,-LD_LAYOUT:lgot_buffer=1000 -QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_SONAME = -Wl,-soname, -QMAKE_LFLAGS_THREAD = -QMAKE_RPATH = -Wl,-rpath, - -QMAKE_LIBS = -lC -QMAKE_LIBS_DYNLOAD = -QMAKE_LIBS_X11 = -lXext -lX11 -lm -QMAKE_LIBS_X11SM = -lSM -lICE -QMAKE_LIBS_QT = -lqt -QMAKE_LIBS_QT_THREAD = -lqt-mt -# libGLU is using the SGI C++ library internally and this somehow clashes -# with the GNU C++ library (similar name mangling and symbol names?) -# so we add -lC so that the SGI C++ library is used first... -QMAKE_LIBS_OPENGL = -lGLU -lGL -lXmu -QMAKE_LIBS_OPENGL_QT = -lGL -lXmu -QMAKE_LIBS_THREAD = -lpthread - -QMAKE_MOC = $(QTDIR)/bin/moc -QMAKE_UIC = $(QTDIR)/bin/uic - -QMAKE_AR = ar cq -QMAKE_RANLIB = - -QMAKE_CLEAN = so_locations - -QMAKE_TAR = tar -cf -QMAKE_GZIP = gzip -9f - -QMAKE_COPY = cp -f -p -QMAKE_MOVE = mv -f -QMAKE_DEL_FILE = rm -f -QMAKE_DEL_DIR = rmdir -QMAKE_CHK_DIR_EXISTS = test -d -QMAKE_MKDIR = mkdir -p - -# added options for MeshKernel: -DEFINES += IRIX64_6_5_MIPS4 -MK_BUILDNAME = irix64_6.5-mips4 -MK_LIBS_STLPORT = -lstlport_gcc -MK_LIBS_STLPORT_DEBUG = -lstlport_gcc_stldebug diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/irix64_6.5-mips4/qplatformdefs.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/irix64_6.5-mips4/qplatformdefs.h deleted file mode 100644 index dc47a03cae..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/irix64_6.5-mips4/qplatformdefs.h +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H - -// Get Qt defines/settings - -#include "qglobal.h" - -// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs - -#include - - -// We are hot - unistd.h should have turned on the specific APIs we requested - - -#ifdef QT_THREAD_SUPPORT -#include -#endif - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -// DNS header files are not fully covered by X/Open specifications. -// In particular nothing is said about res_* :/ -// On IRIX header files and are not -// included by . Note that must be included -// before . -#include -#include -#include - - -#if !defined(QT_NO_COMPAT) -#define QT_STATBUF struct stat -#define QT_STATBUF4TSTAT struct stat -#define QT_STAT ::stat -#define QT_FSTAT ::fstat -#define QT_STAT_REG S_IFREG -#define QT_STAT_DIR S_IFDIR -#define QT_STAT_MASK S_IFMT -#define QT_STAT_LNK S_IFLNK -#define QT_FILENO fileno -#define QT_OPEN ::open -#define QT_CLOSE ::close -#define QT_LSEEK ::lseek -#define QT_READ ::read -#define QT_WRITE ::write -#define QT_ACCESS ::access -#define QT_GETCWD ::getcwd -#define QT_CHDIR ::chdir -#define QT_MKDIR ::mkdir -#define QT_RMDIR ::rmdir -#define QT_OPEN_RDONLY O_RDONLY -#define QT_OPEN_WRONLY O_WRONLY -#define QT_OPEN_RDWR O_RDWR -#define QT_OPEN_CREAT O_CREAT -#define QT_OPEN_TRUNC O_TRUNC -#define QT_OPEN_APPEND O_APPEND -#endif - -#define QT_SIGNAL_RETTYPE void -#if defined(_LANGUAGE_C_PLUS_PLUS) || !defined(_SGIAPI) -#define QT_SIGNAL_ARGS int -#else -#define QT_SIGNAL_ARGS void -#endif -#define QT_SIGNAL_IGNORE SIG_IGN - -#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE-0 >= 500) -#define QT_SOCKLEN_T size_t -#else -#define QT_SOCKLEN_T int -#endif - -#if 0 -// on Irix 6.5 and better only - but how to check for it? -#if defined(_SGIAPI) -#define QT_SNPRINTF ::snprintf -#define QT_VSNPRINTF ::vsnprintf -#endif -#endif - -#endif // QPLATFORMDEFS_H - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/irix_6.5-mips3/.cvsignore b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/irix_6.5-mips3/.cvsignore deleted file mode 100644 index aa6c7eb936..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/irix_6.5-mips3/.cvsignore +++ /dev/null @@ -1,36 +0,0 @@ -*.pro -*~ -Makefile.cartesian -Makefile.cfev -Makefile.cfevtest -Makefile.collapser -Makefile.common -Makefile.compatibility -Makefile.convex_decomp -Makefile.core -Makefile.corealg -Makefile.coreio -Makefile.geometry -Makefile.interf -Makefile.license -Makefile.linalg -Makefile.meshercommon -Makefile.mkprogen -Makefile.mkprospec -Makefile.newsurface -Makefile.newvolume -Makefile.octree -Makefile.pipeline -Makefile.resurfacer -Makefile.robustgeometry -Makefile.surface -Makefile.surfacerepair -Makefile.surfacewrapper -Makefile.test -Makefile.viewcommon -Makefile.voxelmesher -make.*.list* -qmake.vars -test.general.log -test.specific.log -zzzz* diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/irix_6.5-mips3/qmake b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/irix_6.5-mips3/qmake deleted file mode 100755 index 127836e82d..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/irix_6.5-mips3/qmake and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/irix_6.5-mips3/qmake.conf b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/irix_6.5-mips3/qmake.conf deleted file mode 100644 index 7c596c7738..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/irix_6.5-mips3/qmake.conf +++ /dev/null @@ -1,92 +0,0 @@ -# -# $Id: qmake.conf,v 1.2 2005/09/21 18:55:39 wo Exp $ -# -# qmake configuration for irix-g++ -# - -MAKEFILE_GENERATOR = UNIX -TEMPLATE = app -CONFIG += qt warn_on release link_prl - -QMAKE_CC = gcc -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = yacc -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -mips3 -mabi=n32 -QMAKE_CFLAGS_DEPS = -M -QMAKE_CFLAGS_WARN_ON = -Wall -W -QMAKE_CFLAGS_WARN_OFF = -w -QMAKE_CFLAGS_RELEASE = -O2 -QMAKE_CFLAGS_DEBUG = -g -QMAKE_CFLAGS_SHLIB = -fPIC -QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses -QMAKE_CFLAGS_THREAD = - -QMAKE_CXX = g++ -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_THREAD = - -QMAKE_INCDIR = -QMAKE_LIBDIR = -QMAKE_INCDIR_X11 = -QMAKE_LIBDIR_X11 = -QMAKE_INCDIR_QT = $(QTDIR)/include -QMAKE_LIBDIR_QT = $(QTDIR)/lib -QMAKE_INCDIR_OPENGL = -QMAKE_LIBDIR_OPENGL = - -QMAKE_LINK = g++ -QMAKE_LINK_SHLIB = g++ -QMAKE_LFLAGS = -mips3 -mabi=n32 -QMAKE_LFLAGS_RELEASE = -QMAKE_LFLAGS_DEBUG = -QMAKE_LFLAGS_SHLIB = -shared -Wl,-LD_LAYOUT:lgot_buffer=1000 -QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_SONAME = -Wl,-soname, -QMAKE_LFLAGS_THREAD = -QMAKE_RPATH = -Wl,-rpath, - -QMAKE_LIBS = -lC -QMAKE_LIBS_DYNLOAD = -QMAKE_LIBS_X11 = -lXext -lX11 -lm -QMAKE_LIBS_X11SM = -lSM -lICE -QMAKE_LIBS_QT = -lqt -QMAKE_LIBS_QT_THREAD = -lqt-mt -# libGLU is using the SGI C++ library internally and this somehow clashes -# with the GNU C++ library (similar name mangling and symbol names?) -# so we add -lC so that the SGI C++ library is used first... -QMAKE_LIBS_OPENGL = -lGLU -lGL -lXmu -QMAKE_LIBS_OPENGL_QT = -lGL -lXmu -QMAKE_LIBS_THREAD = -lpthread - -QMAKE_MOC = $(QTDIR)/bin/moc -QMAKE_UIC = $(QTDIR)/bin/uic - -QMAKE_AR = ar cq -QMAKE_RANLIB = - -QMAKE_CLEAN = so_locations - -QMAKE_TAR = tar -cf -QMAKE_GZIP = gzip -9f - -QMAKE_COPY = cp -f -p -QMAKE_MOVE = mv -f -QMAKE_DEL_FILE = rm -f -QMAKE_DEL_DIR = rmdir -QMAKE_CHK_DIR_EXISTS = test -d -QMAKE_MKDIR = mkdir -p - -# added options for MeshKernel: -DEFINES += IRIX_6_5_MIPS3 -MK_BUILDNAME = irix_6.5-mips3 -MK_LIBS_STLPORT = -lstlport_gcc -MK_LIBS_STLPORT_DEBUG = -lstlport_gcc_stldebug diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/irix_6.5-mips3/qplatformdefs.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/irix_6.5-mips3/qplatformdefs.h deleted file mode 100644 index dc47a03cae..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/irix_6.5-mips3/qplatformdefs.h +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H - -// Get Qt defines/settings - -#include "qglobal.h" - -// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs - -#include - - -// We are hot - unistd.h should have turned on the specific APIs we requested - - -#ifdef QT_THREAD_SUPPORT -#include -#endif - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -// DNS header files are not fully covered by X/Open specifications. -// In particular nothing is said about res_* :/ -// On IRIX header files and are not -// included by . Note that must be included -// before . -#include -#include -#include - - -#if !defined(QT_NO_COMPAT) -#define QT_STATBUF struct stat -#define QT_STATBUF4TSTAT struct stat -#define QT_STAT ::stat -#define QT_FSTAT ::fstat -#define QT_STAT_REG S_IFREG -#define QT_STAT_DIR S_IFDIR -#define QT_STAT_MASK S_IFMT -#define QT_STAT_LNK S_IFLNK -#define QT_FILENO fileno -#define QT_OPEN ::open -#define QT_CLOSE ::close -#define QT_LSEEK ::lseek -#define QT_READ ::read -#define QT_WRITE ::write -#define QT_ACCESS ::access -#define QT_GETCWD ::getcwd -#define QT_CHDIR ::chdir -#define QT_MKDIR ::mkdir -#define QT_RMDIR ::rmdir -#define QT_OPEN_RDONLY O_RDONLY -#define QT_OPEN_WRONLY O_WRONLY -#define QT_OPEN_RDWR O_RDWR -#define QT_OPEN_CREAT O_CREAT -#define QT_OPEN_TRUNC O_TRUNC -#define QT_OPEN_APPEND O_APPEND -#endif - -#define QT_SIGNAL_RETTYPE void -#if defined(_LANGUAGE_C_PLUS_PLUS) || !defined(_SGIAPI) -#define QT_SIGNAL_ARGS int -#else -#define QT_SIGNAL_ARGS void -#endif -#define QT_SIGNAL_IGNORE SIG_IGN - -#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE-0 >= 500) -#define QT_SOCKLEN_T size_t -#else -#define QT_SOCKLEN_T int -#endif - -#if 0 -// on Irix 6.5 and better only - but how to check for it? -#if defined(_SGIAPI) -#define QT_SNPRINTF ::snprintf -#define QT_VSNPRINTF ::vsnprintf -#endif -#endif - -#endif // QPLATFORMDEFS_H - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-itanium-glibc_2.2.4/.cvsignore b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-itanium-glibc_2.2.4/.cvsignore deleted file mode 100644 index aa6c7eb936..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-itanium-glibc_2.2.4/.cvsignore +++ /dev/null @@ -1,36 +0,0 @@ -*.pro -*~ -Makefile.cartesian -Makefile.cfev -Makefile.cfevtest -Makefile.collapser -Makefile.common -Makefile.compatibility -Makefile.convex_decomp -Makefile.core -Makefile.corealg -Makefile.coreio -Makefile.geometry -Makefile.interf -Makefile.license -Makefile.linalg -Makefile.meshercommon -Makefile.mkprogen -Makefile.mkprospec -Makefile.newsurface -Makefile.newvolume -Makefile.octree -Makefile.pipeline -Makefile.resurfacer -Makefile.robustgeometry -Makefile.surface -Makefile.surfacerepair -Makefile.surfacewrapper -Makefile.test -Makefile.viewcommon -Makefile.voxelmesher -make.*.list* -qmake.vars -test.general.log -test.specific.log -zzzz* diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-itanium-glibc_2.2.4/qmake b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-itanium-glibc_2.2.4/qmake deleted file mode 100755 index 802271bb55..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-itanium-glibc_2.2.4/qmake and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-itanium-glibc_2.2.4/qmake.conf b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-itanium-glibc_2.2.4/qmake.conf deleted file mode 100644 index f623ad4fa1..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-itanium-glibc_2.2.4/qmake.conf +++ /dev/null @@ -1,92 +0,0 @@ -# -# $Id: qmake.conf,v 1.2 2004/10/21 20:32:04 wayne Exp $ -# -# qmake configuration for linux-icc -# -# Written for Intel C++ 5.0.1, 6.0.1, 7.0, and 8.0 for Linux. -# - -MAKEFILE_GENERATOR = UNIX -TEMPLATE = app -CONFIG += qt warn_on release link_prl - -QMAKE_CC = /opt/intel/compiler70/ia64/bin/ecc -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = yacc -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -DLARGE_FILES -QMAKE_CFLAGS_DEPS = -M -QMAKE_CFLAGS_WARN_ON = -QMAKE_CFLAGS_WARN_OFF = -w -QMAKE_CFLAGS_RELEASE = -O3 -QMAKE_CFLAGS_DEBUG = -g -QMAKE_CFLAGS_SHLIB = -KPIC -QMAKE_CFLAGS_YACC = -QMAKE_CFLAGS_THREAD = -D_REENTRANT - -QMAKE_CXX = /opt/intel/compiler70/ia64/bin/ecpc -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD - -QMAKE_INCDIR = -QMAKE_LIBDIR = -QMAKE_INCDIR_X11 = /usr/X11R6/include -QMAKE_LIBDIR_X11 = /usr/X11R6/lib -QMAKE_INCDIR_QT = $(QTDIR)/include -QMAKE_LIBDIR_QT = $(QTDIR)/lib -QMAKE_INCDIR_OPENGL = /usr/X11R6/include -QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib - -QMAKE_LINK = /opt/intel/compiler70/ia64/bin/ecpc -QMAKE_LINK_SHLIB = /opt/intel/compiler70/ia64/bin/ecpc -QMAKE_LFLAGS = -QMAKE_LFLAGS_RELEASE = -QMAKE_LFLAGS_DEBUG = -QMAKE_LFLAGS_SHLIB = -shared -QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_SONAME = -Qoption,ld,-soname, -QMAKE_LFLAGS_THREAD = -QMAKE_RPATH = -Qoption,ld,-rpath, - -QMAKE_LIBS = -QMAKE_LIBS_DYNLOAD = -ldl -QMAKE_LIBS_X11 = -lXext -lX11 -lm -QMAKE_LIBS_X11SM = -lSM -lICE -QMAKE_LIBS_NIS = -lnsl -QMAKE_LIBS_QT = -lqt -QMAKE_LIBS_QT_THREAD = -lqt-mt -QMAKE_LIBS_OPENGL = -lGLU -lGL -lXmu -QMAKE_LIBS_OPENGL_QT = -lGL -lXmu -QMAKE_LIBS_THREAD = -lpthread - -QMAKE_MOC = $(QTDIR)/bin/moc -QMAKE_UIC = $(QTDIR)/bin/uic - -QMAKE_AR = ar cqs -QMAKE_RANLIB = - -QMAKE_CLEAN = -r $(OBJECTS_DIR)/ti_files - -QMAKE_TAR = tar -cf -QMAKE_GZIP = gzip -9f - -QMAKE_COPY = cp -f -p -QMAKE_MOVE = mv -f -QMAKE_DEL_FILE = rm -f -QMAKE_DEL_DIR = rmdir -QMAKE_CHK_DIR_EXISTS = test -d -QMAKE_MKDIR = mkdir -p - -# added options for MeshKernel: -DEFINES += LINUX64_2_4_ITANIUM_GLIBC_2_2_4 -MK_BUILDNAME = linux64_2.4-itanium-glibc_2.2.4 -MK_LIBS_STLPORT = -lstlport_ecc -MK_LIBS_STLPORT_DEBUG = -lstlport_ecc_stldebug diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-itanium-glibc_2.2.4/qmake.conf.ecc b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-itanium-glibc_2.2.4/qmake.conf.ecc deleted file mode 100644 index 53a837982b..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-itanium-glibc_2.2.4/qmake.conf.ecc +++ /dev/null @@ -1,92 +0,0 @@ -# -# $Id: qmake.conf.ecc,v 1.1 2005/02/14 21:52:31 wo Exp $ -# -# qmake configuration for linux-icc -# -# Written for Intel C++ 5.0.1, 6.0.1, 7.0, and 8.0 for Linux. -# - -MAKEFILE_GENERATOR = UNIX -TEMPLATE = app -CONFIG += qt warn_on release link_prl - -QMAKE_CC = /opt/intel/compiler70/ia64/bin/ecc -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = yacc -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -DLARGE_FILES -QMAKE_CFLAGS_DEPS = -M -QMAKE_CFLAGS_WARN_ON = -QMAKE_CFLAGS_WARN_OFF = -w -QMAKE_CFLAGS_RELEASE = -O3 -QMAKE_CFLAGS_DEBUG = -g -QMAKE_CFLAGS_SHLIB = -KPIC -QMAKE_CFLAGS_YACC = -QMAKE_CFLAGS_THREAD = -D_REENTRANT - -QMAKE_CXX = /opt/intel/compiler70/ia64/bin/ecpc -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD - -QMAKE_INCDIR = -QMAKE_LIBDIR = -QMAKE_INCDIR_X11 = /usr/X11R6/include -QMAKE_LIBDIR_X11 = /usr/X11R6/lib -QMAKE_INCDIR_QT = $(QTDIR)/include -QMAKE_LIBDIR_QT = $(QTDIR)/lib -QMAKE_INCDIR_OPENGL = /usr/X11R6/include -QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib - -QMAKE_LINK = /opt/intel/compiler70/ia64/bin/ecpc -QMAKE_LINK_SHLIB = /opt/intel/compiler70/ia64/bin/ecpc -QMAKE_LFLAGS = -QMAKE_LFLAGS_RELEASE = -QMAKE_LFLAGS_DEBUG = -QMAKE_LFLAGS_SHLIB = -shared -QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_SONAME = -Qoption,ld,-soname, -QMAKE_LFLAGS_THREAD = -QMAKE_RPATH = -Qoption,ld,-rpath, - -QMAKE_LIBS = -QMAKE_LIBS_DYNLOAD = -ldl -QMAKE_LIBS_X11 = -lXext -lX11 -lm -QMAKE_LIBS_X11SM = -lSM -lICE -QMAKE_LIBS_NIS = -lnsl -QMAKE_LIBS_QT = -lqt -QMAKE_LIBS_QT_THREAD = -lqt-mt -QMAKE_LIBS_OPENGL = -lGLU -lGL -lXmu -QMAKE_LIBS_OPENGL_QT = -lGL -lXmu -QMAKE_LIBS_THREAD = -lpthread - -QMAKE_MOC = $(QTDIR)/bin/moc -QMAKE_UIC = $(QTDIR)/bin/uic - -QMAKE_AR = ar cqs -QMAKE_RANLIB = - -QMAKE_CLEAN = -r $(OBJECTS_DIR)/ti_files - -QMAKE_TAR = tar -cf -QMAKE_GZIP = gzip -9f - -QMAKE_COPY = cp -f -p -QMAKE_MOVE = mv -f -QMAKE_DEL_FILE = rm -f -QMAKE_DEL_DIR = rmdir -QMAKE_CHK_DIR_EXISTS = test -d -QMAKE_MKDIR = mkdir -p - -# added options for MeshKernel: -DEFINES += LINUX64_2_4_ITANIUM_GLIBC_2_2_4 -MK_BUILDNAME = linux64_2.4-itanium-glibc_2.2.4 -MK_LIBS_STLPORT = -lstlport_ecc -MK_LIBS_STLPORT_DEBUG = -lstlport_ecc_stldebug diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-itanium-glibc_2.2.4/qmake.conf.gcc b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-itanium-glibc_2.2.4/qmake.conf.gcc deleted file mode 100644 index e0f4c1649a..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-itanium-glibc_2.2.4/qmake.conf.gcc +++ /dev/null @@ -1,96 +0,0 @@ -# -# $Id: qmake.conf.gcc,v 1.1 2005/02/14 21:52:31 wo Exp $ -# -# qmake configuration for linux-g++ -# - -MAKEFILE_GENERATOR = UNIX -TEMPLATE = app -CONFIG += qt warn_on release incremental link_prl -QMAKE_INCREMENTAL_STYLE = sublib - -QMAKE_CC = gcc -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = yacc -QMAKE_YACCFLAGS = -d -QMAKE_YACCFLAGS_MANGLE = -p $base -b $base -QMAKE_YACC_HEADER = $base.tab.h -QMAKE_YACC_SOURCE = $base.tab.c -QMAKE_CFLAGS = -m64 -pipe -fPIC -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -QMAKE_CFLAGS_DEPS = -M -QMAKE_CFLAGS_WARN_ON = -Wall -W -QMAKE_CFLAGS_WARN_OFF = -w -QMAKE_CFLAGS_RELEASE = -O3 -QMAKE_CFLAGS_DEBUG = -g -QMAKE_CFLAGS_SHLIB = -fPIC -QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses -QMAKE_CFLAGS_THREAD = -D_REENTRANT - -QMAKE_CXX = g++ -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -fexceptions -QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD - -QMAKE_INCDIR = -QMAKE_LIBDIR = -QMAKE_INCDIR_X11 = /usr/X11R6/include -QMAKE_LIBDIR_X11 = /usr/X11R6/lib -QMAKE_INCDIR_QT = $(QTDIR)/include -QMAKE_LIBDIR_QT = $(QTDIR)/lib -QMAKE_INCDIR_OPENGL = /usr/X11R6/include -QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib - -QMAKE_LINK = g++ -QMAKE_LINK_SHLIB = g++ -QMAKE_LFLAGS = -QMAKE_LFLAGS_RELEASE = -QMAKE_LFLAGS_DEBUG = -QMAKE_LFLAGS_SHLIB = -shared -QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_SONAME = -Wl,-soname, -QMAKE_LFLAGS_THREAD = -QMAKE_RPATH = -Wl,-rpath, - -QMAKE_LIBS = -QMAKE_LIBS_DYNLOAD = -ldl -QMAKE_LIBS_X11 = -lXext -lX11 -lm -QMAKE_LIBS_X11SM = -lSM -lICE -QMAKE_LIBS_NIS = -lnsl -QMAKE_LIBS_QT = -lqt -QMAKE_LIBS_QT_THREAD = -lqt-mt -QMAKE_LIBS_OPENGL = -lGLU -lGL -lXmu -QMAKE_LIBS_OPENGL_QT = -lGL -lXmu -QMAKE_LIBS_THREAD = -lpthread - -QMAKE_MOC = $(QTDIR)/bin/moc -QMAKE_UIC = $(QTDIR)/bin/uic - -QMAKE_AR = ar cqs -QMAKE_RANLIB = - -QMAKE_TAR = tar -cf -QMAKE_GZIP = gzip -9f - -QMAKE_COPY = cp -f -p -QMAKE_COPY_FILE = $(COPY) -QMAKE_COPY_DIR = $(COPY) -r -QMAKE_MOVE = mv -f -QMAKE_DEL_FILE = rm -f -QMAKE_DEL_DIR = rmdir -QMAKE_STRIP = strip -QMAKE_STRIPFLAGS_LIB += --strip-unneeded -QMAKE_CHK_DIR_EXISTS = test -d -QMAKE_MKDIR = mkdir -p - -# added options for MeshKernel: -DEFINES += LINUX64_2_4_X86_GLIBC_2_2_5 -MK_BUILDNAME = linux64_2.4-x86-glibc_2.2.5 -MK_LIBS_STLPORT = -lstlport_gcc -MK_LIBS_STLPORT_DEBUG = -lstlport_gcc_stldebug diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-itanium-glibc_2.2.4/qplatformdefs.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-itanium-glibc_2.2.4/qplatformdefs.h deleted file mode 100644 index e25bc1e221..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-itanium-glibc_2.2.4/qplatformdefs.h +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H - -// Get Qt defines/settings - -#include "qglobal.h" - -// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs - -// DNS system header files are a mess! -// includes . is using -// 'u_char' and includes . Now the problem is that -// defines 'u_char' only if __USE_BSD is defined. -// __USE_BSD is defined in if _BSD_SOURCE is defined. -#ifndef _BSD_SOURCE -# define _BSD_SOURCE -#endif - -// 1) need to reset default environment if _BSD_SOURCE is defined -// 2) need to specify POSIX thread interfaces explicitly in glibc 2.0 -// 3) it seems older glibc need this to include the X/Open stuff -#ifndef _GNU_SOURCE -# define _GNU_SOURCE -#endif - -#include - - -// We are hot - unistd.h should have turned on the specific APIs we requested - - -#ifdef QT_THREAD_SUPPORT -#include -#endif - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -// DNS header files are not fully covered by X/Open specifications. -// In particular nothing is said about res_* :/ -// Header files and are not included -// by on older versions of the GNU C library. Note that -// must be included before . -#include -#include -#include - - -#if !defined(QT_NO_COMPAT) -#define QT_STATBUF struct stat -#define QT_STATBUF4TSTAT struct stat -#define QT_STAT ::stat -#define QT_FSTAT ::fstat -#define QT_STAT_REG S_IFREG -#define QT_STAT_DIR S_IFDIR -#define QT_STAT_MASK S_IFMT -#define QT_STAT_LNK S_IFLNK -#define QT_FILENO fileno -#define QT_OPEN ::open -#define QT_CLOSE ::close -#define QT_LSEEK ::lseek -#define QT_READ ::read -#define QT_WRITE ::write -#define QT_ACCESS ::access -#define QT_GETCWD ::getcwd -#define QT_CHDIR ::chdir -#define QT_MKDIR ::mkdir -#define QT_RMDIR ::rmdir -#define QT_OPEN_RDONLY O_RDONLY -#define QT_OPEN_WRONLY O_WRONLY -#define QT_OPEN_RDWR O_RDWR -#define QT_OPEN_CREAT O_CREAT -#define QT_OPEN_TRUNC O_TRUNC -#define QT_OPEN_APPEND O_APPEND -#endif - -#define QT_SIGNAL_RETTYPE void -#define QT_SIGNAL_ARGS int -#define QT_SIGNAL_IGNORE SIG_IGN - -#if defined(__GLIBC__) && (__GLIBC__ >= 2) -#define QT_SOCKLEN_T socklen_t -#else -#define QT_SOCKLEN_T int -#endif - -#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500) -#define QT_SNPRINTF ::snprintf -#define QT_VSNPRINTF ::vsnprintf -#endif - - -#endif // QPLATFORMDEFS_H diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-x86-glibc_2.2.5/.cvsignore b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-x86-glibc_2.2.5/.cvsignore deleted file mode 100644 index aa6c7eb936..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-x86-glibc_2.2.5/.cvsignore +++ /dev/null @@ -1,36 +0,0 @@ -*.pro -*~ -Makefile.cartesian -Makefile.cfev -Makefile.cfevtest -Makefile.collapser -Makefile.common -Makefile.compatibility -Makefile.convex_decomp -Makefile.core -Makefile.corealg -Makefile.coreio -Makefile.geometry -Makefile.interf -Makefile.license -Makefile.linalg -Makefile.meshercommon -Makefile.mkprogen -Makefile.mkprospec -Makefile.newsurface -Makefile.newvolume -Makefile.octree -Makefile.pipeline -Makefile.resurfacer -Makefile.robustgeometry -Makefile.surface -Makefile.surfacerepair -Makefile.surfacewrapper -Makefile.test -Makefile.viewcommon -Makefile.voxelmesher -make.*.list* -qmake.vars -test.general.log -test.specific.log -zzzz* diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-x86-glibc_2.2.5/qmake b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-x86-glibc_2.2.5/qmake deleted file mode 100755 index acf5f4b7fd..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-x86-glibc_2.2.5/qmake and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-x86-glibc_2.2.5/qmake.conf b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-x86-glibc_2.2.5/qmake.conf deleted file mode 100644 index 4f4fdf32c0..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-x86-glibc_2.2.5/qmake.conf +++ /dev/null @@ -1,96 +0,0 @@ -# -# $Id: qmake.conf,v 1.6 2005/03/09 22:10:54 wo Exp $ -# -# qmake configuration for linux-g++ -# - -MAKEFILE_GENERATOR = UNIX -TEMPLATE = app -CONFIG += qt warn_on release incremental link_prl -QMAKE_INCREMENTAL_STYLE = sublib - -QMAKE_CC = gcc -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = yacc -QMAKE_YACCFLAGS = -d -QMAKE_YACCFLAGS_MANGLE = -p $base -b $base -QMAKE_YACC_HEADER = $base.tab.h -QMAKE_YACC_SOURCE = $base.tab.c -QMAKE_CFLAGS = -m64 -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -QMAKE_CFLAGS_DEPS = -M -QMAKE_CFLAGS_WARN_ON = -Wall -W -QMAKE_CFLAGS_WARN_OFF = -w -QMAKE_CFLAGS_RELEASE = -O3 -QMAKE_CFLAGS_DEBUG = -g -QMAKE_CFLAGS_SHLIB = -fPIC -QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses -QMAKE_CFLAGS_THREAD = -D_REENTRANT - -QMAKE_CXX = g++ -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -fexceptions -QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD - -QMAKE_INCDIR = -QMAKE_LIBDIR = -QMAKE_INCDIR_X11 = /usr/X11R6/include -QMAKE_LIBDIR_X11 = /usr/X11R6/lib -QMAKE_INCDIR_QT = $(QTDIR)/include -QMAKE_LIBDIR_QT = $(QTDIR)/lib -QMAKE_INCDIR_OPENGL = /usr/X11R6/include -QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib - -QMAKE_LINK = g++ -QMAKE_LINK_SHLIB = g++ -QMAKE_LFLAGS = -QMAKE_LFLAGS_RELEASE = -QMAKE_LFLAGS_DEBUG = -QMAKE_LFLAGS_SHLIB = -shared -QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_SONAME = -Wl,-soname, -QMAKE_LFLAGS_THREAD = -QMAKE_RPATH = -Wl,-rpath, - -QMAKE_LIBS = -QMAKE_LIBS_DYNLOAD = -ldl -QMAKE_LIBS_X11 = -lXext -lX11 -lm -QMAKE_LIBS_X11SM = -lSM -lICE -QMAKE_LIBS_NIS = -lnsl -QMAKE_LIBS_QT = -lqt -QMAKE_LIBS_QT_THREAD = -lqt-mt -QMAKE_LIBS_OPENGL = -lGLU -lGL -lXmu -QMAKE_LIBS_OPENGL_QT = -lGL -lXmu -QMAKE_LIBS_THREAD = -lpthread - -QMAKE_MOC = $(QTDIR)/bin/moc -QMAKE_UIC = $(QTDIR)/bin/uic - -QMAKE_AR = ar cqs -QMAKE_RANLIB = - -QMAKE_TAR = tar -cf -QMAKE_GZIP = gzip -9f - -QMAKE_COPY = cp -f -p -QMAKE_COPY_FILE = $(COPY) -QMAKE_COPY_DIR = $(COPY) -r -QMAKE_MOVE = mv -f -QMAKE_DEL_FILE = rm -f -QMAKE_DEL_DIR = rmdir -QMAKE_STRIP = strip -QMAKE_STRIPFLAGS_LIB += --strip-unneeded -QMAKE_CHK_DIR_EXISTS = test -d -QMAKE_MKDIR = mkdir -p - -# added options for MeshKernel: -DEFINES += LINUX64_2_4_X86_GLIBC_2_2_5 -MK_BUILDNAME = linux64_2.4-x86-glibc_2.2.5 -MK_LIBS_STLPORT = -lstlport_gcc -MK_LIBS_STLPORT_DEBUG = -lstlport_gcc_stldebug diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-x86-glibc_2.2.5/qplatformdefs.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-x86-glibc_2.2.5/qplatformdefs.h deleted file mode 100644 index e25bc1e221..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-x86-glibc_2.2.5/qplatformdefs.h +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H - -// Get Qt defines/settings - -#include "qglobal.h" - -// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs - -// DNS system header files are a mess! -// includes . is using -// 'u_char' and includes . Now the problem is that -// defines 'u_char' only if __USE_BSD is defined. -// __USE_BSD is defined in if _BSD_SOURCE is defined. -#ifndef _BSD_SOURCE -# define _BSD_SOURCE -#endif - -// 1) need to reset default environment if _BSD_SOURCE is defined -// 2) need to specify POSIX thread interfaces explicitly in glibc 2.0 -// 3) it seems older glibc need this to include the X/Open stuff -#ifndef _GNU_SOURCE -# define _GNU_SOURCE -#endif - -#include - - -// We are hot - unistd.h should have turned on the specific APIs we requested - - -#ifdef QT_THREAD_SUPPORT -#include -#endif - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -// DNS header files are not fully covered by X/Open specifications. -// In particular nothing is said about res_* :/ -// Header files and are not included -// by on older versions of the GNU C library. Note that -// must be included before . -#include -#include -#include - - -#if !defined(QT_NO_COMPAT) -#define QT_STATBUF struct stat -#define QT_STATBUF4TSTAT struct stat -#define QT_STAT ::stat -#define QT_FSTAT ::fstat -#define QT_STAT_REG S_IFREG -#define QT_STAT_DIR S_IFDIR -#define QT_STAT_MASK S_IFMT -#define QT_STAT_LNK S_IFLNK -#define QT_FILENO fileno -#define QT_OPEN ::open -#define QT_CLOSE ::close -#define QT_LSEEK ::lseek -#define QT_READ ::read -#define QT_WRITE ::write -#define QT_ACCESS ::access -#define QT_GETCWD ::getcwd -#define QT_CHDIR ::chdir -#define QT_MKDIR ::mkdir -#define QT_RMDIR ::rmdir -#define QT_OPEN_RDONLY O_RDONLY -#define QT_OPEN_WRONLY O_WRONLY -#define QT_OPEN_RDWR O_RDWR -#define QT_OPEN_CREAT O_CREAT -#define QT_OPEN_TRUNC O_TRUNC -#define QT_OPEN_APPEND O_APPEND -#endif - -#define QT_SIGNAL_RETTYPE void -#define QT_SIGNAL_ARGS int -#define QT_SIGNAL_IGNORE SIG_IGN - -#if defined(__GLIBC__) && (__GLIBC__ >= 2) -#define QT_SOCKLEN_T socklen_t -#else -#define QT_SOCKLEN_T int -#endif - -#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500) -#define QT_SNPRINTF ::snprintf -#define QT_VSNPRINTF ::vsnprintf -#endif - - -#endif // QPLATFORMDEFS_H diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-x86-glibc_2.3.2/.cvsignore b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-x86-glibc_2.3.2/.cvsignore deleted file mode 100644 index aa6c7eb936..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-x86-glibc_2.3.2/.cvsignore +++ /dev/null @@ -1,36 +0,0 @@ -*.pro -*~ -Makefile.cartesian -Makefile.cfev -Makefile.cfevtest -Makefile.collapser -Makefile.common -Makefile.compatibility -Makefile.convex_decomp -Makefile.core -Makefile.corealg -Makefile.coreio -Makefile.geometry -Makefile.interf -Makefile.license -Makefile.linalg -Makefile.meshercommon -Makefile.mkprogen -Makefile.mkprospec -Makefile.newsurface -Makefile.newvolume -Makefile.octree -Makefile.pipeline -Makefile.resurfacer -Makefile.robustgeometry -Makefile.surface -Makefile.surfacerepair -Makefile.surfacewrapper -Makefile.test -Makefile.viewcommon -Makefile.voxelmesher -make.*.list* -qmake.vars -test.general.log -test.specific.log -zzzz* diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-x86-glibc_2.3.2/qmake b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-x86-glibc_2.3.2/qmake deleted file mode 100755 index acf5f4b7fd..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-x86-glibc_2.3.2/qmake and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-x86-glibc_2.3.2/qmake.conf b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-x86-glibc_2.3.2/qmake.conf deleted file mode 100644 index afc930b1c9..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-x86-glibc_2.3.2/qmake.conf +++ /dev/null @@ -1,96 +0,0 @@ -# -# $Id: qmake.conf,v 1.6 2005/02/09 18:42:13 wo Exp $ -# -# qmake configuration for linux-g++ -# - -MAKEFILE_GENERATOR = UNIX -TEMPLATE = app -CONFIG += qt warn_on release incremental link_prl -QMAKE_INCREMENTAL_STYLE = sublib - -QMAKE_CC = gcc -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = yacc -QMAKE_YACCFLAGS = -d -QMAKE_YACCFLAGS_MANGLE = -p $base -b $base -QMAKE_YACC_HEADER = $base.tab.h -QMAKE_YACC_SOURCE = $base.tab.c -QMAKE_CFLAGS = -m64 -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -QMAKE_CFLAGS_DEPS = -M -QMAKE_CFLAGS_WARN_ON = -Wall -W -QMAKE_CFLAGS_WARN_OFF = -w -QMAKE_CFLAGS_RELEASE = -O3 -QMAKE_CFLAGS_DEBUG = -g -QMAKE_CFLAGS_SHLIB = -fPIC -QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses -QMAKE_CFLAGS_THREAD = -D_REENTRANT - -QMAKE_CXX = g++ -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -fexceptions -QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD - -QMAKE_INCDIR = -QMAKE_LIBDIR = -QMAKE_INCDIR_X11 = /usr/X11R6/include -QMAKE_LIBDIR_X11 = /usr/X11R6/lib -QMAKE_INCDIR_QT = $(QTDIR)/include -QMAKE_LIBDIR_QT = $(QTDIR)/lib -QMAKE_INCDIR_OPENGL = /usr/X11R6/include -QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib - -QMAKE_LINK = g++ -QMAKE_LINK_SHLIB = g++ -QMAKE_LFLAGS = -QMAKE_LFLAGS_RELEASE = -QMAKE_LFLAGS_DEBUG = -QMAKE_LFLAGS_SHLIB = -shared -QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_SONAME = -Wl,-soname, -QMAKE_LFLAGS_THREAD = -QMAKE_RPATH = -Wl,-rpath, - -QMAKE_LIBS = -QMAKE_LIBS_DYNLOAD = -ldl -QMAKE_LIBS_X11 = -lXext -lX11 -lm -QMAKE_LIBS_X11SM = -lSM -lICE -QMAKE_LIBS_NIS = -lnsl -QMAKE_LIBS_QT = -lqt -QMAKE_LIBS_QT_THREAD = -lqt-mt -QMAKE_LIBS_OPENGL = -lGLU -lGL -lXmu -QMAKE_LIBS_OPENGL_QT = -lGL -lXmu -QMAKE_LIBS_THREAD = -lpthread - -QMAKE_MOC = $(QTDIR)/bin/moc -QMAKE_UIC = $(QTDIR)/bin/uic - -QMAKE_AR = ar cqs -QMAKE_RANLIB = - -QMAKE_TAR = tar -cf -QMAKE_GZIP = gzip -9f - -QMAKE_COPY = cp -f -p -QMAKE_COPY_FILE = $(COPY) -QMAKE_COPY_DIR = $(COPY) -r -QMAKE_MOVE = mv -f -QMAKE_DEL_FILE = rm -f -QMAKE_DEL_DIR = rmdir -QMAKE_STRIP = strip -QMAKE_STRIPFLAGS_LIB += --strip-unneeded -QMAKE_CHK_DIR_EXISTS = test -d -QMAKE_MKDIR = mkdir -p - -# added options for MeshKernel: -DEFINES += LINUX64_2_4_X86_GLIBC_2_3_2 -MK_BUILDNAME = linux64_2.4-x86-glibc_2.3.2 -MK_LIBS_STLPORT = -lstlport_gcc -MK_LIBS_STLPORT_DEBUG = -lstlport_gcc_stldebug diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-x86-glibc_2.3.2/qplatformdefs.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-x86-glibc_2.3.2/qplatformdefs.h deleted file mode 100644 index e25bc1e221..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.4-x86-glibc_2.3.2/qplatformdefs.h +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H - -// Get Qt defines/settings - -#include "qglobal.h" - -// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs - -// DNS system header files are a mess! -// includes . is using -// 'u_char' and includes . Now the problem is that -// defines 'u_char' only if __USE_BSD is defined. -// __USE_BSD is defined in if _BSD_SOURCE is defined. -#ifndef _BSD_SOURCE -# define _BSD_SOURCE -#endif - -// 1) need to reset default environment if _BSD_SOURCE is defined -// 2) need to specify POSIX thread interfaces explicitly in glibc 2.0 -// 3) it seems older glibc need this to include the X/Open stuff -#ifndef _GNU_SOURCE -# define _GNU_SOURCE -#endif - -#include - - -// We are hot - unistd.h should have turned on the specific APIs we requested - - -#ifdef QT_THREAD_SUPPORT -#include -#endif - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -// DNS header files are not fully covered by X/Open specifications. -// In particular nothing is said about res_* :/ -// Header files and are not included -// by on older versions of the GNU C library. Note that -// must be included before . -#include -#include -#include - - -#if !defined(QT_NO_COMPAT) -#define QT_STATBUF struct stat -#define QT_STATBUF4TSTAT struct stat -#define QT_STAT ::stat -#define QT_FSTAT ::fstat -#define QT_STAT_REG S_IFREG -#define QT_STAT_DIR S_IFDIR -#define QT_STAT_MASK S_IFMT -#define QT_STAT_LNK S_IFLNK -#define QT_FILENO fileno -#define QT_OPEN ::open -#define QT_CLOSE ::close -#define QT_LSEEK ::lseek -#define QT_READ ::read -#define QT_WRITE ::write -#define QT_ACCESS ::access -#define QT_GETCWD ::getcwd -#define QT_CHDIR ::chdir -#define QT_MKDIR ::mkdir -#define QT_RMDIR ::rmdir -#define QT_OPEN_RDONLY O_RDONLY -#define QT_OPEN_WRONLY O_WRONLY -#define QT_OPEN_RDWR O_RDWR -#define QT_OPEN_CREAT O_CREAT -#define QT_OPEN_TRUNC O_TRUNC -#define QT_OPEN_APPEND O_APPEND -#endif - -#define QT_SIGNAL_RETTYPE void -#define QT_SIGNAL_ARGS int -#define QT_SIGNAL_IGNORE SIG_IGN - -#if defined(__GLIBC__) && (__GLIBC__ >= 2) -#define QT_SOCKLEN_T socklen_t -#else -#define QT_SOCKLEN_T int -#endif - -#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500) -#define QT_SNPRINTF ::snprintf -#define QT_VSNPRINTF ::vsnprintf -#endif - - -#endif // QPLATFORMDEFS_H diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.6-pwr4-glibc_2.3.3/qmake b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.6-pwr4-glibc_2.3.3/qmake deleted file mode 100755 index 89f1554395..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.6-pwr4-glibc_2.3.3/qmake and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.6-pwr4-glibc_2.3.3/qmake.conf b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.6-pwr4-glibc_2.3.3/qmake.conf deleted file mode 100644 index 632cba9fda..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.6-pwr4-glibc_2.3.3/qmake.conf +++ /dev/null @@ -1,91 +0,0 @@ - -# -# $Id: qmake.conf,v 1.1 2005/09/29 22:19:19 geoffp Exp $ -# -# qmake configuration for aix-xlc -# - -MAKEFILE_GENERATOR = UNIX -TEMPLATE = app -CONFIG += qt warn_on release link_prl - -QMAKE_CC = xlc -QMAKE_CC_THREAD = xlc_r -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = yacc -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -q64 -Q -q64 -qmaxmem=-1 -ma -qnoro -qnomaf -qstrict -DLARGE_FILES -D_LARGEFILE_SOURCE -# -qwarn64 turns on too many bogus warnings and shadows real warnings -#QMAKE_CFLAGS_WARN_ON = -qwarn64 -QMAKE_CFLAGS_WARN_ON = -QMAKE_CFLAGS_WARN_OFF = -QMAKE_CFLAGS_RELEASE = -O3 -QMAKE_CFLAGS_DEBUG = -g -QMAKE_CFLAGS_SHLIB = -QMAKE_CFLAGS_YACC = -QMAKE_CFLAGS_THREAD = -qthreaded - -QMAKE_CXX = xlC -QMAKE_CXX_THREAD = xlC_r -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -qrtti=all -qnotempinc -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD - -QMAKE_INCDIR = -QMAKE_LIBDIR = -QMAKE_INCDIR_X11 = -QMAKE_LIBDIR_X11 = -QMAKE_INCDIR_QT = $(QTDIR)/include -QMAKE_LIBDIR_QT = $(QTDIR)/lib -QMAKE_INCDIR_OPENGL = -QMAKE_LIBDIR_OPENGL = - -QMAKE_LINK = xlC -QMAKE_LINK_THREAD = xlC_r -QMAKE_LINK_SHLIB = ld -QMAKE_LFLAGS = -q64 -qnotempinc -QMAKE_LFLAGS_RELEASE = -QMAKE_LFLAGS_DEBUG = -QMAKE_LFLAGS_SHLIB = -qmkshrobj -QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_SONAME = -QMAKE_LFLAGS_THREAD = -L/usr/lib/threads -QMAKE_AIX_SHLIB = 1 - -QMAKE_LIBS = -QMAKE_LIBS_DYNLOAD = -ldl -QMAKE_LIBS_X11 = -lXext -lX11 -lm -lbind -QMAKE_LIBS_X11SM = -lSM -lICE -QMAKE_LIBS_QT = -lqt -QMAKE_LIBS_QT_THREAD = -lqt-mt -QMAKE_LIBS_OPENGL = -lGLU -lGL -lXmu -QMAKE_LIBS_OPENGL_QT = -lGL -lXmu -QMAKE_LIBS_THREAD = -lpthreads - -QMAKE_MOC = $(QTDIR)/bin/moc -QMAKE_UIC = $(QTDIR)/bin/uic - -QMAKE_AR = ar cq -QMAKE_RANLIB = ranlib -X64 - -QMAKE_TAR = tar -cf -QMAKE_GZIP = gzip -9f - -QMAKE_COPY = cp -f -p -QMAKE_MOVE = mv -f -QMAKE_DEL_FILE = rm -f -QMAKE_DEL_DIR = rmdir -QMAKE_CHK_DIR_EXISTS = test -d -QMAKE_MKDIR = mkdir -p - -# added options for MeshKernel: -DEFINES += LINUX64_2_6_PWR4 -MK_BUILDNAME = linux64_2.6-pwr4-glibc_2.3.3 -MK_LIBS_STLPORT = -lstlport_xlC50 -MK_LIBS_STLPORT_DEBUG = -lstlport_xlC50 diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.6-pwr4-glibc_2.3.3/qplatformdefs.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.6-pwr4-glibc_2.3.3/qplatformdefs.h deleted file mode 100644 index 3b438985c0..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux64_2.6-pwr4-glibc_2.3.3/qplatformdefs.h +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H - -// Get Qt defines/settings - -#include "qglobal.h" - -// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs - -#include - - -// We are hot - unistd.h should have turned on the specific APIs we requested - - -#ifdef QT_THREAD_SUPPORT -#include -#endif - -#include -#include -#include -#include -#include -#include -#include // AIX X11 headers define FD_ZERO using bzero() - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// DNS header files are not fully covered by X/Open specifications. -// In particular nothing is said about res_* :/ -// On AIX header files and are not -// included by . Note that must be included -// before . -#include -#define class nsrr_class // AIX 4.3.1.0 -#include -#undef class -#include - - -#if !defined(QT_NO_COMPAT) -#define QT_STATBUF struct stat -#define QT_STATBUF4TSTAT struct stat -#define QT_STAT ::stat -#define QT_FSTAT ::fstat -#define QT_STAT_REG S_IFREG -#define QT_STAT_DIR S_IFDIR -#define QT_STAT_MASK S_IFMT -#define QT_STAT_LNK S_IFLNK -#define QT_FILENO fileno -#define QT_OPEN ::open -#define QT_CLOSE ::close -#define QT_LSEEK ::lseek -#define QT_READ ::read -#define QT_WRITE ::write -#define QT_ACCESS ::access -#define QT_GETCWD ::getcwd -#define QT_CHDIR ::chdir -#define QT_MKDIR ::mkdir -#define QT_RMDIR ::rmdir -#define QT_OPEN_RDONLY O_RDONLY -#define QT_OPEN_WRONLY O_WRONLY -#define QT_OPEN_RDWR O_RDWR -#define QT_OPEN_CREAT O_CREAT -#define QT_OPEN_TRUNC O_TRUNC -#define QT_OPEN_APPEND O_APPEND -#endif - -#define QT_SIGNAL_RETTYPE void -#define QT_SIGNAL_ARGS int -#define QT_SIGNAL_IGNORE SIG_IGN - -// Only AIX 4.3 and better supports 64-bit. -// The AIX 4.3 online documentation says 'size_t' but a user asked IBM -// and they told him the documentation is wrong. Indeed 'size_t' is -// obviously wrong for 64-bit programming. And anyway 'socklen_t' -// reportedly works for all AIX 4.3 users. -#define QT_SOCKLEN_T socklen_t - -#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500) -// Only AIX 4.3 and better supports 64-bit. -#define QT_SNPRINTF ::snprintf -#define QT_VSNPRINTF ::vsnprintf -#endif - - -#endif // QPLATFORMDEFS_H diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux_2.2-x86-glibc_2.2.0/.cvsignore b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux_2.2-x86-glibc_2.2.0/.cvsignore deleted file mode 100644 index aa6c7eb936..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux_2.2-x86-glibc_2.2.0/.cvsignore +++ /dev/null @@ -1,36 +0,0 @@ -*.pro -*~ -Makefile.cartesian -Makefile.cfev -Makefile.cfevtest -Makefile.collapser -Makefile.common -Makefile.compatibility -Makefile.convex_decomp -Makefile.core -Makefile.corealg -Makefile.coreio -Makefile.geometry -Makefile.interf -Makefile.license -Makefile.linalg -Makefile.meshercommon -Makefile.mkprogen -Makefile.mkprospec -Makefile.newsurface -Makefile.newvolume -Makefile.octree -Makefile.pipeline -Makefile.resurfacer -Makefile.robustgeometry -Makefile.surface -Makefile.surfacerepair -Makefile.surfacewrapper -Makefile.test -Makefile.viewcommon -Makefile.voxelmesher -make.*.list* -qmake.vars -test.general.log -test.specific.log -zzzz* diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux_2.2-x86-glibc_2.2.0/qmake b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux_2.2-x86-glibc_2.2.0/qmake deleted file mode 100755 index 485e0cae55..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux_2.2-x86-glibc_2.2.0/qmake and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux_2.2-x86-glibc_2.2.0/qmake.conf b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux_2.2-x86-glibc_2.2.0/qmake.conf deleted file mode 100644 index 26fd78e4d5..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux_2.2-x86-glibc_2.2.0/qmake.conf +++ /dev/null @@ -1,95 +0,0 @@ -# -# $Id: qmake.conf,v 1.8 2004/10/21 20:32:04 wayne Exp $ -# -# qmake configuration for linux-g++ -# -# - -MAKEFILE_GENERATOR = UNIX -TEMPLATE = app -CONFIG += qt warn_on release incremental link_prl -QMAKE_INCREMENTAL_STYLE = sublib - -QMAKE_CC = gcc -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = yacc -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -QMAKE_CFLAGS_DEPS = -M -QMAKE_CFLAGS_WARN_ON = -Wall -W -QMAKE_CFLAGS_WARN_OFF = -w -QMAKE_CFLAGS_RELEASE = -O3 -QMAKE_CFLAGS_DEBUG = -g -QMAKE_CFLAGS_SHLIB = -fPIC -QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses -QMAKE_CFLAGS_THREAD = -D_REENTRANT - -QMAKE_CXX = g++ -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD - -QMAKE_INCDIR = -QMAKE_LIBDIR = -QMAKE_INCDIR_X11 = /usr/X11R6/include -QMAKE_LIBDIR_X11 = /usr/X11R6/lib -QMAKE_INCDIR_QT = $(QTDIR)/include -QMAKE_LIBDIR_QT = $(QTDIR)/lib -QMAKE_INCDIR_OPENGL = /usr/X11R6/include -QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib - -QMAKE_LINK = $$QMAKE_CXX -QMAKE_LINK_SHLIB = $$QMAKE_CXX -QMAKE_LFLAGS = -QMAKE_LFLAGS_RELEASE = -QMAKE_LFLAGS_DEBUG = -QMAKE_LFLAGS_SHLIB = -shared -QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_SONAME = -Wl,-soname, -QMAKE_LFLAGS_THREAD = -QMAKE_RPATH = -Wl,-rpath, - -QMAKE_LIBS = -QMAKE_LIBS_DYNLOAD = -ldl -QMAKE_LIBS_X11 = -lXext -lX11 -lm -QMAKE_LIBS_X11SM = -lSM -lICE -QMAKE_LIBS_NIS = -lnsl -QMAKE_LIBS_QT = -lqt -QMAKE_LIBS_QT_THREAD = -lqt-mt -QMAKE_LIBS_OPENGL = -lGLU -lGL -lXmu -QMAKE_LIBS_OPENGL_QT = -lGL -lXmu -QMAKE_LIBS_THREAD = -lpthread - -QMAKE_MOC = $(QTDIR)/bin/moc -QMAKE_UIC = $(QTDIR)/bin/uic - -QMAKE_AR = ar cqs -QMAKE_RANLIB = - -QMAKE_TAR = tar -cf -QMAKE_GZIP = gzip -9f - -# edited for MeshKernel: added -p option to copy -QMAKE_COPY = cp -pf -QMAKE_COPY_FILE = $(COPY) -QMAKE_COPY_DIR = $(COPY) -r -QMAKE_MOVE = mv -f -QMAKE_DEL_FILE = rm -f -QMAKE_DEL_DIR = rmdir -QMAKE_STRIP = strip -QMAKE_STRIPFLAGS_LIB += --strip-unneeded -QMAKE_CHK_DIR_EXISTS = test -d -QMAKE_MKDIR = mkdir -p - -# added options for MeshKernel: -DEFINES += LINUX_2_2_X86_GLIBC_2_2_0 -MK_BUILDNAME = linux_2.2-x86-glibc_2.2.0 -MK_LIBS_STLPORT = -lstlport_gcc -MK_LIBS_STLPORT_DEBUG = -lstlport_gcc_stldebug diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux_2.2-x86-glibc_2.2.0/qplatformdefs.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux_2.2-x86-glibc_2.2.0/qplatformdefs.h deleted file mode 100644 index e25bc1e221..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux_2.2-x86-glibc_2.2.0/qplatformdefs.h +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H - -// Get Qt defines/settings - -#include "qglobal.h" - -// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs - -// DNS system header files are a mess! -// includes . is using -// 'u_char' and includes . Now the problem is that -// defines 'u_char' only if __USE_BSD is defined. -// __USE_BSD is defined in if _BSD_SOURCE is defined. -#ifndef _BSD_SOURCE -# define _BSD_SOURCE -#endif - -// 1) need to reset default environment if _BSD_SOURCE is defined -// 2) need to specify POSIX thread interfaces explicitly in glibc 2.0 -// 3) it seems older glibc need this to include the X/Open stuff -#ifndef _GNU_SOURCE -# define _GNU_SOURCE -#endif - -#include - - -// We are hot - unistd.h should have turned on the specific APIs we requested - - -#ifdef QT_THREAD_SUPPORT -#include -#endif - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -// DNS header files are not fully covered by X/Open specifications. -// In particular nothing is said about res_* :/ -// Header files and are not included -// by on older versions of the GNU C library. Note that -// must be included before . -#include -#include -#include - - -#if !defined(QT_NO_COMPAT) -#define QT_STATBUF struct stat -#define QT_STATBUF4TSTAT struct stat -#define QT_STAT ::stat -#define QT_FSTAT ::fstat -#define QT_STAT_REG S_IFREG -#define QT_STAT_DIR S_IFDIR -#define QT_STAT_MASK S_IFMT -#define QT_STAT_LNK S_IFLNK -#define QT_FILENO fileno -#define QT_OPEN ::open -#define QT_CLOSE ::close -#define QT_LSEEK ::lseek -#define QT_READ ::read -#define QT_WRITE ::write -#define QT_ACCESS ::access -#define QT_GETCWD ::getcwd -#define QT_CHDIR ::chdir -#define QT_MKDIR ::mkdir -#define QT_RMDIR ::rmdir -#define QT_OPEN_RDONLY O_RDONLY -#define QT_OPEN_WRONLY O_WRONLY -#define QT_OPEN_RDWR O_RDWR -#define QT_OPEN_CREAT O_CREAT -#define QT_OPEN_TRUNC O_TRUNC -#define QT_OPEN_APPEND O_APPEND -#endif - -#define QT_SIGNAL_RETTYPE void -#define QT_SIGNAL_ARGS int -#define QT_SIGNAL_IGNORE SIG_IGN - -#if defined(__GLIBC__) && (__GLIBC__ >= 2) -#define QT_SOCKLEN_T socklen_t -#else -#define QT_SOCKLEN_T int -#endif - -#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500) -#define QT_SNPRINTF ::snprintf -#define QT_VSNPRINTF ::vsnprintf -#endif - - -#endif // QPLATFORMDEFS_H diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux_2.4-x86-glibc_2.3.2/.cvsignore b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux_2.4-x86-glibc_2.3.2/.cvsignore deleted file mode 100644 index aa6c7eb936..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux_2.4-x86-glibc_2.3.2/.cvsignore +++ /dev/null @@ -1,36 +0,0 @@ -*.pro -*~ -Makefile.cartesian -Makefile.cfev -Makefile.cfevtest -Makefile.collapser -Makefile.common -Makefile.compatibility -Makefile.convex_decomp -Makefile.core -Makefile.corealg -Makefile.coreio -Makefile.geometry -Makefile.interf -Makefile.license -Makefile.linalg -Makefile.meshercommon -Makefile.mkprogen -Makefile.mkprospec -Makefile.newsurface -Makefile.newvolume -Makefile.octree -Makefile.pipeline -Makefile.resurfacer -Makefile.robustgeometry -Makefile.surface -Makefile.surfacerepair -Makefile.surfacewrapper -Makefile.test -Makefile.viewcommon -Makefile.voxelmesher -make.*.list* -qmake.vars -test.general.log -test.specific.log -zzzz* diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux_2.4-x86-glibc_2.3.2/qmake b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux_2.4-x86-glibc_2.3.2/qmake deleted file mode 100755 index 9f29c1ded0..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux_2.4-x86-glibc_2.3.2/qmake and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux_2.4-x86-glibc_2.3.2/qmake.conf b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux_2.4-x86-glibc_2.3.2/qmake.conf deleted file mode 100644 index 2e0890442b..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux_2.4-x86-glibc_2.3.2/qmake.conf +++ /dev/null @@ -1,95 +0,0 @@ -# -# $Id: qmake.conf,v 1.3 2004/10/21 20:32:04 wayne Exp $ -# -# qmake configuration for linux-g++ -# -# - -MAKEFILE_GENERATOR = UNIX -TEMPLATE = app -CONFIG += qt warn_on release incremental link_prl -QMAKE_INCREMENTAL_STYLE = sublib - -QMAKE_CC = gcc -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = yacc -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -QMAKE_CFLAGS_DEPS = -M -QMAKE_CFLAGS_WARN_ON = -Wall -W -QMAKE_CFLAGS_WARN_OFF = -w -QMAKE_CFLAGS_RELEASE = -O3 -QMAKE_CFLAGS_DEBUG = -g -QMAKE_CFLAGS_SHLIB = -fPIC -QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses -QMAKE_CFLAGS_THREAD = -D_REENTRANT - -QMAKE_CXX = g++ -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD - -QMAKE_INCDIR = -QMAKE_LIBDIR = -QMAKE_INCDIR_X11 = /usr/X11R6/include -QMAKE_LIBDIR_X11 = /usr/X11R6/lib -QMAKE_INCDIR_QT = $(QTDIR)/include -QMAKE_LIBDIR_QT = $(QTDIR)/lib -QMAKE_INCDIR_OPENGL = /usr/X11R6/include -QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib - -QMAKE_LINK = $$QMAKE_CXX -QMAKE_LINK_SHLIB = $$QMAKE_CXX -QMAKE_LFLAGS = -QMAKE_LFLAGS_RELEASE = -QMAKE_LFLAGS_DEBUG = -QMAKE_LFLAGS_SHLIB = -shared -QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_SONAME = -Wl,-soname, -QMAKE_LFLAGS_THREAD = -QMAKE_RPATH = -Wl,-rpath, - -QMAKE_LIBS = -QMAKE_LIBS_DYNLOAD = -ldl -QMAKE_LIBS_X11 = -lXext -lX11 -lm -QMAKE_LIBS_X11SM = -lSM -lICE -QMAKE_LIBS_NIS = -lnsl -QMAKE_LIBS_QT = -lqt -QMAKE_LIBS_QT_THREAD = -lqt-mt -QMAKE_LIBS_OPENGL = -lGLU -lGL -lXmu -QMAKE_LIBS_OPENGL_QT = -lGL -lXmu -QMAKE_LIBS_THREAD = -lpthread - -QMAKE_MOC = $(QTDIR)/bin/moc -QMAKE_UIC = $(QTDIR)/bin/uic - -QMAKE_AR = ar cqs -QMAKE_RANLIB = - -QMAKE_TAR = tar -cf -QMAKE_GZIP = gzip -9f - -# edited for MeshKernel: added -p option to copy -QMAKE_COPY = cp -pf -QMAKE_COPY_FILE = $(COPY) -QMAKE_COPY_DIR = $(COPY) -r -QMAKE_MOVE = mv -f -QMAKE_DEL_FILE = rm -f -QMAKE_DEL_DIR = rmdir -QMAKE_STRIP = strip -QMAKE_STRIPFLAGS_LIB += --strip-unneeded -QMAKE_CHK_DIR_EXISTS = test -d -QMAKE_MKDIR = mkdir -p - -# added options for MeshKernel: -DEFINES += LINUX_2_4_X86_GLIBC_2_3_2 -MK_BUILDNAME = linux_2.4-x86-glibc_2.3.2 -MK_LIBS_STLPORT = -lstlport_gcc -MK_LIBS_STLPORT_DEBUG = -lstlport_gcc_stldebug diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux_2.4-x86-glibc_2.3.2/qplatformdefs.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux_2.4-x86-glibc_2.3.2/qplatformdefs.h deleted file mode 100644 index e25bc1e221..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/linux_2.4-x86-glibc_2.3.2/qplatformdefs.h +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H - -// Get Qt defines/settings - -#include "qglobal.h" - -// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs - -// DNS system header files are a mess! -// includes . is using -// 'u_char' and includes . Now the problem is that -// defines 'u_char' only if __USE_BSD is defined. -// __USE_BSD is defined in if _BSD_SOURCE is defined. -#ifndef _BSD_SOURCE -# define _BSD_SOURCE -#endif - -// 1) need to reset default environment if _BSD_SOURCE is defined -// 2) need to specify POSIX thread interfaces explicitly in glibc 2.0 -// 3) it seems older glibc need this to include the X/Open stuff -#ifndef _GNU_SOURCE -# define _GNU_SOURCE -#endif - -#include - - -// We are hot - unistd.h should have turned on the specific APIs we requested - - -#ifdef QT_THREAD_SUPPORT -#include -#endif - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -// DNS header files are not fully covered by X/Open specifications. -// In particular nothing is said about res_* :/ -// Header files and are not included -// by on older versions of the GNU C library. Note that -// must be included before . -#include -#include -#include - - -#if !defined(QT_NO_COMPAT) -#define QT_STATBUF struct stat -#define QT_STATBUF4TSTAT struct stat -#define QT_STAT ::stat -#define QT_FSTAT ::fstat -#define QT_STAT_REG S_IFREG -#define QT_STAT_DIR S_IFDIR -#define QT_STAT_MASK S_IFMT -#define QT_STAT_LNK S_IFLNK -#define QT_FILENO fileno -#define QT_OPEN ::open -#define QT_CLOSE ::close -#define QT_LSEEK ::lseek -#define QT_READ ::read -#define QT_WRITE ::write -#define QT_ACCESS ::access -#define QT_GETCWD ::getcwd -#define QT_CHDIR ::chdir -#define QT_MKDIR ::mkdir -#define QT_RMDIR ::rmdir -#define QT_OPEN_RDONLY O_RDONLY -#define QT_OPEN_WRONLY O_WRONLY -#define QT_OPEN_RDWR O_RDWR -#define QT_OPEN_CREAT O_CREAT -#define QT_OPEN_TRUNC O_TRUNC -#define QT_OPEN_APPEND O_APPEND -#endif - -#define QT_SIGNAL_RETTYPE void -#define QT_SIGNAL_ARGS int -#define QT_SIGNAL_IGNORE SIG_IGN - -#if defined(__GLIBC__) && (__GLIBC__ >= 2) -#define QT_SOCKLEN_T socklen_t -#else -#define QT_SOCKLEN_T int -#endif - -#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500) -#define QT_SNPRINTF ::snprintf -#define QT_VSNPRINTF ::vsnprintf -#endif - - -#endif // QPLATFORMDEFS_H diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/osf1_5.1-com/.cvsignore b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/osf1_5.1-com/.cvsignore deleted file mode 100644 index aa6c7eb936..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/osf1_5.1-com/.cvsignore +++ /dev/null @@ -1,36 +0,0 @@ -*.pro -*~ -Makefile.cartesian -Makefile.cfev -Makefile.cfevtest -Makefile.collapser -Makefile.common -Makefile.compatibility -Makefile.convex_decomp -Makefile.core -Makefile.corealg -Makefile.coreio -Makefile.geometry -Makefile.interf -Makefile.license -Makefile.linalg -Makefile.meshercommon -Makefile.mkprogen -Makefile.mkprospec -Makefile.newsurface -Makefile.newvolume -Makefile.octree -Makefile.pipeline -Makefile.resurfacer -Makefile.robustgeometry -Makefile.surface -Makefile.surfacerepair -Makefile.surfacewrapper -Makefile.test -Makefile.viewcommon -Makefile.voxelmesher -make.*.list* -qmake.vars -test.general.log -test.specific.log -zzzz* diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/osf1_5.1-com/qmake b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/osf1_5.1-com/qmake deleted file mode 100755 index b9fe7ff477..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/osf1_5.1-com/qmake and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/osf1_5.1-com/qmake.conf b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/osf1_5.1-com/qmake.conf deleted file mode 100644 index 853e683384..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/osf1_5.1-com/qmake.conf +++ /dev/null @@ -1,89 +0,0 @@ -# -# $Id: qmake.conf,v 1.8 2006/03/24 13:51:52 wo Exp $ -# -# tmake configuration for tru64-cxx -# - -MAKEFILE_GENERATOR = UNIX -TEMPLATE = app -CONFIG += qt warn_on release link_prl plugin_no_soname - -QMAKE_CC = cxx -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = yacc -QMAKE_YACCFLAGS = -d -#QMAKE_CFLAGS = -model ansi -std ansi -arch ev6 -ieee -rtti -nousing_std -pthread -QMAKE_CFLAGS = -model ansi -std ansi -arch ev6 -ieee -rtti -pthread -QMAKE_CFLAGS_DEPS = -M -QMAKE_CFLAGS_WARN_ON = -QMAKE_CFLAGS_WARN_OFF = -QMAKE_CFLAGS_RELEASE = -O2 -QMAKE_CFLAGS_DEBUG = -g -QMAKE_CFLAGS_SHLIB = -QMAKE_CFLAGS_YACC = -Olimit 1000 -QMAKE_CFLAGS_THREAD = -pthread - -QMAKE_CXX = cxx -QMAKE_CXXFLAGS = -x cxx $$QMAKE_CFLAGS -pt -noimplicit_include -QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD - -QMAKE_INCDIR = -QMAKE_LIBDIR = -QMAKE_INCDIR_X11 = -QMAKE_LIBDIR_X11 = -QMAKE_INCDIR_QT = $(QTDIR)/include -QMAKE_LIBDIR_QT = $(QTDIR)/lib -QMAKE_INCDIR_OPENGL = -QMAKE_LIBDIR_OPENGL = - -QMAKE_LINK = cxx -QMAKE_LINK_SHLIB = cxx -QMAKE_LFLAGS = $$QMAKE_CFLAGS -Wl,-S -QMAKE_LFLAGS_RELEASE = -QMAKE_LFLAGS_DEBUG = -QMAKE_LFLAGS_SHLIB = -shared -QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_THREAD = -pthread -QMAKE_LFLAGS_SONAME = -soname$$LITERAL_WHITESPACE -QMAKE_RPATH = -rpath$$LITERAL_WHITESPACE - -QMAKE_LIBS = -lm -QMAKE_LIBS_DYNLOAD = -QMAKE_LIBS_X11 = -lXext -lX11 -QMAKE_LIBS_X11SM = -lSM -lICE -QMAKE_LIBS_QT = -lqt -QMAKE_LIBS_QT_THREAD = -lqt-mt -QMAKE_LIBS_OPENGL = -lGLU -lGL -lXmu -QMAKE_LIBS_OPENGL_QT = -lGL -lXmu -QMAKE_LIBS_THREAD = -lrt - -QMAKE_MOC = $(QTDIR)/bin/moc -QMAKE_UIC = $(QTDIR)/bin/uic - -QMAKE_AR = ar cqs -QMAKE_RANLIB = - -QMAKE_TAR = tar -cf -QMAKE_GZIP = gzip -9f - -QMAKE_COPY = cp -f -p -QMAKE_MOVE = mv -f -QMAKE_DEL_FILE = rm -f -QMAKE_DEL_DIR = rmdir -QMAKE_CHK_DIR_EXISTS = test -d -QMAKE_MKDIR = mkdir -p - -# added options for MeshKernel: -DEFINES += OSF1_5_1_COM -DEFINES += _PTHREADS -MK_BUILDNAME = osf1_5.1-com -MK_LIBS_STLPORT = -lstlport_dec -MK_LIBS_STLPORT_DEBUG = -lstlport_dec_stldebug diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/osf1_5.1-com/qplatformdefs.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/osf1_5.1-com/qplatformdefs.h deleted file mode 100644 index 035272231a..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/osf1_5.1-com/qplatformdefs.h +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H - -// Get Qt defines/settings - -#include "qglobal.h" - -// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs - -#include - - -// We are hot - unistd.h should have turned on the specific APIs we requested - - -#ifdef QT_THREAD_SUPPORT -#include -#endif - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// DNS header files are not fully covered by X/Open specifications. -// In particular nothing is said about res_* :/ -#include - - -#if !defined(QT_NO_COMPAT) -#define QT_STATBUF struct stat -#define QT_STATBUF4TSTAT struct stat -#define QT_STAT ::stat -#define QT_FSTAT ::fstat -#define QT_STAT_REG S_IFREG -#define QT_STAT_DIR S_IFDIR -#define QT_STAT_MASK S_IFMT -#define QT_STAT_LNK S_IFLNK -#define QT_FILENO fileno -#define QT_OPEN ::open -#define QT_CLOSE ::close -#define QT_LSEEK ::lseek -#define QT_READ ::read -#define QT_WRITE ::write -#define QT_ACCESS ::access -#define QT_GETCWD ::getcwd -#define QT_CHDIR ::chdir -#define QT_MKDIR ::mkdir -#define QT_RMDIR ::rmdir -#define QT_OPEN_RDONLY O_RDONLY -#define QT_OPEN_WRONLY O_WRONLY -#define QT_OPEN_RDWR O_RDWR -#define QT_OPEN_CREAT O_CREAT -#define QT_OPEN_TRUNC O_TRUNC -#define QT_OPEN_APPEND O_APPEND -#endif - -#define QT_SIGNAL_RETTYPE void -#define QT_SIGNAL_ARGS int -#define QT_SIGNAL_IGNORE SIG_IGN - -#if defined(_XOPEN_SOURCE) && defined(_OSF_SOURCE) -// Not available in the header file of Tru64 4.0F. -// Fixed in the header of Tru64 5.0A so we copy/paste from there... -extern "C" int usleep(useconds_t); -#endif - -#if defined(_POSIX_PII_SOCKET) -#define QT_SOCKLEN_T socklen_t -#elif defined(_XOPEN_SOURCE_EXTENDED) -#define QT_SOCKLEN_T size_t -#else -#define QT_SOCKLEN_T int -#endif - -#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE-0 >= 400) -// trying to detect Tru64 5.0 and better... -#define QT_SNPRINTF ::snprintf -#define QT_VSNPRINTF ::vsnprintf -#endif - - -#endif // QPLATFORMDEFS_H diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/runqmake b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/runqmake deleted file mode 100755 index 7a4c955528..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/runqmake +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh - -PATHTOSRC=$1 -shift - -RELEASEMODE= -if [ "$RELEASE" = "1" -o "$release" = "1" ]; then - RELEASEMODE=release -fi - -LIBMODE=dynamic -if [ "$STATIC" = "1" -o "$static" = "1" ]; then - LIBMODE=static -fi - -PROFILEMODE= -if [ "${PROFILE}" ]; then - PROFILEMODE=${PROFILE} -fi - -SRCDIR=`pwd` - -PATHTOCONFIG=$SRCDIR/$PATHTOSRC/config - -cd $PATHTOCONFIG - -GNU_MACHINE_TYPE=`./config.system` -STAR_MACHINE_TYPE=`./config.gnu.to.star $GNU_MACHINE_TYPE $MACH_MOD` - -cd $SRCDIR - -if [ -r ADF_interface.c ]; then - ./make.version.sc < ADF_interface.c > version.pro -elif [ -r ccmioversion.h ]; then - ./make.version.sc < ccmioversion.h > version.pro -elif [ -r cgnslib.h ]; then - ./make.version.sc < cgnslib.h > version.pro -fi - -QTDIR=$PATHTOCONFIG/$STAR_MACHINE_TYPE -QMAKESPEC=$QTDIR - -#echo $RELEASEMODE - -UNIX=; -if [ x${STAR_MACHINE_TYPE} = xwindows-x86-gcc ]; then UNIX=-unix; fi -$QTDIR/qmake ${UNIX} -spec $QMAKESPEC \ - "RELEASEMODE=$RELEASEMODE" \ - "LIBMODE=$LIBMODE" \ - "PROFILEMODE=$PROFILEMODE" \ - "CC=$CC" \ - "CXX=$CXX" \ - $* diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/sunos64_5.8-ultra/.cvsignore b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/sunos64_5.8-ultra/.cvsignore deleted file mode 100644 index aa6c7eb936..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/sunos64_5.8-ultra/.cvsignore +++ /dev/null @@ -1,36 +0,0 @@ -*.pro -*~ -Makefile.cartesian -Makefile.cfev -Makefile.cfevtest -Makefile.collapser -Makefile.common -Makefile.compatibility -Makefile.convex_decomp -Makefile.core -Makefile.corealg -Makefile.coreio -Makefile.geometry -Makefile.interf -Makefile.license -Makefile.linalg -Makefile.meshercommon -Makefile.mkprogen -Makefile.mkprospec -Makefile.newsurface -Makefile.newvolume -Makefile.octree -Makefile.pipeline -Makefile.resurfacer -Makefile.robustgeometry -Makefile.surface -Makefile.surfacerepair -Makefile.surfacewrapper -Makefile.test -Makefile.viewcommon -Makefile.voxelmesher -make.*.list* -qmake.vars -test.general.log -test.specific.log -zzzz* diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/sunos64_5.8-ultra/qmake b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/sunos64_5.8-ultra/qmake deleted file mode 100755 index eeeac13a39..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/sunos64_5.8-ultra/qmake and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/sunos64_5.8-ultra/qmake.conf b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/sunos64_5.8-ultra/qmake.conf deleted file mode 100644 index c7b36ea641..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/sunos64_5.8-ultra/qmake.conf +++ /dev/null @@ -1,110 +0,0 @@ -# -# $Id: qmake.conf,v 1.8 2006/03/06 19:49:56 wo Exp $ -# -# qmake configuration for solaris-cc-64 -# -# Written for Sun WorkShop 5.0, Forte Developer 6, and Sun ONE Studio 7. -# -# From the standards(5) manual page: -# The XNS4 specification is safe for use only in ILP32 (32-bit) -# environments and should not be used for LP64 (64-bit) -# application environments. Use XNS5, which has LP64-clean -# interfaces that are portable across ILP32 and LP64 environments. -# [...] -# For platforms supporting the LP64 (64-bit) programming environment -# where the SC5.0 Compilers have been installed, SUSv2-conforming LP64 -# applications using XNS5 library calls should be built with command -# lines of the form: -# c89 $(getconf XBS5_LP64_OFF64_CFLAGS) -D_XOPEN_SOURCE=500 \ -# $(getconf XBS5_LP64_OFF64_LDFLAGS) foo.c -o foo \ -# $(getconf XBS5_LP64_OFF64_LIBS) -lxnet -# So it appears that _XOPEN_SOURCE=500 should be defined when building -# 64-bit applications (on Solaris 7 and better). But then __EXTENSIONS__ -# should be defined as well to recover all the default system interface. -# - -MAKEFILE_GENERATOR = UNIX -TEMPLATE = app -CONFIG += qt warn_on release link_prl - -QMAKE_CC = cc -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = yacc -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -xarch=v9 -D_XOPEN_SOURCE=500 -D__EXTENSIONS__ -QMAKE_CFLAGS_DEPS = -xM -QMAKE_CFLAGS_WARN_ON = -QMAKE_CFLAGS_WARN_OFF = -w -QMAKE_CFLAGS_RELEASE = -O -QMAKE_CFLAGS_DEBUG = -g -QMAKE_CFLAGS_SHLIB = -KPIC -QMAKE_CFLAGS_YACC = -QMAKE_CFLAGS_THREAD = -mt - -QMAKE_CXX = CC -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -#QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -instances=semiexplicit -template=no%wholeclass,no%extdef,no%geninlinefuncs -QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = -O2 -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD - -QMAKE_INCDIR = -QMAKE_LIBDIR = -QMAKE_INCDIR_X11 = /usr/openwin/include -QMAKE_LIBDIR_X11 = /usr/openwin/lib -QMAKE_INCDIR_QT = $(QTDIR)/include -QMAKE_LIBDIR_QT = $(QTDIR)/lib -QMAKE_INCDIR_OPENGL = /usr/openwin/include -QMAKE_LIBDIR_OPENGL = /usr/openwin/lib - -QMAKE_LINK = CC -QMAKE_LINK_SHLIB = CC -QMAKE_LFLAGS = -xarch=v9 -QMAKE_LFLAGS_RELEASE = -QMAKE_LFLAGS_DEBUG = -QMAKE_LFLAGS_SHLIB = -G -QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_SONAME = -h$$LITERAL_WHITESPACE -QMAKE_LFLAGS_THREAD = -mt -QMAKE_RPATH = -R - -QMAKE_LIBS = -lsocket -lnsl -QMAKE_LIBS_DYNLOAD = -ldl -QMAKE_LIBS_X11 = -lXext -lX11 -lresolv -lsocket -lnsl -QMAKE_LIBS_X11SM = -lSM -lICE -QMAKE_LIBS_NIS = -QMAKE_LIBS_QT = -lqt -QMAKE_LIBS_QT_THREAD = -lqt-mt -QMAKE_LIBS_OPENGL = -lGLU -lGL -lXmu -QMAKE_LIBS_OPENGL_QT = -lGL -lXmu -QMAKE_LIBS_THREAD = -lpthread -lrt - -QMAKE_MOC = $(QTDIR)/bin/moc -QMAKE_UIC = $(QTDIR)/bin/uic - -QMAKE_AR = CC -xar -o -QMAKE_RANLIB = - -QMAKE_CLEAN = -r $(OBJECTS_DIR)Templates.DB $(OBJECTS_DIR)SunWS_cache - -QMAKE_TAR = tar -cf -QMAKE_GZIP = gzip -9f - -QMAKE_COPY = cp -f -p -QMAKE_MOVE = mv -f -QMAKE_DEL_FILE = rm -f -QMAKE_DEL_DIR = rmdir -QMAKE_CHK_DIR_EXISTS = test -d -QMAKE_MKDIR = mkdir -p - -# added options for MeshKernel: -DEFINES += SUNOS64_5_8_ULTRA -MK_BUILDNAME = sunos64_5.8-ultra -MK_LIBS_STLPORT = -lstlport_sunpro64 -MK_LIBS_STLPORT_DEBUG = -lstlport_sunpro64_stldebug diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/sunos64_5.8-ultra/qplatformdefs.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/sunos64_5.8-ultra/qplatformdefs.h deleted file mode 100644 index 30bc56dbd8..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/sunos64_5.8-ultra/qplatformdefs.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H - -// Get Qt defines/settings - -#include "qglobal.h" - -// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs - -#include - - -// We are hot - unistd.h should have turned on the specific APIs we requested - - -#ifdef QT_THREAD_SUPPORT -#include -#endif - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// DNS header files are not fully covered by X/Open specifications. -// In particular nothing is said about res_* :/ -// On Solaris header files and are not -// included by . Note that must be included -// before . -#include -#include -#include - - -#if !defined(QT_NO_COMPAT) -#define QT_STATBUF struct stat -#define QT_STATBUF4TSTAT struct stat -#define QT_STAT ::stat -#define QT_FSTAT ::fstat -#define QT_STAT_REG S_IFREG -#define QT_STAT_DIR S_IFDIR -#define QT_STAT_MASK S_IFMT -#define QT_STAT_LNK S_IFLNK -#define QT_FILENO fileno -#define QT_OPEN ::open -#define QT_CLOSE ::close -#define QT_LSEEK ::lseek -#define QT_READ ::read -#define QT_WRITE ::write -#define QT_ACCESS ::access -#define QT_GETCWD ::getcwd -#define QT_CHDIR ::chdir -#define QT_MKDIR ::mkdir -#define QT_RMDIR ::rmdir -#define QT_OPEN_RDONLY O_RDONLY -#define QT_OPEN_WRONLY O_WRONLY -#define QT_OPEN_RDWR O_RDWR -#define QT_OPEN_CREAT O_CREAT -#define QT_OPEN_TRUNC O_TRUNC -#define QT_OPEN_APPEND O_APPEND -#endif - -#define QT_SIGNAL_RETTYPE void -#define QT_SIGNAL_ARGS int -#define QT_SIGNAL_IGNORE SIG_IGN - -// On 64-bit platforms (Solaris 7 and better) sockets use socklen_t. -#define QT_SOCKLEN_T socklen_t - -// Supported on 64-bit platforms (Solaris 7 and better). -#define QT_SNPRINTF ::snprintf -#define QT_VSNPRINTF ::vsnprintf - - -#endif // QPLATFORMDEFS_H diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-vc.net/qmake.conf b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-vc.net/qmake.conf deleted file mode 100644 index 6776b7dac2..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-vc.net/qmake.conf +++ /dev/null @@ -1,107 +0,0 @@ -# -# $Id: qmake.conf,v 1.1 2004/12/15 00:16:29 prewett Exp $ -# -# qmake configuration for win32-msvc.net -# -# Written for Microsoft C++.NET. -# - -MAKEFILE_GENERATOR = MSVC.NET -TEMPLATE = app -CONFIG += qt warn_on release incremental flat link_prl precompile_header -DEFINES += UNICODE WIN32 - -exists( $(QTDIR)\.qtwinconfig ) { - include( $(QTDIR)\.qtwinconfig ) -} - -QMAKE_CC = cl -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = byacc -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -nologo -Zm200 -QMAKE_CFLAGS_WARN_ON = -W3 -QMAKE_CFLAGS_WARN_OFF = -W0 -QMAKE_CFLAGS_RELEASE = -O2 -QMAKE_CFLAGS_DEBUG = -Zi -Gm -QMAKE_CFLAGS_MT = -MD -QMAKE_CFLAGS_MT_DBG = -MDd -QMAKE_CFLAGS_MT_DLL = -MD -QMAKE_CFLAGS_MT_DLLDBG = -MDd -QMAKE_CFLAGS_YACC = -QMAKE_CFLAGS_STL_ON = -GX -QMAKE_CFLAGS_STL_OFF = -QMAKE_CFLAGS_RTTI_ON = -GR -QMAKE_CFLAGS_RTTI_OFF = -QMAKE_CFLAGS_EXCEPTIONS_ON = -GX -QMAKE_CFLAGS_EXCEPTIONS_OFF = - -QMAKE_CXX = $$QMAKE_CC -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -w34100 -w34189 -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_MT = $$QMAKE_CFLAGS_MT -QMAKE_CXXFLAGS_MT_DBG = $$QMAKE_CFLAGS_MT_DBG -QMAKE_CXXFLAGS_MT_DLL = $$QMAKE_CFLAGS_MT_DLL -QMAKE_CXXFLAGS_MT_DLLDBG= $$QMAKE_CFLAGS_MT_DLLDBG -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_STL_ON = $$QMAKE_CFLAGS_STL_ON -QMAKE_CXXFLAGS_STL_OFF = $$QMAKE_CFLAGS_STL_OFF -QMAKE_CXXFLAGS_RTTI_ON = $$QMAKE_CFLAGS_RTTI_ON -QMAKE_CXXFLAGS_RTTI_OFF = $$QMAKE_CFLAGS_RTTI_OFF -QMAKE_CXXFLAGS_EXCEPTIONS_ON = $$QMAKE_CFLAGS_EXCEPTIONS_ON -QMAKE_CXXFLAGS_EXCEPTIONS_OFF = $$QMAKE_CFLAGS_EXCEPTIONS_OFF - -QMAKE_INCDIR = -QMAKE_INCDIR_QT = $(QTDIR)\include -QMAKE_LIBDIR_QT = $(QTDIR)\lib - -QMAKE_RUN_CC = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$obj $src -QMAKE_RUN_CC_IMP = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ $< -QMAKE_RUN_CC_IMP_BATCH = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ @<< -QMAKE_RUN_CXX = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$obj $src -QMAKE_RUN_CXX_IMP = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ $< -QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ @<< - -QMAKE_LINK = link -QMAKE_LFLAGS = /NOLOGO -QMAKE_LFLAGS_RELEASE = /DELAYLOAD:comdlg32.dll /DELAYLOAD:oleaut32.dll /DELAYLOAD:winmm.dll /DELAYLOAD:wsock32.dll /DELAYLOAD:winspool.dll -QMAKE_LFLAGS_DEBUG = /DEBUG -QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE -QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS -QMAKE_LFLAGS_CONSOLE_DLL= /SUBSYSTEM:CONSOLE /DLL -QMAKE_LFLAGS_WINDOWS_DLL= /SUBSYSTEM:WINDOWS /DLL -QMAKE_LFLAGS_QT_DLL = /BASE:0x39D00000 - -QMAKE_LIBS = -QMAKE_LIBS_CONSOLE = -QMAKE_LIBS_WINDOWS = kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib imm32.lib winmm.lib wsock32.lib winspool.lib delayimp.lib -QMAKE_LIBS_QT = qt.lib -QMAKE_LIBS_QT_THREAD = qt-mt.lib -QMAKE_LIBS_QT_ENTRY = qtmain.lib - -QMAKE_LIBS_OPENGL = opengl32.lib glu32.lib -QMAKE_LFLAGS_OPENGL = /DELAYLOAD:opengl32.dll - -QMAKE_MOC = $(QTDIR)\bin\moc.exe -QMAKE_UIC = $(QTDIR)\bin\uic.exe -QMAKE_IDC = $(QTDIR)\bin\idc.exe - -QMAKE_IDL = midl -QMAKE_LIB = lib /NOLOGO -QMAKE_RC = rc - -QMAKE_ZIP = zip -r -9 - -QMAKE_COPY = copy -QMAKE_MOVE = move -QMAKE_DEL_FILE = del -QMAKE_DEL_DIR = rmdir -QMAKE_CHK_DIR_EXISTS = if not exist -QMAKE_MKDIR = mkdir - -VCPROJ_EXTENSION = .vcproj -VCSOLUTION_EXTENSION = .sln diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-vc.net/qmake.exe b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-vc.net/qmake.exe deleted file mode 100755 index 28b9016bd9..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-vc.net/qmake.exe and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-vc.net/qplatformdefs.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-vc.net/qplatformdefs.h deleted file mode 100644 index d828db88e9..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-vc.net/qplatformdefs.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H - -#ifdef UNICODE -#ifndef _UNICODE -#define _UNICODE -#endif -#endif - -// Get Qt defines/settings - -#include "qglobal.h" - -#define _POSIX_ -#include -#undef _POSIX_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define Q_FS_FAT -#ifdef QT_LARGEFILE_SUPPORT -#define QT_STATBUF struct _stati64 // non-ANSI defs -#define QT_STATBUF4TSTAT struct _stati64 // non-ANSI defs -#define QT_STAT ::_stati64 -#define QT_FSTAT ::_fstati64 -#else -#define QT_STATBUF struct _stat // non-ANSI defs -#define QT_STATBUF4TSTAT struct _stat // non-ANSI defs -#define QT_STAT ::_stat -#define QT_FSTAT ::_fstat -#endif -#define QT_STAT_REG _S_IFREG -#define QT_STAT_DIR _S_IFDIR -#define QT_STAT_MASK _S_IFMT -#if defined(_S_IFLNK) -# define QT_STAT_LNK _S_IFLNK -#endif -#define QT_FILENO _fileno -#define QT_OPEN ::_open -#define QT_CLOSE ::_close -#ifdef QT_LARGEFILE_SUPPORT -#define QT_LSEEK ::_lseeki64 -#define QT_TSTAT ::_tstati64 -#else -#define QT_LSEEK ::_lseek -#define QT_TSTAT ::_tstat -#endif -#define QT_READ ::_read -#define QT_WRITE ::_write -#define QT_ACCESS ::_access -#define QT_GETCWD ::_getcwd -#define QT_CHDIR ::_chdir -#define QT_MKDIR ::_mkdir -#define QT_RMDIR ::_rmdir -#define QT_OPEN_RDONLY _O_RDONLY -#define QT_OPEN_WRONLY _O_WRONLY -#define QT_OPEN_RDWR _O_RDWR -#define QT_OPEN_CREAT _O_CREAT -#define QT_OPEN_TRUNC _O_TRUNC -#define QT_OPEN_APPEND _O_APPEND -#if defined(O_TEXT) -# define QT_OPEN_TEXT _O_TEXT -# define QT_OPEN_BINARY _O_BINARY -#endif - -#define QT_SIGNAL_ARGS int - -#define QT_VSNPRINTF ::_vsnprintf -#define QT_SNPRINTF ::_snprintf - -# define F_OK 0 -# define X_OK 1 -# define W_OK 2 -# define R_OK 4 - -typedef int mode_t; - - -#endif // QPLATFORMDEFS_H diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/.cvsignore b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/.cvsignore deleted file mode 100644 index aa6c7eb936..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/.cvsignore +++ /dev/null @@ -1,36 +0,0 @@ -*.pro -*~ -Makefile.cartesian -Makefile.cfev -Makefile.cfevtest -Makefile.collapser -Makefile.common -Makefile.compatibility -Makefile.convex_decomp -Makefile.core -Makefile.corealg -Makefile.coreio -Makefile.geometry -Makefile.interf -Makefile.license -Makefile.linalg -Makefile.meshercommon -Makefile.mkprogen -Makefile.mkprospec -Makefile.newsurface -Makefile.newvolume -Makefile.octree -Makefile.pipeline -Makefile.resurfacer -Makefile.robustgeometry -Makefile.surface -Makefile.surfacerepair -Makefile.surfacewrapper -Makefile.test -Makefile.viewcommon -Makefile.voxelmesher -make.*.list* -qmake.vars -test.general.log -test.specific.log -zzzz* diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/.cvsignore b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/.cvsignore deleted file mode 100644 index aa6c7eb936..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/.cvsignore +++ /dev/null @@ -1,36 +0,0 @@ -*.pro -*~ -Makefile.cartesian -Makefile.cfev -Makefile.cfevtest -Makefile.collapser -Makefile.common -Makefile.compatibility -Makefile.convex_decomp -Makefile.core -Makefile.corealg -Makefile.coreio -Makefile.geometry -Makefile.interf -Makefile.license -Makefile.linalg -Makefile.meshercommon -Makefile.mkprogen -Makefile.mkprospec -Makefile.newsurface -Makefile.newvolume -Makefile.octree -Makefile.pipeline -Makefile.resurfacer -Makefile.robustgeometry -Makefile.surface -Makefile.surfacerepair -Makefile.surfacewrapper -Makefile.test -Makefile.viewcommon -Makefile.voxelmesher -make.*.list* -qmake.vars -test.general.log -test.specific.log -zzzz* diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/galloca.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/galloca.h deleted file mode 100644 index b4194d4ac6..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/galloca.h +++ /dev/null @@ -1,60 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_ALLOCA_H__ -#define __G_ALLOCA_H__ - -#include - -#ifdef __GNUC__ -/* GCC does the right thing */ -# undef alloca -# define alloca(size) __builtin_alloca (size) -#elif defined (GLIB_HAVE_ALLOCA_H) -/* a native and working alloca.h is there */ -# include -#else /* !__GNUC__ && !GLIB_HAVE_ALLOCA_H */ -# ifdef _MSC_VER -# include -# define alloca _alloca -# else /* !_MSC_VER */ -# ifdef _AIX - #pragma alloca -# else /* !_AIX */ -# ifndef alloca /* predefined by HP cc +Olibcalls */ -G_BEGIN_DECLS -char *alloca (); -G_END_DECLS -# endif /* !alloca */ -# endif /* !_AIX */ -# endif /* !_MSC_VER */ -#endif /* !__GNUC__ && !GLIB_HAVE_ALLOCA_H */ - -#define g_alloca(size) alloca (size) - - -#endif /* __G_ALLOCA_H__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/garray.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/garray.h deleted file mode 100644 index f4398b2adc..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/garray.h +++ /dev/null @@ -1,156 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_ARRAY_H__ -#define __G_ARRAY_H__ - -#include - -G_BEGIN_DECLS - -typedef struct _GArray GArray; -typedef struct _GByteArray GByteArray; -typedef struct _GPtrArray GPtrArray; - -struct _GArray -{ - gchar *data; - guint len; -}; - -struct _GByteArray -{ - guint8 *data; - guint len; -}; - -struct _GPtrArray -{ - gpointer *pdata; - guint len; -}; - -/* Resizable arrays, remove fills any cleared spot and shortens the - * array, while preserving the order. remove_fast will distort the - * order by moving the last element to the position of the removed - */ - -#define g_array_append_val(a,v) g_array_append_vals (a, &v, 1) -#define g_array_prepend_val(a,v) g_array_prepend_vals (a, &v, 1) -#define g_array_insert_val(a,i,v) g_array_insert_vals (a, i, &v, 1) -#define g_array_index(a,t,i) (((t*) (a)->data) [(i)]) - -GArray* g_array_new (gboolean zero_terminated, - gboolean clear, - guint element_size); -GArray* g_array_sized_new (gboolean zero_terminated, - gboolean clear, - guint element_size, - guint reserved_size); -gchar* g_array_free (GArray *array, - gboolean free_segment); -GArray* g_array_append_vals (GArray *array, - gconstpointer data, - guint len); -GArray* g_array_prepend_vals (GArray *array, - gconstpointer data, - guint len); -GArray* g_array_insert_vals (GArray *array, - guint index, - gconstpointer data, - guint len); -GArray* g_array_set_size (GArray *array, - guint length); -GArray* g_array_remove_index (GArray *array, - guint index); -GArray* g_array_remove_index_fast (GArray *array, - guint index); -void g_array_sort (GArray *array, - GCompareFunc compare_func); -void g_array_sort_with_data (GArray *array, - GCompareFuncData compare_func, - gpointer user_data); - -/* Resizable pointer array. This interface is much less complicated - * than the above. Add appends appends a pointer. Remove fills any - * cleared spot and shortens the array. remove_fast will again distort - * order. - */ -#define g_ptr_array_index(array,index) (array->pdata)[index] -GPtrArray* g_ptr_array_new (void); -GPtrArray* g_ptr_array_sized_new (guint reserved_size); -gpointer* g_ptr_array_free (GPtrArray *array, - gboolean free_seg); -void g_ptr_array_set_size (GPtrArray *array, - gint length); -gpointer g_ptr_array_remove_index (GPtrArray *array, - guint index); -gpointer g_ptr_array_remove_index_fast (GPtrArray *array, - guint index); -gboolean g_ptr_array_remove (GPtrArray *array, - gpointer data); -gboolean g_ptr_array_remove_fast (GPtrArray *array, - gpointer data); -void g_ptr_array_add (GPtrArray *array, - gpointer data); -void g_ptr_array_sort (GPtrArray *array, - GCompareFunc compare_func); -void g_ptr_array_sort_with_data (GPtrArray *array, - GCompareFuncData compare_func, - gpointer user_data); - - -/* Byte arrays, an array of guint8. Implemented as a GArray, - * but type-safe. - */ - -GByteArray* g_byte_array_new (void); -GByteArray* g_byte_array_sized_new (guint reserved_size); -guint8* g_byte_array_free (GByteArray *array, - gboolean free_segment); -GByteArray* g_byte_array_append (GByteArray *array, - guint8 const *data, - guint len); -GByteArray* g_byte_array_prepend (GByteArray *array, - guint8 const *data, - guint len); -GByteArray* g_byte_array_set_size (GByteArray *array, - guint length); -GByteArray* g_byte_array_remove_index (GByteArray *array, - guint index); -GByteArray* g_byte_array_remove_index_fast (GByteArray *array, - guint index); -void g_byte_array_sort (GByteArray *array, - GCompareFunc compare_func); -void g_byte_array_sort_with_data (GByteArray *array, - GCompareFuncData compare_func, - gpointer user_data); - - -G_END_DECLS - -#endif /* __G_ARRAY_H__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gasyncqueue.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gasyncqueue.h deleted file mode 100644 index 6e87425f7a..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gasyncqueue.h +++ /dev/null @@ -1,95 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_ASYNCQUEUE_H__ -#define __G_ASYNCQUEUE_H__ - -#include - -G_BEGIN_DECLS - -typedef struct _GAsyncQueue GAsyncQueue; - -/* Asyncronous Queues, can be used to communicate between threads - */ - -/* Get a new GAsyncQueue with the ref_count 1 */ -GAsyncQueue* g_async_queue_new (void); - -/* Lock and unlock an GAsyncQueue, all functions lock the queue for - * themselves, but in certain cirumstances you want to hold the lock longer, - * thus you lock the queue, call the *_unlocked functions and unlock it again - */ -void g_async_queue_lock (GAsyncQueue *queue); -void g_async_queue_unlock (GAsyncQueue *queue); - -/* Ref and unref the GAsyncQueue. g_async_queue_unref_unlocked makes - * no sense, as after the unreffing the Queue might be gone and can't - * be unlocked. So you have a function to call, if you don't hold the - * lock (g_async_queue_unref) and one to call, when you already hold - * the lock (g_async_queue_unref_and_unlock). After that however, you - * don't hold the lock anymore and the Queue might in fact be - * destroyed, if you unrefed to zero */ -void g_async_queue_ref (GAsyncQueue *queue); -void g_async_queue_ref_unlocked (GAsyncQueue *queue); -void g_async_queue_unref (GAsyncQueue *queue); -void g_async_queue_unref_and_unlock (GAsyncQueue *queue); - -/* Push data into the async queue. Must not be NULL */ -void g_async_queue_push (GAsyncQueue *queue, - gpointer data); -void g_async_queue_push_unlocked (GAsyncQueue *queue, - gpointer data); - -/* Pop data from the async queue, when no data is there, the thread is blocked - * until data arrives */ -gpointer g_async_queue_pop (GAsyncQueue *queue); -gpointer g_async_queue_pop_unlocked (GAsyncQueue *queue); - -/* Try to pop data, NULL is returned in case of empty queue */ -gpointer g_async_queue_try_pop (GAsyncQueue *queue); -gpointer g_async_queue_try_pop_unlocked (GAsyncQueue *queue); - -/* Wait for data until at maximum until end_time is reached, NULL is returned - * in case of empty queue*/ -gpointer g_async_queue_timed_pop (GAsyncQueue *queue, - GTimeVal *end_time); -gpointer g_async_queue_timed_pop_unlocked (GAsyncQueue *queue, - GTimeVal *end_time); - -/* Return the length of the queue, negative values mean, that threads - * are waiting, positve values mean, that there are entries in the - * queue. Actually this function returns the length of the queue minus - * the number of waiting threads, g_async_queue_length == 0 could also - * mean 'n' entries in the queue and 'n' thread waiting, such can - * happen due to locking of the queue or due to scheduling. */ -gint g_async_queue_length (GAsyncQueue *queue); -gint g_async_queue_length_unlocked (GAsyncQueue *queue); - -G_END_DECLS - -#endif /* __G_ASYNCQUEUE_H__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gbacktrace.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gbacktrace.h deleted file mode 100644 index 3dfd291bcd..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gbacktrace.h +++ /dev/null @@ -1,61 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_BACKTRACE_H__ -#define __G_BACKTRACE_H__ - -#include - -G_BEGIN_DECLS - -/* Fatal error handlers. - * g_on_error_query() will prompt the user to either - * [E]xit, [H]alt, [P]roceed or show [S]tack trace. - * g_on_error_stack_trace() invokes gdb, which attaches to the current - * process and shows a stack trace. - * These function may cause different actions on non-unix platforms. - * The prg_name arg is required by gdb to find the executable, if it is - * passed as NULL, g_on_error_query() will try g_get_prgname(). - */ -void g_on_error_query (gchar const *prg_name); -void g_on_error_stack_trace (gchar const *prg_name); - -/* Hacker macro to place breakpoints for elected machines. - * Actual use is strongly deprecated of course ;) - */ -#if defined (__i386__) && defined (__GNUC__) && __GNUC__ >= 2 -# define G_BREAKPOINT() G_STMT_START{ __asm__ __volatile__ ("int $03"); }G_STMT_END -#elif defined (_MSC_VER) && defined (_M_IX86) -# define G_BREAKPOINT() G_STMT_START{ __asm int 3h }G_STMT_END -#elif defined (__alpha__) && defined (__GNUC__) && __GNUC__ >= 2 -# define G_BREAKPOINT() G_STMT_START{ __asm__ __volatile__ ("bpt"); }G_STMT_END -#else /* !__i386__ && !__alpha__ */ -# define G_BREAKPOINT() G_STMT_START{ raise (5 /* SIGTRAP */); }G_STMT_END -#endif /* __i386__ */ - -G_END_DECLS - -#endif /* __G_BACKTRACE_H__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gcache.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gcache.h deleted file mode 100644 index 74ef5b654b..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gcache.h +++ /dev/null @@ -1,66 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_CACHE_H__ -#define __G_CACHE_H__ - -#include - -G_BEGIN_DECLS - -typedef struct _GCache GCache; - -typedef gpointer (*GCacheNewFunc) (gpointer key); -typedef gpointer (*GCacheDupFunc) (gpointer value); -typedef void (*GCacheDestroyFunc) (gpointer value); - -/* Caches - */ -GCache* g_cache_new (GCacheNewFunc value_new_func, - GCacheDestroyFunc value_destroy_func, - GCacheDupFunc key_dup_func, - GCacheDestroyFunc key_destroy_func, - GHashFunc hash_key_func, - GHashFunc hash_value_func, - GEqualFunc key_equal_func); -void g_cache_destroy (GCache *cache); -gpointer g_cache_insert (GCache *cache, - gpointer key); -void g_cache_remove (GCache *cache, - gconstpointer value); -void g_cache_key_foreach (GCache *cache, - GHFunc func, - gpointer user_data); -void g_cache_value_foreach (GCache *cache, - GHFunc func, - gpointer user_data); - -G_END_DECLS - -#endif /* __G_CACHE_H__ */ - - - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gcompat.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gcompat.h deleted file mode 100644 index 10ef4457e1..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gcompat.h +++ /dev/null @@ -1,45 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * - * Copyright (C) 2000 Ali Abdin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __G_COMPAT_H__ -#define __G_COMPAT_H__ - -#include - -G_BEGIN_DECLS - -#ifndef G_DISABLE_COMPAT_H - -#define g_date_weekday g_date_get_weekday -#define g_date_month g_date_get_month -#define g_date_year g_date_get_year -#define g_date_day g_date_get_day -#define g_date_julian g_date_get_julian -#define g_date_day_of_year g_date_get_day_of_year -#define g_date_monday_week_of_year g_date_get_monday_week_of_year -#define g_date_sunday_week_of_year g_date_get_sunday_week_of_year -#define g_date_days_in_month g_date_get_days_in_month -#define g_date_monday_weeks_in_year g_date_get_monday_weeks_in_year -#define g_date_sunday_weeks_in_year g_date_get_sunday_weeks_in_year - -#endif /* G_DISABLE_COMPAT_H */ - -G_END_DECLS - -#endif /* __G_COMPAT_H__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gcompletion.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gcompletion.h deleted file mode 100644 index 4c1ee25e60..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gcompletion.h +++ /dev/null @@ -1,73 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_COMPLETION_H__ -#define __G_COMPLETION_H__ - -#include -#include /* For size_t */ -#ifdef G_OS_UNIX -#include -#endif - -G_BEGIN_DECLS - -typedef struct _GCompletion GCompletion; - -typedef gchar* (*GCompletionFunc) (gpointer); - -/* GCompletion - */ - -typedef int (*GCompletionStrncmpFunc)(char const *s1, char const *s2, size_t n); - -struct _GCompletion -{ - GList* items; - GCompletionFunc func; - - gchar* prefix; - GList* cache; - GCompletionStrncmpFunc strncmp_func; -}; - -GCompletion* g_completion_new (GCompletionFunc func); -void g_completion_add_items (GCompletion* cmp, - GList* items); -void g_completion_remove_items (GCompletion* cmp, - GList* items); -void g_completion_clear_items (GCompletion* cmp); -GList* g_completion_complete (GCompletion* cmp, - gchar* prefix, - gchar** new_prefix); -void g_completion_set_compare (GCompletion *cmp, - GCompletionStrncmpFunc strncmp_func); -void g_completion_free (GCompletion* cmp); - -G_END_DECLS - -#endif /* __G_COMPLETION_H__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gconvert.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gconvert.h deleted file mode 100644 index ec2e530c5f..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gconvert.h +++ /dev/null @@ -1,90 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_CONVERT_H__ -#define __G_CONVERT_H__ - -#include /* For size_t */ -#include - -G_BEGIN_DECLS - -typedef enum -{ - G_CONVERT_ERROR_NO_CONVERSION, - G_CONVERT_ERROR_ILLEGAL_SEQUENCE, - G_CONVERT_ERROR_FAILED, - G_CONVERT_ERROR_PARTIAL_INPUT -} GConvertError; - -#define G_CONVERT_ERROR g_convert_error_quark() -GQuark g_convert_error_quark(); - -/* Thin wrappers around iconv - */ -typedef struct _GIConv *GIConv; - -GIConv g_iconv_open (gchar const *to_codeset, - gchar const *from_codeset); -size_t g_iconv (GIConv converter, - gchar **inbuf, - size_t *inbytes_left, - gchar **outbuf, - size_t *outbytes_left); -gint g_iconv_close (GIConv converter); - - -gchar* g_convert (gchar const *str, - gint len, - gchar const *to_codeset, - gchar const *from_codeset, - gint *bytes_read, - gint *bytes_written, - GError **error); -gchar* g_convert_with_fallback (gchar const *str, - gint len, - gchar const *to_codeset, - gchar const *from_codeset, - gchar *fallback, - gint *bytes_read, - gint *bytes_written, - GError **error); - - -/* Convert between libc's idea of strings and UTF-8. - */ -gchar* g_locale_to_utf8 (gchar const *opsysstring, GError **error); -gchar* g_locale_from_utf8 (gchar const *utf8string, GError **error); - -/* Convert between the operating system (or C runtime) - * representation of file names and UTF-8. - */ -gchar* g_filename_to_utf8 (gchar const *opsysstring, GError **error); -gchar* g_filename_from_utf8 (gchar const *utf8string, GError **error); - -G_END_DECLS - -#endif /* __G_CONVERT_H__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gdataset.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gdataset.h deleted file mode 100644 index f9d15b3088..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gdataset.h +++ /dev/null @@ -1,106 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_DATASET_H__ -#define __G_DATASET_H__ - -#include - -G_BEGIN_DECLS - -typedef struct _GData GData; - -typedef void (*GDataForeachFunc) (GQuark key_id, - gpointer data, - gpointer user_data); - -/* Keyed Data List - */ -void g_datalist_init (GData **datalist); -void g_datalist_clear (GData **datalist); -gpointer g_datalist_id_get_data (GData **datalist, - GQuark key_id); -void g_datalist_id_set_data_full (GData **datalist, - GQuark key_id, - gpointer data, - GDestroyNotify destroy_func); -gpointer g_datalist_id_remove_no_notify (GData **datalist, - GQuark key_id); -void g_datalist_foreach (GData **datalist, - GDataForeachFunc func, - gpointer user_data); -#define g_datalist_id_set_data(dl, q, d) \ - g_datalist_id_set_data_full ((dl), (q), (d), NULL) -#define g_datalist_id_remove_data(dl, q) \ - g_datalist_id_set_data ((dl), (q), NULL) -#define g_datalist_get_data(dl, k) \ - (g_datalist_id_get_data ((dl), g_quark_try_string (k))) -#define g_datalist_set_data_full(dl, k, d, f) \ - g_datalist_id_set_data_full ((dl), g_quark_from_string (k), (d), (f)) -#define g_datalist_remove_no_notify(dl, k) \ - g_datalist_id_remove_no_notify ((dl), g_quark_try_string (k)) -#define g_datalist_set_data(dl, k, d) \ - g_datalist_set_data_full ((dl), (k), (d), NULL) -#define g_datalist_remove_data(dl, k) \ - g_datalist_id_set_data ((dl), g_quark_try_string (k), NULL) - - -/* Location Associated Keyed Data - */ -void g_dataset_destroy (gconstpointer dataset_location); -gpointer g_dataset_id_get_data (gconstpointer dataset_location, - GQuark key_id); -void g_dataset_id_set_data_full (gconstpointer dataset_location, - GQuark key_id, - gpointer data, - GDestroyNotify destroy_func); -gpointer g_dataset_id_remove_no_notify (gconstpointer dataset_location, - GQuark key_id); -void g_dataset_foreach (gconstpointer dataset_location, - GDataForeachFunc func, - gpointer user_data); -#define g_dataset_id_set_data(l, k, d) \ - g_dataset_id_set_data_full ((l), (k), (d), NULL) -#define g_dataset_id_remove_data(l, k) \ - g_dataset_id_set_data ((l), (k), NULL) -#define g_dataset_get_data(l, k) \ - (g_dataset_id_get_data ((l), g_quark_try_string (k))) -#define g_dataset_set_data_full(l, k, d, f) \ - g_dataset_id_set_data_full ((l), g_quark_from_string (k), (d), (f)) -#define g_dataset_remove_no_notify(l, k) \ - g_dataset_id_remove_no_notify ((l), g_quark_try_string (k)) -#define g_dataset_set_data(l, k, d) \ - g_dataset_set_data_full ((l), (k), (d), NULL) -#define g_dataset_remove_data(l, k) \ - g_dataset_id_set_data ((l), g_quark_try_string (k), NULL) - -G_END_DECLS - -#endif /* __G_DATASET_H__ */ - - - - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gdate.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gdate.h deleted file mode 100644 index 44b4384f3a..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gdate.h +++ /dev/null @@ -1,224 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_DATE_H__ -#define __G_DATE_H__ - -#include - -G_BEGIN_DECLS - -/* GDate - * - * Date calculations (not time for now, to be resolved). These are a - * mutant combination of Steffen Beyer's DateCalc routines - * (http://www.perl.com/CPAN/authors/id/STBEY/) and Jon Trowbridge's - * date routines (written for in-house software). Written by Havoc - * Pennington - */ - -typedef gint32 GTime; -typedef guint16 GDateYear; -typedef guint8 GDateDay; /* day of the month */ -typedef struct _GDate GDate; -/* make struct tm known without having to include time.h */ -struct tm; - -/* enum used to specify order of appearance in parsed date strings */ -typedef enum -{ - G_DATE_DAY = 0, - G_DATE_MONTH = 1, - G_DATE_YEAR = 2 -} GDateDMY; - -/* actual week and month values */ -typedef enum -{ - G_DATE_BAD_WEEKDAY = 0, - G_DATE_MONDAY = 1, - G_DATE_TUESDAY = 2, - G_DATE_WEDNESDAY = 3, - G_DATE_THURSDAY = 4, - G_DATE_FRIDAY = 5, - G_DATE_SATURDAY = 6, - G_DATE_SUNDAY = 7 -} GDateWeekday; -typedef enum -{ - G_DATE_BAD_MONTH = 0, - G_DATE_JANUARY = 1, - G_DATE_FEBRUARY = 2, - G_DATE_MARCH = 3, - G_DATE_APRIL = 4, - G_DATE_MAY = 5, - G_DATE_JUNE = 6, - G_DATE_JULY = 7, - G_DATE_AUGUST = 8, - G_DATE_SEPTEMBER = 9, - G_DATE_OCTOBER = 10, - G_DATE_NOVEMBER = 11, - G_DATE_DECEMBER = 12 -} GDateMonth; - -#define G_DATE_BAD_JULIAN 0U -#define G_DATE_BAD_DAY 0U -#define G_DATE_BAD_YEAR 0U - -/* Note: directly manipulating structs is generally a bad idea, but - * in this case it's an *incredibly* bad idea, because all or part - * of this struct can be invalid at any given time. Use the functions, - * or you will get hosed, I promise. - */ -struct _GDate -{ - guint julian_days : 32; /* julian days representation - we use a - * bitfield hoping that 64 bit platforms - * will pack this whole struct in one big - * int - */ - - guint julian : 1; /* julian is valid */ - guint dmy : 1; /* dmy is valid */ - - /* DMY representation */ - guint day : 6; - guint month : 4; - guint year : 16; -}; - -/* g_date_new() returns an invalid date, you then have to _set() stuff - * to get a usable object. You can also allocate a GDate statically, - * then call g_date_clear() to initialize. - */ -GDate* g_date_new (void); -GDate* g_date_new_dmy (GDateDay day, - GDateMonth month, - GDateYear year); -GDate* g_date_new_julian (guint32 julian_day); -void g_date_free (GDate *date); - -/* check g_date_valid() after doing an operation that might fail, like - * _parse. Almost all g_date operations are undefined on invalid - * dates (the exceptions are the mutators, since you need those to - * return to validity). - */ -gboolean g_date_valid (GDate *date); -gboolean g_date_valid_day (GDateDay day) G_GNUC_CONST; -gboolean g_date_valid_month (GDateMonth month) G_GNUC_CONST; -gboolean g_date_valid_year (GDateYear year) G_GNUC_CONST; -gboolean g_date_valid_weekday (GDateWeekday weekday) G_GNUC_CONST; -gboolean g_date_valid_julian (guint32 julian_date) G_GNUC_CONST; -gboolean g_date_valid_dmy (GDateDay day, - GDateMonth month, - GDateYear year) G_GNUC_CONST; - -GDateWeekday g_date_get_weekday (GDate *date); -GDateMonth g_date_get_month (GDate *date); -GDateYear g_date_get_year (GDate *date); -GDateDay g_date_get_day (GDate *date); -guint32 g_date_get_julian (GDate *date); -guint g_date_get_day_of_year (GDate *date); -/* First monday/sunday is the start of week 1; if we haven't reached - * that day, return 0. These are not ISO weeks of the year; that - * routine needs to be added. - * these functions return the number of weeks, starting on the - * corrsponding day - */ -guint g_date_get_monday_week_of_year (GDate *date); -guint g_date_get_sunday_week_of_year (GDate *date); - -/* If you create a static date struct you need to clear it to get it - * in a sane state before use. You can clear a whole array at - * once with the ndates argument. - */ -void g_date_clear (GDate *date, - guint n_dates); - -/* The parse routine is meant for dates typed in by a user, so it - * permits many formats but tries to catch common typos. If your data - * needs to be strictly validated, it is not an appropriate function. - */ -void g_date_set_parse (GDate *date, - gchar const *str); -void g_date_set_time (GDate *date, - GTime time); -void g_date_set_month (GDate *date, - GDateMonth month); -void g_date_set_day (GDate *date, - GDateDay day); -void g_date_set_year (GDate *date, - GDateYear year); -void g_date_set_dmy (GDate *date, - GDateDay day, - GDateMonth month, - GDateYear y); -void g_date_set_julian (GDate *date, - guint32 julian_date); -gboolean g_date_is_first_of_month (GDate *date); -gboolean g_date_is_last_of_month (GDate *date); - -/* To go forward by some number of weeks just go forward weeks*7 days */ -void g_date_add_days (GDate *date, - guint n_days); -void g_date_subtract_days (GDate *date, - guint n_days); - -/* If you add/sub months while day > 28, the day might change */ -void g_date_add_months (GDate *date, - guint n_months); -void g_date_subtract_months (GDate *date, - guint n_months); - -/* If it's feb 29, changing years can move you to the 28th */ -void g_date_add_years (GDate *date, - guint n_years); -void g_date_subtract_years (GDate *date, - guint n_years); -gboolean g_date_is_leap_year (GDateYear year) G_GNUC_CONST; -guint8 g_date_get_days_in_month (GDateMonth month, - GDateYear year) G_GNUC_CONST; -guint8 g_date_get_monday_weeks_in_year (GDateYear year) G_GNUC_CONST; -guint8 g_date_get_sunday_weeks_in_year (GDateYear year) G_GNUC_CONST; - -/* qsort-friendly (with a cast...) */ -gint g_date_compare (GDate *lhs, - GDate *rhs); -void g_date_to_struct_tm (GDate *date, - struct tm *tm); - -/* Just like strftime() except you can only use date-related formats. - * Using a time format is undefined. - */ -gsize g_date_strftime (gchar *s, - gsize slen, - gchar const *format, - GDate *date); - -G_END_DECLS - -#endif /* __G_DATE_H__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gerror.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gerror.h deleted file mode 100644 index 598b753230..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gerror.h +++ /dev/null @@ -1,74 +0,0 @@ -/* gerror.h - Error reporting system - * - * Copyright 2000 Red Hat, Inc. - * - * The Gnome Library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * The Gnome Library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the Gnome Library; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __G_ERROR_H__ -#define __G_ERROR_H__ - -#include - -G_BEGIN_DECLS - -typedef struct _GError GError; - -struct _GError -{ - GQuark domain; - gint code; - gchar *message; -}; - -GError* g_error_new (GQuark domain, - gint code, - gchar const *format, - ...) G_GNUC_PRINTF (3, 4); - -GError* g_error_new_literal (GQuark domain, - gint code, - gchar const *message); - -void g_error_free (GError *error); -GError* g_error_copy (GError const *error); - -gboolean g_error_matches (GError const *error, - GQuark domain, - gint code); - -/* if (err) *err = g_error_new(domain, code, format, ...), also has - * some sanity checks. - */ -void g_set_error (GError **err, - GQuark domain, - gint code, - gchar const *format, - ...) G_GNUC_PRINTF (4, 5); - -/* if (dest) *dest = src; also has some sanity checks. - */ -void g_propagate_error (GError **dest, - GError *src); - -/* if (err && *err) { g_error_free(*err); *err = NULL; } */ -void g_clear_error (GError **err); - - -G_END_DECLS - -#endif /* __G_ERROR_H__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gfileutils.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gfileutils.h deleted file mode 100644 index 42c1fc3eaf..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gfileutils.h +++ /dev/null @@ -1,95 +0,0 @@ -/* gfileutils.h - File utility functions - * - * Copyright 2000 Red Hat, Inc. - * - * GLib is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * GLib is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with GLib; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __G_FILEUTILS_H__ -#define __G_FILEUTILS_H__ - -#include - -G_BEGIN_DECLS - -#define G_FILE_ERROR g_file_error_quark () - -typedef enum -{ - G_FILE_ERROR_EXIST, - G_FILE_ERROR_ISDIR, - G_FILE_ERROR_ACCES, - G_FILE_ERROR_NAMETOOLONG, - G_FILE_ERROR_NOENT, - G_FILE_ERROR_NOTDIR, - G_FILE_ERROR_NXIO, - G_FILE_ERROR_NODEV, - G_FILE_ERROR_ROFS, - G_FILE_ERROR_TXTBSY, - G_FILE_ERROR_FAULT, - G_FILE_ERROR_LOOP, - G_FILE_ERROR_NOSPC, - G_FILE_ERROR_NOMEM, - G_FILE_ERROR_MFILE, - G_FILE_ERROR_NFILE, - G_FILE_ERROR_BADF, - G_FILE_ERROR_INVAL, - G_FILE_ERROR_PIPE, - G_FILE_ERROR_AGAIN, - G_FILE_ERROR_INTR, - G_FILE_ERROR_IO, - G_FILE_ERROR_PERM, - G_FILE_ERROR_FAILED -} GFileError; - -/* For backward-compat reasons, these are synced to an old - * anonymous enum in libgnome. But don't use that enum - * in new code. - */ -typedef enum -{ - G_FILE_TEST_IS_REGULAR = 1 << 0, - G_FILE_TEST_IS_SYMLINK = 1 << 1, - G_FILE_TEST_IS_DIR = 1 << 2, - G_FILE_TEST_IS_EXECUTABLE = 1 << 3, - G_FILE_TEST_EXISTS = 1 << 4 -} GFileTest; - -GQuark g_file_error_quark (void); -/* So other code can generate a GFileError */ -GFileError g_file_error_from_errno (gint err_no); - -gboolean g_file_test (gchar const *filename, - GFileTest test); -gboolean g_file_get_contents (gchar const *filename, - gchar **contents, - guint *length, - GError **error); - - -/* Wrapper / workalike for mkstemp() */ -int g_mkstemp (char *tmpl); - -/* Wrapper for g_mkstemp */ -int g_file_open_tmp (char const *tmpl, - char **name_used, - GError **error); - -G_END_DECLS - -#endif /* __G_FILEUTILS_H__ */ - - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/ghash.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/ghash.h deleted file mode 100644 index ce0d1eda59..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/ghash.h +++ /dev/null @@ -1,92 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_HASH_H__ -#define __G_HASH_H__ - -#include - -G_BEGIN_DECLS - -typedef struct _GHashTable GHashTable; - -typedef gboolean (*GHRFunc) (gpointer key, - gpointer value, - gpointer user_data); - -/* Hash tables - */ -GHashTable* g_hash_table_new (GHashFunc hash_func, - GEqualFunc key_equal_func); -void g_hash_table_destroy (GHashTable *hash_table); -void g_hash_table_insert (GHashTable *hash_table, - gpointer key, - gpointer value); -gboolean g_hash_table_remove (GHashTable *hash_table, - gconstpointer key); -gpointer g_hash_table_lookup (GHashTable *hash_table, - gconstpointer key); -gboolean g_hash_table_lookup_extended(GHashTable *hash_table, - gconstpointer lookup_key, - gpointer *orig_key, - gpointer *value); -void g_hash_table_foreach (GHashTable *hash_table, - GHFunc func, - gpointer user_data); -guint g_hash_table_foreach_remove (GHashTable *hash_table, - GHRFunc func, - gpointer user_data); -guint g_hash_table_size (GHashTable *hash_table); - -/* The following two functions are deprecated and will be removed in - * the next major release. They do no good. */ -void g_hash_table_freeze (GHashTable *hash_table); -void g_hash_table_thaw (GHashTable *hash_table); - -/* Hash Functions - */ -gboolean g_str_equal (gconstpointer v, - gconstpointer v2); -guint g_str_hash (gconstpointer v); - -gboolean g_int_equal (gconstpointer v, - gconstpointer v2) G_GNUC_CONST; -guint g_int_hash (gconstpointer v) G_GNUC_CONST; - -/* This "hash" function will just return the key's adress as an - * unsigned integer. Useful for hashing on plain adresses or - * simple integer values. - * passing NULL into g_hash_table_new() as GHashFunc has the - * same effect as passing g_direct_hash(). - */ -guint g_direct_hash (gconstpointer v) G_GNUC_CONST; -gboolean g_direct_equal (gconstpointer v, - gconstpointer v2) G_GNUC_CONST; - -G_END_DECLS - -#endif /* __G_HASH_H__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/ghook.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/ghook.h deleted file mode 100644 index fe350e18e2..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/ghook.h +++ /dev/null @@ -1,175 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_HOOK_H__ -#define __G_HOOK_H__ - -#include - -G_BEGIN_DECLS - -typedef struct _GHook GHook; -typedef struct _GHookList GHookList; - -typedef gint (*GHookCompareFunc) (GHook *new_hook, - GHook *sibling); -typedef gboolean (*GHookFindFunc) (GHook *hook, - gpointer data); -typedef void (*GHookMarshaller) (GHook *hook, - gpointer data); -typedef gboolean (*GHookCheckMarshaller) (GHook *hook, - gpointer data); -typedef void (*GHookFunc) (gpointer data); -typedef gboolean (*GHookCheckFunc) (gpointer data); -typedef void (*GHookFreeFunc) (GHookList *hook_list, - GHook *hook); - -/* Callback maintenance functions - */ -#define G_HOOK_FLAG_USER_SHIFT (4) -typedef enum -{ - G_HOOK_FLAG_ACTIVE = 1 << 0, - G_HOOK_FLAG_IN_CALL = 1 << 1, - G_HOOK_FLAG_MASK = 0x0f -} GHookFlagMask; - -#define G_HOOK_DEFERRED_DESTROY ((GHookFreeFunc) 0x01) - -struct _GHookList -{ - guint seq_id; - guint hook_size; - guint is_setup : 1; - GHook *hooks; - GMemChunk *hook_memchunk; - GHookFreeFunc hook_free; /* virtual function */ - GHookFreeFunc hook_destroy; /* virtual function */ -}; - -struct _GHook -{ - gpointer data; - GHook *next; - GHook *prev; - guint ref_count; - guint hook_id; - guint flags; - gpointer func; - GDestroyNotify destroy; -}; - -#define G_HOOK_ACTIVE(hook) ((((GHook*) hook)->flags & \ - G_HOOK_FLAG_ACTIVE) != 0) -#define G_HOOK_IN_CALL(hook) ((((GHook*) hook)->flags & \ - G_HOOK_FLAG_IN_CALL) != 0) -#define G_HOOK_IS_VALID(hook) (((GHook*) hook)->hook_id != 0 && \ - G_HOOK_ACTIVE (hook)) -#define G_HOOK_IS_UNLINKED(hook) (((GHook*) hook)->next == NULL && \ - ((GHook*) hook)->prev == NULL && \ - ((GHook*) hook)->hook_id == 0 && \ - ((GHook*) hook)->ref_count == 0) - -void g_hook_list_init (GHookList *hook_list, - guint hook_size); -void g_hook_list_clear (GHookList *hook_list); -GHook* g_hook_alloc (GHookList *hook_list); -void g_hook_free (GHookList *hook_list, - GHook *hook); -void g_hook_ref (GHookList *hook_list, - GHook *hook); -void g_hook_unref (GHookList *hook_list, - GHook *hook); -gboolean g_hook_destroy (GHookList *hook_list, - guint hook_id); -void g_hook_destroy_link (GHookList *hook_list, - GHook *hook); -void g_hook_prepend (GHookList *hook_list, - GHook *hook); -void g_hook_insert_before (GHookList *hook_list, - GHook *sibling, - GHook *hook); -void g_hook_insert_sorted (GHookList *hook_list, - GHook *hook, - GHookCompareFunc func); -GHook* g_hook_get (GHookList *hook_list, - guint hook_id); -GHook* g_hook_find (GHookList *hook_list, - gboolean need_valids, - GHookFindFunc func, - gpointer data); -GHook* g_hook_find_data (GHookList *hook_list, - gboolean need_valids, - gpointer data); -GHook* g_hook_find_func (GHookList *hook_list, - gboolean need_valids, - gpointer func); -GHook* g_hook_find_func_data (GHookList *hook_list, - gboolean need_valids, - gpointer func, - gpointer data); -/* return the first valid hook, and increment its reference count */ -GHook* g_hook_first_valid (GHookList *hook_list, - gboolean may_be_in_call); -/* return the next valid hook with incremented reference count, and - * decrement the reference count of the original hook - */ -GHook* g_hook_next_valid (GHookList *hook_list, - GHook *hook, - gboolean may_be_in_call); - -/* GHookCompareFunc implementation to insert hooks sorted by their id */ -gint g_hook_compare_ids (GHook *new_hook, - GHook *sibling); - -/* convenience macros */ -#define g_hook_append( hook_list, hook ) \ - g_hook_insert_before ((hook_list), NULL, (hook)) - -/* invoke all valid hooks with the (*GHookFunc) signature. - */ -void g_hook_list_invoke (GHookList *hook_list, - gboolean may_recurse); -/* invoke all valid hooks with the (*GHookCheckFunc) signature, - * and destroy the hook if FALSE is returned. - */ -void g_hook_list_invoke_check (GHookList *hook_list, - gboolean may_recurse); -/* invoke a marshaller on all valid hooks. - */ -void g_hook_list_marshal (GHookList *hook_list, - gboolean may_recurse, - GHookMarshaller marshaller, - gpointer data); -void g_hook_list_marshal_check (GHookList *hook_list, - gboolean may_recurse, - GHookCheckMarshaller marshaller, - gpointer data); - -G_END_DECLS - -#endif /* __G_HOOK_H__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/giochannel.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/giochannel.h deleted file mode 100644 index e9a64c0b37..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/giochannel.h +++ /dev/null @@ -1,187 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_IOCHANNEL_H__ -#define __G_IOCHANNEL_H__ - -#include -#include - -G_BEGIN_DECLS - -/* GIOChannel - */ - -typedef struct _GIOChannel GIOChannel; -typedef struct _GIOFuncs GIOFuncs; -typedef enum -{ - G_IO_ERROR_NONE, - G_IO_ERROR_AGAIN, - G_IO_ERROR_INVAL, - G_IO_ERROR_UNKNOWN -} GIOError; -typedef enum -{ - G_SEEK_CUR, - G_SEEK_SET, - G_SEEK_END -} GSeekType; -typedef enum -{ - G_IO_IN GLIB_SYSDEF_POLLIN, - G_IO_OUT GLIB_SYSDEF_POLLOUT, - G_IO_PRI GLIB_SYSDEF_POLLPRI, - G_IO_ERR GLIB_SYSDEF_POLLERR, - G_IO_HUP GLIB_SYSDEF_POLLHUP, - G_IO_NVAL GLIB_SYSDEF_POLLNVAL -} GIOCondition; - -struct _GIOChannel -{ - guint channel_flags; - guint ref_count; - GIOFuncs *funcs; -}; - -typedef gboolean (*GIOFunc) (GIOChannel *source, - GIOCondition condition, - gpointer data); -struct _GIOFuncs -{ - GIOError (*io_read) (GIOChannel *channel, - gchar *buf, - guint count, - guint *bytes_read); - GIOError (*io_write) (GIOChannel *channel, - gchar *buf, - guint count, - guint *bytes_written); - GIOError (*io_seek) (GIOChannel *channel, - gint offset, - GSeekType type); - void (*io_close) (GIOChannel *channel); - GSource * (*io_create_watch) (GIOChannel *channel, - GIOCondition condition); - void (*io_free) (GIOChannel *channel); -}; - -void g_io_channel_init (GIOChannel *channel); -void g_io_channel_ref (GIOChannel *channel); -void g_io_channel_unref (GIOChannel *channel); -GIOError g_io_channel_read (GIOChannel *channel, - gchar *buf, - guint count, - guint *bytes_read); -GIOError g_io_channel_write (GIOChannel *channel, - gchar *buf, - guint count, - guint *bytes_written); -GIOError g_io_channel_seek (GIOChannel *channel, - gint offset, - GSeekType type); -void g_io_channel_close (GIOChannel *channel); -guint g_io_add_watch_full (GIOChannel *channel, - gint priority, - GIOCondition condition, - GIOFunc func, - gpointer user_data, - GDestroyNotify notify); -GSource *g_io_create_watch (GIOChannel *channel, - GIOCondition condition); -guint g_io_add_watch (GIOChannel *channel, - GIOCondition condition, - GIOFunc func, - gpointer user_data); - -/* On Unix, IO channels created with this function for any file - * descriptor or socket. - * - * On Win32, use this only for files opened with the MSVCRT (the - * Microsoft run-time C library) _open() or _pipe, including file - * descriptors 0, 1 and 2 (corresponding to stdin, stdout and stderr). - * - * The term file descriptor as used in the context of Win32 refers to - * the emulated Unix-like file descriptors MSVCRT provides. The native - * corresponding concept is file HANDLE. There isn't as of yet a way to - * get GIOChannels for file HANDLEs. - */ -GIOChannel* g_io_channel_unix_new (int fd); -gint g_io_channel_unix_get_fd (GIOChannel *channel); - -#ifdef G_OS_WIN32 - -#define G_WIN32_MSG_HANDLE 19981206 - -/* Use this to get a GPollFD from a GIOChannel, so that you can call - * g_io_channel_win32_poll(). After calling this you should only use - * g_io_channel_read() to read from the GIOChannel, i.e. never read() - * or recv() from the underlying file descriptor or SOCKET. - */ -void g_io_channel_win32_make_pollfd (GIOChannel *channel, - GIOCondition condition, - GPollFD *fd); - -/* This can be used to wait a until at least one of the channels is readable. - * On Unix you would do a select() on the file descriptors of the channels. - * This should probably be available for all platforms? - */ -gint g_io_channel_win32_poll (GPollFD *fds, - gint n_fds, - gint timeout); - -/* This is used to add polling for Windows messages. GDK (GTk+) programs - * should *not* use this. - */ -void g_main_poll_win32_msg_add (gint priority, - GPollFD *fd, - guint hwnd); - -/* An IO channel for Windows messages for window handle hwnd. */ -GIOChannel *g_io_channel_win32_new_messages (guint hwnd); - -/* An IO channel for C runtime (emulated Unix-like) file - * descriptors. Identical to g_io_channel_unix_new above. - * After calling g_io_add_watch() on a IO channel returned - * by this function, you shouldn't call read() on the file - * descriptor. - */ -GIOChannel* g_io_channel_win32_new_fd (int fd); - -/* Get the C runtime file descriptor of a channel. */ -gint g_io_channel_win32_get_fd (GIOChannel *channel); - -/* An IO channel for a SOCK_STREAM winsock socket. The parameter - * should be a SOCKET. After calling g_io_add_watch() on a IO channel - * returned by this function, you shouldn't call recv() on the SOCKET. - */ -GIOChannel *g_io_channel_win32_new_stream_socket (int socket); - -#endif - -G_END_DECLS - -#endif /* __G_IOCHANNEL_H__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/glib.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/glib.h deleted file mode 100644 index 689f2e8699..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/glib.h +++ /dev/null @@ -1,75 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_LIB_H__ -#define __G_LIB_H__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef G_OS_WIN32 -#include -#endif - -#endif /* __G_LIB_H__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/glibconfig.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/glibconfig.h deleted file mode 100644 index 765c995216..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/glibconfig.h +++ /dev/null @@ -1,200 +0,0 @@ -/* glibconfig.h.win32 */ -/* Handcrafted for Microsoft C and gcc -mno-cygwin ("mingw32"). */ - -#ifndef __G_LIBCONFIG_H__ -#define __G_LIBCONFIG_H__ - -#include - -#ifdef _MSC_VER -/* Make MSVC more pedantic, this is a recommended pragma list - * from _Win32_Programming_ by Rector and Newcomer. - */ -#pragma warning(error:4002) -#pragma warning(error:4003) -#pragma warning(1:4010) -#pragma warning(error:4013) -#pragma warning(1:4016) -#pragma warning(error:4020) -#pragma warning(error:4021) -#pragma warning(error:4027) -#pragma warning(error:4029) -#pragma warning(error:4033) -#pragma warning(error:4035) -#pragma warning(error:4045) -#pragma warning(error:4047) -#pragma warning(error:4049) -#pragma warning(error:4053) -#pragma warning(error:4071) -#pragma warning(disable:4101) -#pragma warning(error:4150) - -#pragma warning(disable:4244) /* No possible loss of data warnings */ -#pragma warning(disable:4305) /* No truncation from int to char warnings */ -#endif /* _MSC_VER */ - -#include -#include - -#define G_MINFLOAT FLT_MIN -#define G_MAXFLOAT FLT_MAX -#define G_MINDOUBLE DBL_MIN -#define G_MAXDOUBLE DBL_MAX -#define G_MINSHORT SHRT_MIN -#define G_MAXSHORT SHRT_MAX -#define G_MAXUSHORT USHRT_MAX -#define G_MININT INT_MIN -#define G_MAXINT INT_MAX -#define G_MAXUINT UINT_MAX -#define G_MINLONG LONG_MIN -#define G_MAXLONG LONG_MAX -#define G_MAXULONG ULONG_MAX - -G_BEGIN_DECLS - -typedef signed char gint8; -typedef unsigned char guint8; -typedef signed short gint16; -typedef unsigned short guint16; -#define G_GINT16_FORMAT "hi" -#define G_GUINT16_FORMAT "hu" -typedef signed int gint32; -typedef unsigned int guint32; -#define G_GINT32_FORMAT "i" -#define G_GUINT32_FORMAT "u" - -#define G_HAVE_GINT64 1 - -/* These are compiler specific */ -#ifdef _MSC_VER -typedef __int64 gint64; -typedef unsigned __int64 guint64; -#define G_GINT64_CONSTANT(val) (val##i64) -#elif __GNUC__ -typedef long long gint64; -typedef unsigned long long guint64; -#define G_GINT64_CONSTANT(val) (val##LL) -#endif - -/* These depend on the C library. Using this file means the we - * use the (bundled) Microsoft msvcrt.dll. - */ -#define G_GINT64_FORMAT "I64i" -#define G_GUINT64_FORMAT "I64u" - -typedef gint32 gssize; -typedef guint32 gsize; - -#define GPOINTER_TO_INT(p) ((gint)(p)) -#define GPOINTER_TO_UINT(p) ((guint)(p)) - -#define GINT_TO_POINTER(i) ((gpointer)(i)) -#define GUINT_TO_POINTER(u) ((gpointer)(u)) - -#define g_ATEXIT(proc) (atexit (proc)) - -#define g_memmove(d,s,n) G_STMT_START { memmove ((d), (s), (n)); } G_STMT_END - -#define GLIB_MAJOR_VERSION 1 -#define GLIB_MINOR_VERSION 3 -#define GLIB_MICRO_VERSION 2 - -#define G_OS_WIN32 - -#ifdef __cplusplus -#define G_HAVE_INLINE 1 -#else /* !__cplusplus */ -#define G_HAVE___INLINE 1 -#endif - -#define G_THREADS_ENABLED -/* - * The following program can be used to determine the magic values below: - * #include - * #include - * main(int argc, char **argv) - * { - * int i; - * pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER; - * printf ("sizeof (pthread_mutex_t) = %d\n", sizeof (pthread_mutex_t)); - * printf ("sizeof (pthread_t) = %d\n", sizeof (pthread_t)); - * printf ("PTHREAD_MUTEX_INITIALIZER = "); - * for (i = 0; i < sizeof (pthread_mutex_t); i++) - * printf ("%u, ", ((unsigned char *) &m)[i]); - * printf ("\n"); - * exit(0); - * } - */ - -#define G_THREADS_IMPL_POSIX -typedef struct _GStaticMutex GStaticMutex; -struct _GStaticMutex -{ - struct _GMutex *runtime_mutex; - union { - /* The size of the pad array should be sizeof (pthread_mutex_t) */ - /* This value corresponds to the 1999-05-30 version of pthreads-win32 */ - char pad[4]; - double dummy_double; - void *dummy_pointer; - long dummy_long; - } aligned_pad_u; -}; -/* This should be NULL followed by the bytes in PTHREAD_MUTEX_INITIALIZER */ -#define G_STATIC_MUTEX_INIT { NULL, { { 255, 255, 255, 255 } } } -#define g_static_mutex_get_mutex(mutex) \ - (g_thread_use_default_impl ? ((GMutex*) &((mutex)->aligned_pad_u)) : \ - g_static_mutex_get_mutex_impl (&((mutex)->runtime_mutex))) -/* This represents a system thread as used by the implementation. An - * alien implementaion, as loaded by g_thread_init can only count on - * "sizeof (gpointer)" bytes to store their info. We however need more - * for some of our native implementations. */ -typedef union _GSystemThread GSystemThread; -union _GSystemThread -{ - /* The size of the data array should be sizeof (pthread_t) */ - /* This value corresponds to the 1999-05-30 version of pthreads-win32 */ - char data[4]; - double dummy_double; - void *dummy_pointer; - long dummy_long; -}; - -#define GINT16_TO_LE(val) ((gint16) (val)) -#define GUINT16_TO_LE(val) ((guint16) (val)) -#define GINT16_TO_BE(val) ((gint16) GUINT16_SWAP_LE_BE (val)) -#define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val)) - -#define GINT32_TO_LE(val) ((gint32) (val)) -#define GUINT32_TO_LE(val) ((guint32) (val)) -#define GINT32_TO_BE(val) ((gint32) GUINT32_SWAP_LE_BE (val)) -#define GUINT32_TO_BE(val) (GUINT32_SWAP_LE_BE (val)) - -#define GINT64_TO_LE(val) ((gint64) (val)) -#define GUINT64_TO_LE(val) ((guint64) (val)) -#define GINT64_TO_BE(val) ((gint64) GUINT64_SWAP_LE_BE (val)) -#define GUINT64_TO_BE(val) (GUINT64_SWAP_LE_BE (val)) - -#define GLONG_TO_LE(val) ((glong) GINT32_TO_LE (val)) -#define GULONG_TO_LE(val) ((gulong) GUINT32_TO_LE (val)) -#define GLONG_TO_BE(val) ((glong) GINT32_TO_BE (val)) -#define GULONG_TO_BE(val) ((gulong) GUINT32_TO_BE (val)) - -#define GINT_TO_LE(val) ((gint) GINT32_TO_LE (val)) -#define GUINT_TO_LE(val) ((guint) GUINT32_TO_LE (val)) -#define GINT_TO_BE(val) ((gint) GINT32_TO_BE (val)) -#define GUINT_TO_BE(val) ((guint) GUINT32_TO_BE (val)) -#define G_BYTE_ORDER G_LITTLE_ENDIAN - -#define GLIB_SYSDEF_POLLIN = 1 -#define GLIB_SYSDEF_POLLOUT = 4 -#define GLIB_SYSDEF_POLLPRI = 2 -#define GLIB_SYSDEF_POLLERR = 8 -#define GLIB_SYSDEF_POLLHUP = 16 -#define GLIB_SYSDEF_POLLNVAL = 32 - -#define G_MODULE_SUFFIX "dll" - -G_END_DECLS - -#endif /* __G_LIBCONFIG_H__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/glist.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/glist.h deleted file mode 100644 index 438b89bf6f..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/glist.h +++ /dev/null @@ -1,101 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_LIST_H__ -#define __G_LIST_H__ - -#include - -G_BEGIN_DECLS - -typedef struct _GList GList; - -struct _GList -{ - gpointer data; - GList *next; - GList *prev; -}; - -/* Doubly linked lists - */ -void g_list_push_allocator (GAllocator *allocator); -void g_list_pop_allocator (void); -GList* g_list_alloc (void); -void g_list_free (GList *list); -void g_list_free_1 (GList *list); -GList* g_list_append (GList *list, - gpointer data); -GList* g_list_prepend (GList *list, - gpointer data); -GList* g_list_insert (GList *list, - gpointer data, - gint position); -GList* g_list_insert_sorted (GList *list, - gpointer data, - GCompareFunc func); -GList* g_list_concat (GList *list1, - GList *list2); -GList* g_list_remove (GList *list, - gconstpointer data); -GList* g_list_remove_link (GList *list, - GList *llink); -GList* g_list_delete_link (GList *list, - GList *link); -GList* g_list_reverse (GList *list); -GList* g_list_copy (GList *list); -GList* g_list_nth (GList *list, - guint n); -GList* g_list_find (GList *list, - gconstpointer data); -GList* g_list_find_custom (GList *list, - gconstpointer data, - GCompareFunc func); -gint g_list_position (GList *list, - GList *llink); -gint g_list_index (GList *list, - gconstpointer data); -GList* g_list_last (GList *list); -GList* g_list_first (GList *list); -guint g_list_length (GList *list); -void g_list_foreach (GList *list, - GFunc func, - gpointer user_data); -GList* g_list_sort (GList *list, - GCompareFunc compare_func); -GList* g_list_sort_with_data (GList *list, - GCompareFuncData compare_func, - gpointer user_data); -gpointer g_list_nth_data (GList *list, - guint n); - -#define g_list_previous(list) ((list) ? (((GList *)(list))->prev) : NULL) -#define g_list_next(list) ((list) ? (((GList *)(list))->next) : NULL) - -G_END_DECLS - -#endif /* __G_LIST_H__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gmacros.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gmacros.h deleted file mode 100644 index 633d7fa3cc..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gmacros.h +++ /dev/null @@ -1,188 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -/* This file must not include any other glib header file and must thus - * not refer to variables from glibconfig.h - */ - -#ifndef __G_MACROS_H__ -#define __G_MACROS_H__ - -/* Here we provide G_GNUC_EXTENSION as an alias for __extension__, - * where this is valid. This allows for warningless compilation of - * "long long" types even in the presence of '-ansi -pedantic'. - */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) -# define G_GNUC_EXTENSION __extension__ -#else -# define G_GNUC_EXTENSION -#endif - -/* Provide macros to feature the GCC function attribute. - */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -#define G_GNUC_PURE \ - __attribute__((pure)) -#else -#define G_GNUC_PURE -#endif - -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) -#define G_GNUC_PRINTF( format_idx, arg_idx ) \ - __attribute__((format (printf, format_idx, arg_idx))) -#define G_GNUC_SCANF( format_idx, arg_idx ) \ - __attribute__((format (scanf, format_idx, arg_idx))) -#define G_GNUC_FORMAT( arg_idx ) \ - __attribute__((format_arg (arg_idx))) -#define G_GNUC_NORETURN \ - __attribute__((noreturn)) -#define G_GNUC_CONST \ - __attribute__((const)) -#define G_GNUC_UNUSED \ - __attribute__((unused)) -#else /* !__GNUC__ */ -#define G_GNUC_PRINTF( format_idx, arg_idx ) -#define G_GNUC_SCANF( format_idx, arg_idx ) -#define G_GNUC_FORMAT( arg_idx ) -#define G_GNUC_NORETURN -#define G_GNUC_CONST -#define G_GNUC_UNUSED -#endif /* !__GNUC__ */ - -/* Wrap the gcc __PRETTY_FUNCTION__ and __FUNCTION__ variables with - * macros, so we can refer to them as strings unconditionally. - */ -#ifdef __GNUC__ -#define G_GNUC_FUNCTION __FUNCTION__ -#define G_GNUC_PRETTY_FUNCTION __PRETTY_FUNCTION__ -#else /* !__GNUC__ */ -#define G_GNUC_FUNCTION "" -#define G_GNUC_PRETTY_FUNCTION "" -#endif /* !__GNUC__ */ - -#define G_STRINGIFY(macro_or_string) G_STRINGIFY_ARG (macro_or_string) -#define G_STRINGIFY_ARG(contents) #contents - -/* Provide a string identifying the current code position */ -#ifdef __GNUC__ -# define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) ":" __PRETTY_FUNCTION__ "()" -#else -# define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) -#endif - -/* Guard C code in headers, while including them from C++ */ -#ifdef __cplusplus -# define G_BEGIN_DECLS extern "C" { -# define G_END_DECLS } -#else -# define G_BEGIN_DECLS -# define G_END_DECLS -#endif - -/* Provide definitions for some commonly used macros. - * Some of them are only provided if they haven't already - * been defined. It is assumed that if they are already - * defined then the current definition is correct. - */ -#ifndef NULL -# ifdef __cplusplus -# define NULL (0L) -# else /* !__cplusplus */ -# define NULL ((void*) 0) -# endif /* !__cplusplus */ -#endif - -#ifndef FALSE -#define FALSE (0) -#endif - -#ifndef TRUE -#define TRUE (!FALSE) -#endif - -#undef MAX -#define MAX(a, b) (((a) > (b)) ? (a) : (b)) - -#undef MIN -#define MIN(a, b) (((a) < (b)) ? (a) : (b)) - -#undef ABS -#define ABS(a) (((a) < 0) ? -(a) : (a)) - -#undef CLAMP -#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) - -/* Count the number of elements in an array. The array must be defined - * as such; using this with a dynamically allocated array will give - * incorrect results. - */ -#define G_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0])) - -/* Provide convenience macros for handling structure - * fields through their offsets. - */ -#define G_STRUCT_OFFSET(struct_type, member) \ - ((glong) ((guint8*) &((struct_type*) 0)->member)) -#define G_STRUCT_MEMBER_P(struct_p, struct_offset) \ - ((gpointer) ((guint8*) (struct_p) + (glong) (struct_offset))) -#define G_STRUCT_MEMBER(member_type, struct_p, struct_offset) \ - (*(member_type*) G_STRUCT_MEMBER_P ((struct_p), (struct_offset))) - -/* Provide simple macro statement wrappers (adapted from Perl): - * G_STMT_START { statements; } G_STMT_END; - * can be used as a single statement, as in - * if (x) G_STMT_START { ... } G_STMT_END; else ... - * - * For gcc we will wrap the statements within `({' and `})' braces. - * For SunOS they will be wrapped within `if (1)' and `else (void) 0', - * and otherwise within `do' and `while (0)'. - */ -#if !(defined (G_STMT_START) && defined (G_STMT_END)) -# if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus) -# define G_STMT_START (void)( -# define G_STMT_END ) -# else -# if (defined (sun) || defined (__sun__)) -# define G_STMT_START if (1) -# define G_STMT_END else (void)0 -# else -# define G_STMT_START do -# define G_STMT_END while (0) -# endif -# endif -#endif - -/* Allow the app programmer to select whether or not return values - * (usually char*) are const or not. Don't try using this feature for - * functions with C++ linkage. - */ -#ifdef G_DISABLE_CONST_RETURNS -#define G_CONST_RETURN -#else -#define G_CONST_RETURN const -#endif - -#endif /* __G_MACROS_H__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gmain.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gmain.h deleted file mode 100644 index dd500c6e83..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gmain.h +++ /dev/null @@ -1,286 +0,0 @@ -/* gmain.h - the GLib Main loop - * Copyright (C) 1998-2000 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __G_MAIN_H__ -#define __G_MAIN_H__ - -#include -#include - -G_BEGIN_DECLS - -typedef struct _GMainContext GMainContext; /* Opaque */ -typedef struct _GMainLoop GMainLoop; /* Opaque */ -typedef struct _GSource GSource; -typedef struct _GSourceCallbackFuncs GSourceCallbackFuncs; -typedef struct _GSourceFuncs GSourceFuncs; - -typedef gboolean (*GSourceFunc) (gpointer data); - -struct _GSource -{ - /*< private >*/ - gpointer callback_data; - GSourceCallbackFuncs *callback_funcs; - - GSourceFuncs *source_funcs; - guint ref_count; - - GMainContext *context; - - gint priority; - guint flags; - guint id; - - GSList *poll_fds; - - GSource *prev; - GSource *next; -}; - -struct _GSourceCallbackFuncs -{ - void (*ref) (gpointer cb_data); - void (*unref) (gpointer cb_data); - void (*get) (gpointer cb_data, - GSourceFunc *func, - gpointer *data); -}; - -struct _GSourceFuncs -{ - gboolean (*prepare) (GSource *source, - gint *timeout); - gboolean (*check) (GSource *source); - gboolean (*dispatch) (GSource *source, - GSourceFunc callback, - gpointer user_data); - void (*destroy) (GSource *source); /* Can be NULL */ -}; - -/* Any definitions using GPollFD or GPollFunc are primarily - * for Unix and not guaranteed to be the compatible on all - * operating systems on which GLib runs. Right now, the - * GLib does use these functions on Win32 as well, but interprets - * them in a fairly different way than on Unix. If you use - * these definitions, you are should be prepared to recode - * for different operating systems. - * - * - * On Win32, the fd in a GPollFD should be Win32 HANDLE (*not* a file - * descriptor as provided by the C runtime) that can be used by - * MsgWaitForMultipleObjects. This does *not* include file handles - * from CreateFile, SOCKETs, nor pipe handles. (But you can use - * WSAEventSelect to signal events when a SOCKET is readable). - * - * On Win32, fd can also be the special value G_WIN32_MSG_HANDLE to - * indicate polling for messages. These message queue GPollFDs should - * be added with the g_main_poll_win32_msg_add function. - * - * But note that G_WIN32_MSG_HANDLE GPollFDs should not be used by GDK - * (GTK) programs, as GDK itself wants to read messages and convert them - * to GDK events. - * - * So, unless you really know what you are doing, it's best not to try - * to use the main loop polling stuff for your own needs on - * Win32. It's really only written for the GIMP's needs so - * far. - */ -typedef struct _GPollFD GPollFD; -typedef gint (*GPollFunc) (GPollFD *ufds, - guint nfsd, - gint timeout); - -struct _GPollFD -{ - gint fd; - gushort events; - gushort revents; -}; - -/* Standard priorities */ - -#define G_PRIORITY_HIGH -100 -#define G_PRIORITY_DEFAULT 0 -#define G_PRIORITY_HIGH_IDLE 100 -#define G_PRIORITY_DEFAULT_IDLE 200 -#define G_PRIORITY_LOW 300 - -/* GMainContext: */ - -GMainContext *g_main_context_get (GThread *thread); -GMainContext *g_main_context_default (void); - -gboolean g_main_context_iteration (GMainContext *context, - gboolean may_block); -gboolean g_main_context_pending (GMainContext *context); - -/* For implementation of legacy interfaces - */ -GSource *g_main_context_find_source_by_id (GMainContext *context, - guint id); -GSource *g_main_context_find_source_by_user_data (GMainContext *context, - gpointer user_data); -GSource *g_main_context_find_source_by_funcs_user_data (GMainContext *context, - GSourceFuncs *funcs, - gpointer user_data); - -/* Low level functions for implementing custom main loops. - */ -gboolean g_main_context_prepare (GMainContext *context, - gint *priority); -gint g_main_context_query (GMainContext *context, - gint max_priority, - gint *timeout, - GPollFD *fds, - gint n_fds); -gint g_main_context_check (GMainContext *context, - gint max_priority, - GPollFD *fds, - gint n_fds); -void g_main_context_dispatch (GMainContext *context); - -void g_main_context_set_poll_func (GMainContext *context, - GPollFunc func); -GPollFunc g_main_context_get_poll_func (GMainContext *context); - -/* Low level functions for use by source implementations - */ -void g_main_context_add_poll (GMainContext *context, - GPollFD *fd, - gint priority); -void g_main_context_remove_poll (GMainContext *context, - GPollFD *fd); - -/* GMainLoop: */ - -GMainLoop *g_main_loop_new (GMainContext *context, - gboolean is_running); -void g_main_loop_run (GMainLoop *loop); -void g_main_loop_quit (GMainLoop *loop); -void g_main_loop_destroy (GMainLoop *loop); -gboolean g_main_loop_is_running (GMainLoop *loop); - -/* GSource: */ - -GSource *g_source_new (GSourceFuncs *source_funcs, - guint struct_size); -GSource *g_source_ref (GSource *source); -void g_source_unref (GSource *source); - -guint g_source_attach (GSource *source, - GMainContext *context); -void g_source_destroy (GSource *source); - -void g_source_set_priority (GSource *source, - gint priority); -gint g_source_get_priority (GSource *source); -void g_source_set_can_recurse (GSource *source, - gboolean can_recurse); -gboolean g_source_get_can_recurse (GSource *source); -guint g_source_get_id (GSource *source); - -GMainContext *g_source_get_context (GSource *source); - -void g_source_set_callback (GSource *source, - GSourceFunc func, - gpointer data, - GDestroyNotify notify); - - -/* Used to implement g_source_connect_closure and internally*/ -void g_source_set_callback_indirect (GSource *source, - gpointer callback_data, - GSourceCallbackFuncs *callback_funcs); - -void g_source_add_poll (GSource *source, - GPollFD *fd); -void g_source_remove_poll (GSource *source, - GPollFD *fd); - -void g_source_get_current_time (GSource *source, - GTimeVal *timeval); - - /* void g_source_connect_closure (GSource *source, - GClosure *closure); - */ - -/* Specific source types - */ -GSource *g_idle_source_new (void); -GSource *g_timeout_source_new (guint interval); - -/* Miscellaneous functions - */ -void g_get_current_time (GTimeVal *result); - -/* ============== Compat main loop stuff ================== */ - -/* Legacy names for GMainLoop functions - */ -#define g_main_new(is_running) g_main_loop_new (NULL, is_running); -#define g_main_run(loop) g_main_loop_run(loop) -#define g_main_quit(loop) g_main_loop_quit(loop) -#define g_main_destroy(loop) g_main_loop_destroy(loop) -#define g_main_is_running(loop) g_main_loop_is_running(loop) - -/* Source manipulation by ID */ -gboolean g_source_remove (guint tag); -gboolean g_source_remove_by_user_data (gpointer user_data); -gboolean g_source_remove_by_funcs_user_data (GSourceFuncs *funcs, - gpointer user_data); - -/* Functions to manipulate the default main loop - */ - -#define g_main_iteration(may_block) g_main_context_iteration (NULL, may_block) -#define g_main_pending() g_main_context_pending (NULL) - -#define g_main_set_poll_func(func) g_main_context_set_poll_func (NULL, func) - -/* Idles and timeouts */ -guint g_timeout_add_full (gint priority, - guint interval, - GSourceFunc function, - gpointer data, - GDestroyNotify notify); -guint g_timeout_add (guint interval, - GSourceFunc function, - gpointer data); -guint g_idle_add (GSourceFunc function, - gpointer data); -guint g_idle_add_full (gint priority, - GSourceFunc function, - gpointer data, - GDestroyNotify notify); -gboolean g_idle_remove_by_data (gpointer data); - -#ifdef G_OS_WIN32 - -/* This is used to add polling for Windows messages. GDK (GTK+) programs - * should *not* use this. - */ -void g_main_poll_win32_msg_add (gint priority, - GPollFD *fd, - guint hwnd); -#endif /* G_OS_WIN32 */ - -G_END_DECLS - -#endif /* __G_MAIN_H__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gmarkup.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gmarkup.h deleted file mode 100644 index a96bfa3209..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gmarkup.h +++ /dev/null @@ -1,129 +0,0 @@ -/* gmarkup.h - Simple XML-like string parser/writer - * - * Copyright 2000 Red Hat, Inc. - * - * GLib is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * GLib is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with GLib; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __G_MARKUP_H__ -#define __G_MARKUP_H__ - -#include - -#ifdef __cplusplus -extern "C" -{ -#endif - -typedef enum -{ - G_MARKUP_ERROR_BAD_UTF8, - G_MARKUP_ERROR_EMPTY, - G_MARKUP_ERROR_PARSE, - /* These three are primarily intended for specific GMarkupParser - * implementations to set. - */ - G_MARKUP_ERROR_UNKNOWN_ELEMENT, - G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, - G_MARKUP_ERROR_INVALID_CONTENT -} GMarkupError; - -#define G_MARKUP_ERROR g_markup_error_quark () - -GQuark g_markup_error_quark (); - -typedef enum -{ - /* Hmm, can't think of any at the moment */ - G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG = 1 << 0 - -} GMarkupParseFlags; - -typedef struct _GMarkupParseContext GMarkupParseContext; -typedef struct _GMarkupParser GMarkupParser; - -struct _GMarkupParser -{ - /* Called for open tags */ - void (*start_element) (GMarkupParseContext *context, - gchar const *element_name, - gchar const **attribute_names, - gchar const **attribute_values, - gpointer user_data, - GError **error); - - /* Called for close tags */ - void (*end_element) (GMarkupParseContext *context, - gchar const *element_name, - gpointer user_data, - GError **error); - - /* Called for character data */ - /* text is not nul-terminated */ - void (*text) (GMarkupParseContext *context, - gchar const *text, - gint text_len, - gpointer user_data, - GError **error); - - /* Called for strings that should be re-saved verbatim in this same - * position, but are not otherwise interpretable. At the moment - * this includes comments and processing instructions. - */ - /* text is not nul-terminated. */ - void (*passthrough) (GMarkupParseContext *context, - gchar const *passthrough_text, - gint text_len, - gpointer user_data, - GError **error); - - /* Called on error, including one set by other - * methods in the vtable. The GError should not be freed. - */ - void (*error) (GMarkupParseContext *context, - GError *error, - gpointer user_data); -}; - -GMarkupParseContext *g_markup_parse_context_new (GMarkupParser const *parser, - GMarkupParseFlags flags, - gpointer user_data, - GDestroyNotify user_data_dnotify); -void g_markup_parse_context_free (GMarkupParseContext *context); -gboolean g_markup_parse_context_parse (GMarkupParseContext *context, - gchar const *text, - gint text_len, - GError **error); - -gboolean g_markup_parse_context_end_parse (GMarkupParseContext *context, - GError **error); - -/* For user-constructed error messages, has no precise semantics */ -void g_markup_parse_context_get_position (GMarkupParseContext *context, - gint *line_number, - gint *char_number); - -/* useful when saving */ -gchar* g_markup_escape_text (gchar const *text, - gint length); - - -#ifdef __cplusplus -} -#endif - -#endif /* __G_MARKUP_H__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gmem.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gmem.h deleted file mode 100644 index 48f5fa750a..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gmem.h +++ /dev/null @@ -1,158 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_MEM_H__ -#define __G_MEM_H__ - -#include - -/* optionally feature DMALLOC memory allocation debugger - */ -#ifdef USE_DMALLOC -#include "dmalloc.h" -#endif - -G_BEGIN_DECLS - -typedef struct _GAllocator GAllocator; -typedef struct _GMemChunk GMemChunk; - -/* Provide macros for easily allocating memory. The macros - * will cast the allocated memory to the specified type - * in order to avoid compiler warnings. (Makes the code neater). - */ - -#ifdef __DMALLOC_H__ -# define g_new(type, count) (ALLOC (type, count)) -# define g_new0(type, count) (CALLOC (type, count)) -# define g_renew(type, mem, count) (REALLOC (mem, type, count)) -#else /* __DMALLOC_H__ */ -# define g_new(type, count) \ - ((type *) g_malloc ((unsigned) sizeof (type) * (count))) -# define g_new0(type, count) \ - ((type *) g_malloc0 ((unsigned) sizeof (type) * (count))) -# define g_renew(type, mem, count) \ - ((type *) g_realloc (mem, (unsigned) sizeof (type) * (count))) -#endif /* __DMALLOC_H__ */ - -#define g_mem_chunk_create(type, pre_alloc, alloc_type) ( \ - g_mem_chunk_new (#type " mem chunks (" #pre_alloc ")", \ - sizeof (type), \ - sizeof (type) * (pre_alloc), \ - (alloc_type)) \ -) -#define g_chunk_new(type, chunk) ( \ - (type *) g_mem_chunk_alloc (chunk) \ -) -#define g_chunk_new0(type, chunk) ( \ - (type *) g_mem_chunk_alloc0 (chunk) \ -) -#define g_chunk_free(mem, mem_chunk) G_STMT_START { \ - g_mem_chunk_free ((mem_chunk), (mem)); \ -} G_STMT_END - -/* Memory allocation and debugging - */ -#ifdef USE_DMALLOC - -#define g_malloc(size) ((gpointer) MALLOC (size)) -#define g_malloc0(size) ((gpointer) CALLOC (char, size)) -#define g_realloc(mem,size) ((gpointer) REALLOC (mem, char, size)) -#define g_free(mem) FREE (mem) - -#else /* !USE_DMALLOC */ - -gpointer g_malloc (gulong size); -gpointer g_malloc0 (gulong size); -gpointer g_realloc (gpointer mem, - gulong size); -void g_free (gpointer mem); - -#endif /* !USE_DMALLOC */ - -void g_mem_profile (void); -void g_mem_check (gpointer mem); - -/* Generic allocators - */ -GAllocator* g_allocator_new (gchar const *name, - guint n_preallocs); -void g_allocator_free (GAllocator *allocator); - -#define G_ALLOCATOR_LIST (1) -#define G_ALLOCATOR_SLIST (2) -#define G_ALLOCATOR_NODE (3) - -/* "g_mem_chunk_new" creates a new memory chunk. - * Memory chunks are used to allocate pieces of memory which are - * always the same size. Lists are a good example of such a data type. - * The memory chunk allocates and frees blocks of memory as needed. - * Just be sure to call "g_mem_chunk_free" and not "g_free" on data - * allocated in a mem chunk. ("g_free" will most likely cause a seg - * fault...somewhere). - * - * Oh yeah, GMemChunk is an opaque data type. (You don't really - * want to know what's going on inside do you?) - */ - -/* ALLOC_ONLY MemChunk's can only allocate memory. The free operation - * is interpreted as a no op. ALLOC_ONLY MemChunk's save 4 bytes per - * atom. (They are also useful for lists which use MemChunk to allocate - * memory but are also part of the MemChunk implementation). - * ALLOC_AND_FREE MemChunk's can allocate and free memory. - */ - -#define G_ALLOC_ONLY 1 -#define G_ALLOC_AND_FREE 2 - -GMemChunk* g_mem_chunk_new (gchar *name, - gint atom_size, - gulong area_size, - gint type); -void g_mem_chunk_destroy (GMemChunk *mem_chunk); -gpointer g_mem_chunk_alloc (GMemChunk *mem_chunk); -gpointer g_mem_chunk_alloc0 (GMemChunk *mem_chunk); -void g_mem_chunk_free (GMemChunk *mem_chunk, - gpointer mem); -void g_mem_chunk_clean (GMemChunk *mem_chunk); -void g_mem_chunk_reset (GMemChunk *mem_chunk); -void g_mem_chunk_print (GMemChunk *mem_chunk); -void g_mem_chunk_info (void); - -/* Ah yes...we have a "g_blow_chunks" function. - * "g_blow_chunks" simply compresses all the chunks. This operation - * consists of freeing every memory area that should be freed (but - * which we haven't gotten around to doing yet). And, no, - * "g_blow_chunks" doesn't follow the naming scheme, but it is a - * much better name than "g_mem_chunk_clean_all" or something - * similar. - */ -void g_blow_chunks (void); - -G_END_DECLS - -#endif /* __G_MEM_H__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gmessages.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gmessages.h deleted file mode 100644 index c77e5b1039..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gmessages.h +++ /dev/null @@ -1,341 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_MESSAGES_H__ -#define __G_MESSAGES_H__ - -#include -#include - -G_BEGIN_DECLS - -/* calculate a string size, guarranteed to fit format + args. - */ -guint g_printf_string_upper_bound (gchar const *format, - va_list args); - -/* Log level shift offset for user defined - * log levels (0-7 are used by GLib). - */ -#define G_LOG_LEVEL_USER_SHIFT (8) - -/* Glib log levels and flags. - */ -typedef enum -{ - /* log flags */ - G_LOG_FLAG_RECURSION = 1 << 0, - G_LOG_FLAG_FATAL = 1 << 1, - - /* GLib log levels */ - G_LOG_LEVEL_ERROR = 1 << 2, /* always fatal */ - G_LOG_LEVEL_CRITICAL = 1 << 3, - G_LOG_LEVEL_WARNING = 1 << 4, - G_LOG_LEVEL_MESSAGE = 1 << 5, - G_LOG_LEVEL_INFO = 1 << 6, - G_LOG_LEVEL_DEBUG = 1 << 7, - - G_LOG_LEVEL_MASK = ~(G_LOG_FLAG_RECURSION | G_LOG_FLAG_FATAL) -} GLogLevelFlags; - -/* GLib log levels that are considered fatal by default */ -#define G_LOG_FATAL_MASK (G_LOG_FLAG_RECURSION | G_LOG_LEVEL_ERROR) - -typedef void (*GLogFunc) (gchar const *log_domain, - GLogLevelFlags log_level, - gchar const *message, - gpointer user_data); - -/* Logging mechanism - */ -extern gchar const *g_log_domain_glib; -guint g_log_set_handler (gchar const *log_domain, - GLogLevelFlags log_levels, - GLogFunc log_func, - gpointer user_data); -void g_log_remove_handler (gchar const *log_domain, - guint handler_id); -void g_log_default_handler (gchar const *log_domain, - GLogLevelFlags log_level, - gchar const *message, - gpointer unused_data); -void g_log (gchar const *log_domain, - GLogLevelFlags log_level, - gchar const *format, - ...) G_GNUC_PRINTF (3, 4); -void g_logv (gchar const *log_domain, - GLogLevelFlags log_level, - gchar const *format, - va_list args); -GLogLevelFlags g_log_set_fatal_mask (gchar const *log_domain, - GLogLevelFlags fatal_mask); -GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask); - -#ifndef G_LOG_DOMAIN -#define G_LOG_DOMAIN ((gchar*) 0) -#endif /* G_LOG_DOMAIN */ -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -#define g_error(...) g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_ERROR, \ - __VA_ARGS__) -#define g_message(...) g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_MESSAGE, \ - __VA_ARGS__) -#define g_critical(...) g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_CRITICAL, \ - __VA_ARGS__) -#define g_warning(...) g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_WARNING, \ - __VA_ARGS__) -#elif __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 4) -#define g_error(format...) g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_ERROR, \ - format) -#define g_message(format...) g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_MESSAGE, \ - format) -#define g_critical(format...) g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_CRITICAL, \ - format) -#define g_warning(format...) g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_WARNING, \ - format) -#else /* !__GNUC__ */ -static void -g_error (gchar const *format, - ...) -{ - va_list args; - va_start (args, format); - g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args); - va_end (args); -} -static void -g_message (gchar const *format, - ...) -{ - va_list args; - va_start (args, format); - g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, format, args); - va_end (args); -} -static void -g_critical (gchar const *format, - ...) -{ - va_list args; - va_start (args, format); - g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, format, args); - va_end (args); -} -static void -g_warning (gchar const *format, - ...) -{ - va_list args; - va_start (args, format); - g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, format, args); - va_end (args); -} -#endif /* !__GNUC__ */ - -typedef void (*GPrintFunc) (gchar const *string); -void g_print (gchar const *format, - ...) G_GNUC_PRINTF (1, 2); -GPrintFunc g_set_print_handler (GPrintFunc func); -void g_printerr (gchar const *format, - ...) G_GNUC_PRINTF (1, 2); -GPrintFunc g_set_printerr_handler (GPrintFunc func); - -/* deprecated compatibility functions, use g_log_set_handler() instead */ -typedef void (*GErrorFunc) (gchar const *str); -typedef void (*GWarningFunc) (gchar const *str); -GErrorFunc g_set_error_handler (GErrorFunc func); -GWarningFunc g_set_warning_handler (GWarningFunc func); -GPrintFunc g_set_message_handler (GPrintFunc func); - -/* Provide macros for error handling. The "assert" macros will - * exit on failure. The "return" macros will exit the current - * function. Two different definitions are given for the macros - * if G_DISABLE_ASSERT is not defined, in order to support gcc's - * __PRETTY_FUNCTION__ capability. - */ - -#ifdef G_DISABLE_ASSERT - -#define g_assert(expr) -#define g_assert_not_reached() - -#else /* !G_DISABLE_ASSERT */ - -#ifdef __GNUC__ - -#define g_assert(expr) G_STMT_START{ \ - if (!(expr)) \ - g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_ERROR, \ - "file %s: line %d (%s): assertion failed: (%s)", \ - __FILE__, \ - __LINE__, \ - __PRETTY_FUNCTION__, \ - #expr); }G_STMT_END - -#define g_assert_not_reached() G_STMT_START{ \ - g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_ERROR, \ - "file %s: line %d (%s): should not be reached", \ - __FILE__, \ - __LINE__, \ - __PRETTY_FUNCTION__); }G_STMT_END - -#else /* !__GNUC__ */ - -#define g_assert(expr) G_STMT_START{ \ - if (!(expr)) \ - g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_ERROR, \ - "file %s: line %d: assertion failed: (%s)", \ - __FILE__, \ - __LINE__, \ - #expr); }G_STMT_END - -#define g_assert_not_reached() G_STMT_START{ \ - g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_ERROR, \ - "file %s: line %d: should not be reached", \ - __FILE__, \ - __LINE__); }G_STMT_END - -#endif /* __GNUC__ */ - -#endif /* !G_DISABLE_ASSERT */ - - -#ifdef G_DISABLE_CHECKS - -#define g_return_if_fail(expr) -#define g_return_val_if_fail(expr,val) -#define g_return_if_reached() return -#define g_return_val_if_reached(val) return (val) - -#else /* !G_DISABLE_CHECKS */ - -#ifdef __GNUC__ - -#define g_return_if_fail(expr) G_STMT_START{ \ - if (!(expr)) \ - { \ - g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_CRITICAL, \ - "file %s: line %d (%s): assertion `%s' failed", \ - __FILE__, \ - __LINE__, \ - __PRETTY_FUNCTION__, \ - #expr); \ - return; \ - }; }G_STMT_END - -#define g_return_val_if_fail(expr,val) G_STMT_START{ \ - if (!(expr)) \ - { \ - g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_CRITICAL, \ - "file %s: line %d (%s): assertion `%s' failed", \ - __FILE__, \ - __LINE__, \ - __PRETTY_FUNCTION__, \ - #expr); \ - return (val); \ - }; }G_STMT_END - -#define g_return_if_reached() G_STMT_START{ \ - g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_CRITICAL, \ - "file %s: line %d (%s): should not be reached", \ - __FILE__, \ - __LINE__, \ - __PRETTY_FUNCTION__); \ - return; }G_STMT_END - -#define g_return_val_if_reached(val) G_STMT_START{ \ - g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_CRITICAL, \ - "file %s: line %d (%s): should not be reached", \ - __FILE__, \ - __LINE__, \ - __PRETTY_FUNCTION__); \ - return (val); }G_STMT_END - -#else /* !__GNUC__ */ - -#define g_return_if_fail(expr) G_STMT_START{ \ - if (!(expr)) \ - { \ - g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_CRITICAL, \ - "file %s: line %d: assertion `%s' failed", \ - __FILE__, \ - __LINE__, \ - #expr); \ - return; \ - }; }G_STMT_END - -#define g_return_val_if_fail(expr, val) G_STMT_START{ \ - if (!(expr)) \ - { \ - g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_CRITICAL, \ - "file %s: line %d: assertion `%s' failed", \ - __FILE__, \ - __LINE__, \ - #expr); \ - return (val); \ - }; }G_STMT_END - -#define g_return_if_reached() G_STMT_START{ \ - g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_CRITICAL, \ - "file %s: line %d: should not be reached", \ - __FILE__, \ - __LINE__); \ - return; }G_STMT_END - -#define g_return_val_if_reached(val) G_STMT_START{ \ - g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_CRITICAL, \ - "file %s: line %d: should not be reached", \ - __FILE__, \ - __LINE__); \ - return (val); }G_STMT_END - -#endif /* !__GNUC__ */ - -#endif /* !G_DISABLE_CHECKS */ - -G_END_DECLS - -#endif /* __G_MESSAGES_H__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gnode.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gnode.h deleted file mode 100644 index c4a9c5f699..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gnode.h +++ /dev/null @@ -1,163 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_NODE_H__ -#define __G_NODE_H__ - -#include - -G_BEGIN_DECLS - -typedef struct _GNode GNode; - -/* Tree traverse flags */ -typedef enum -{ - G_TRAVERSE_LEAFS = 1 << 0, - G_TRAVERSE_NON_LEAFS = 1 << 1, - G_TRAVERSE_ALL = G_TRAVERSE_LEAFS | G_TRAVERSE_NON_LEAFS, - G_TRAVERSE_MASK = 0x03 -} GTraverseFlags; - -/* Tree traverse orders */ -typedef enum -{ - G_IN_ORDER, - G_PRE_ORDER, - G_POST_ORDER, - G_LEVEL_ORDER -} GTraverseType; - -typedef gboolean (*GNodeTraverseFunc) (GNode *node, - gpointer data); -typedef void (*GNodeForeachFunc) (GNode *node, - gpointer data); - -/* N-way tree implementation - */ -struct _GNode -{ - gpointer data; - GNode *next; - GNode *prev; - GNode *parent; - GNode *children; -}; - -#define G_NODE_IS_ROOT(node) (((GNode*) (node))->parent == NULL && \ - ((GNode*) (node))->prev == NULL && \ - ((GNode*) (node))->next == NULL) -#define G_NODE_IS_LEAF(node) (((GNode*) (node))->children == NULL) - -void g_node_push_allocator (GAllocator *allocator); -void g_node_pop_allocator (void); -GNode* g_node_new (gpointer data); -void g_node_destroy (GNode *root); -void g_node_unlink (GNode *node); -GNode* g_node_copy (GNode *node); -GNode* g_node_insert (GNode *parent, - gint position, - GNode *node); -GNode* g_node_insert_before (GNode *parent, - GNode *sibling, - GNode *node); -GNode* g_node_insert_after (GNode *parent, - GNode *sibling, - GNode *node); -GNode* g_node_prepend (GNode *parent, - GNode *node); -guint g_node_n_nodes (GNode *root, - GTraverseFlags flags); -GNode* g_node_get_root (GNode *node); -gboolean g_node_is_ancestor (GNode *node, - GNode *descendant); -guint g_node_depth (GNode *node); -GNode* g_node_find (GNode *root, - GTraverseType order, - GTraverseFlags flags, - gpointer data); - -/* convenience macros */ -#define g_node_append(parent, node) \ - g_node_insert_before ((parent), NULL, (node)) -#define g_node_insert_data(parent, position, data) \ - g_node_insert ((parent), (position), g_node_new (data)) -#define g_node_insert_data_before(parent, sibling, data) \ - g_node_insert_before ((parent), (sibling), g_node_new (data)) -#define g_node_prepend_data(parent, data) \ - g_node_prepend ((parent), g_node_new (data)) -#define g_node_append_data(parent, data) \ - g_node_insert_before ((parent), NULL, g_node_new (data)) - -/* traversal function, assumes that `node' is root - * (only traverses `node' and its subtree). - * this function is just a high level interface to - * low level traversal functions, optimized for speed. - */ -void g_node_traverse (GNode *root, - GTraverseType order, - GTraverseFlags flags, - gint max_depth, - GNodeTraverseFunc func, - gpointer data); - -/* return the maximum tree height starting with `node', this is an expensive - * operation, since we need to visit all nodes. this could be shortened by - * adding `guint height' to struct _GNode, but then again, this is not very - * often needed, and would make g_node_insert() more time consuming. - */ -guint g_node_max_height (GNode *root); - -void g_node_children_foreach (GNode *node, - GTraverseFlags flags, - GNodeForeachFunc func, - gpointer data); -void g_node_reverse_children (GNode *node); -guint g_node_n_children (GNode *node); -GNode* g_node_nth_child (GNode *node, - guint n); -GNode* g_node_last_child (GNode *node); -GNode* g_node_find_child (GNode *node, - GTraverseFlags flags, - gpointer data); -gint g_node_child_position (GNode *node, - GNode *child); -gint g_node_child_index (GNode *node, - gpointer data); - -GNode* g_node_first_sibling (GNode *node); -GNode* g_node_last_sibling (GNode *node); - -#define g_node_prev_sibling(node) ((node) ? \ - ((GNode*) (node))->prev : NULL) -#define g_node_next_sibling(node) ((node) ? \ - ((GNode*) (node))->next : NULL) -#define g_node_first_child(node) ((node) ? \ - ((GNode*) (node))->children : NULL) - -G_END_DECLS - -#endif /* __G_NODE_H__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gprimes.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gprimes.h deleted file mode 100644 index daa1598c27..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gprimes.h +++ /dev/null @@ -1,47 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_PRIMES_H__ -#define __G_PRIMES_H__ - -#include - -G_BEGIN_DECLS - -/* Prime numbers. - */ - -/* This function returns prime numbers spaced by approximately 1.5-2.0 - * and is for use in resizing data structures which prefer - * prime-valued sizes. The closest spaced prime function returns the - * next largest prime, or the highest it knows about which is about - * MAXINT/4. - */ -guint g_spaced_primes_closest (guint num) G_GNUC_CONST; - -G_END_DECLS - -#endif /* __G_PRIMES_H__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gqsort.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gqsort.h deleted file mode 100644 index f236e04fbe..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gqsort.h +++ /dev/null @@ -1,44 +0,0 @@ - /* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - - -#ifndef __G_QSORT_H__ -#define __G_QSORT_H__ - -#include - -G_BEGIN_DECLS - -void g_qsort_with_data (gconstpointer pbase, - gint total_elems, - size_t size, - GCompareFuncData compare_func, - gpointer user_data); - -G_END_DECLS - -#endif /* __G_QSORT_H__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gquark.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gquark.h deleted file mode 100644 index d7b7939958..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gquark.h +++ /dev/null @@ -1,46 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_QUARK_H__ -#define __G_QUARK_H__ - -#include - -G_BEGIN_DECLS - -typedef guint32 GQuark; - -/* Quarks (string<->id association) - */ -GQuark g_quark_try_string (gchar const *string); -GQuark g_quark_from_static_string (gchar const *string); -GQuark g_quark_from_string (gchar const *string); -gchar* g_quark_to_string (GQuark quark) G_GNUC_CONST; - -G_END_DECLS - -#endif /* __G_QUARK_H__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gqueue.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gqueue.h deleted file mode 100644 index b71b6d61ef..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gqueue.h +++ /dev/null @@ -1,65 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_QUEUE_H__ -#define __G_QUEUE_H__ - -#include - -G_BEGIN_DECLS - -typedef struct _GQueue GQueue; - -struct _GQueue -{ - GList *head; - GList *tail; - guint length; -}; - -/* Queues - */ -GQueue* g_queue_new (void); -void g_queue_free (GQueue *queue); -void g_queue_push_head (GQueue *queue, - gpointer data); -void g_queue_push_tail (GQueue *queue, - gpointer data); -gpointer g_queue_pop_head (GQueue *queue); -gpointer g_queue_pop_tail (GQueue *queue); -gboolean g_queue_is_empty (GQueue *queue); -gpointer g_queue_peek_head (GQueue *queue); -gpointer g_queue_peek_tail (GQueue *queue); -void g_queue_push_head_link (GQueue *queue, - GList *link); -void g_queue_push_tail_link (GQueue *queue, - GList *link); -GList* g_queue_pop_head_link (GQueue *queue); -GList* g_queue_pop_tail_link (GQueue *queue); - -G_END_DECLS - -#endif /* __G_QUEUE_H__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/grand.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/grand.h deleted file mode 100644 index 8cbeff6e4b..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/grand.h +++ /dev/null @@ -1,82 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_RAND_H__ -#define __G_RAND_H__ - -#include - -G_BEGIN_DECLS - -typedef struct _GRand GRand; - -/* GRand - a good and fast random number generator: Mersenne Twister - * see http://www.math.keio.ac.jp/~matumoto/emt.html for more info. - * The range functions return a value in the intervall [begin, end). - * int -> [0..2^32-1] - * int_range -> [begin..end-1] - * double -> [0..1) - * double_range -> [begin..end) - */ - -GRand* g_rand_new_with_seed (guint32 seed); -GRand* g_rand_new (void); -void g_rand_free (GRand *rand); - -void g_rand_set_seed (GRand *rand, - guint32 seed); - -#define g_rand_boolean(rand) (g_rand_int ((rand)) & (1<<15)) - -guint32 g_rand_int (GRand *rand); -gint32 g_rand_int_range (GRand *rand, - gint32 begin, - gint32 end); -gdouble g_rand_double (GRand *rand); -gdouble g_rand_double_range (GRand *rand, - gdouble begin, - gdouble end); - -void g_random_set_seed (guint32 seed); - -#define g_random_boolean() (g_rand_boolean ((rand))) - -guint32 g_random_int (void); -gint32 g_random_int_range (gint32 begin, - gint32 end); -gdouble g_random_double (void); -gdouble g_random_double_range (gdouble begin, - gdouble end); - -G_END_DECLS - -#endif /* __G_RAND_H__ */ - - - - - - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/grel.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/grel.h deleted file mode 100644 index fcf8eab454..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/grel.h +++ /dev/null @@ -1,94 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_REL_H__ -#define __G_REL_H__ - -#include - -G_BEGIN_DECLS - -typedef struct _GRelation GRelation; -typedef struct _GTuples GTuples; - -struct _GTuples -{ - guint len; -}; - -/* GRelation - * - * Indexed Relations. Imagine a really simple table in a - * database. Relations are not ordered. This data type is meant for - * maintaining a N-way mapping. - * - * g_relation_new() creates a relation with FIELDS fields - * - * g_relation_destroy() frees all resources - * g_tuples_destroy() frees the result of g_relation_select() - * - * g_relation_index() indexes relation FIELD with the provided - * equality and hash functions. this must be done before any - * calls to insert are made. - * - * g_relation_insert() inserts a new tuple. you are expected to - * provide the right number of fields. - * - * g_relation_delete() deletes all relations with KEY in FIELD - * g_relation_select() returns ... - * g_relation_count() counts ... - */ - -GRelation* g_relation_new (gint fields); -void g_relation_destroy (GRelation *relation); -void g_relation_index (GRelation *relation, - gint field, - GHashFunc hash_func, - GEqualFunc key_equal_func); -void g_relation_insert (GRelation *relation, - ...); -gint g_relation_delete (GRelation *relation, - gconstpointer key, - gint field); -GTuples* g_relation_select (GRelation *relation, - gconstpointer key, - gint field); -gint g_relation_count (GRelation *relation, - gconstpointer key, - gint field); -gboolean g_relation_exists (GRelation *relation, - ...); -void g_relation_print (GRelation *relation); - -void g_tuples_destroy (GTuples *tuples); -gpointer g_tuples_index (GTuples *tuples, - gint index, - gint field); - -G_END_DECLS - -#endif /* __G_REL_H__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gscanner.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gscanner.h deleted file mode 100644 index 9ccb6d894b..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gscanner.h +++ /dev/null @@ -1,267 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_SCANNER_H__ -#define __G_SCANNER_H__ - -#include - -G_BEGIN_DECLS - -typedef struct _GScanner GScanner; -typedef struct _GScannerConfig GScannerConfig; -typedef union _GTokenValue GTokenValue; - -typedef void (*GScannerMsgFunc) (GScanner *scanner, - gchar *message, - gint error); - -/* GScanner: Flexible lexical scanner for general purpose. - */ - -/* Character sets */ -#define G_CSET_A_2_Z "ABCDEFGHIJKLMNOPQRSTUVWXYZ" -#define G_CSET_a_2_z "abcdefghijklmnopqrstuvwxyz" -#define G_CSET_DIGITS "0123456789" -#define G_CSET_LATINC "\300\301\302\303\304\305\306"\ - "\307\310\311\312\313\314\315\316\317\320"\ - "\321\322\323\324\325\326"\ - "\330\331\332\333\334\335\336" -#define G_CSET_LATINS "\337\340\341\342\343\344\345\346"\ - "\347\350\351\352\353\354\355\356\357\360"\ - "\361\362\363\364\365\366"\ - "\370\371\372\373\374\375\376\377" - -/* Error types */ -typedef enum -{ - G_ERR_UNKNOWN, - G_ERR_UNEXP_EOF, - G_ERR_UNEXP_EOF_IN_STRING, - G_ERR_UNEXP_EOF_IN_COMMENT, - G_ERR_NON_DIGIT_IN_CONST, - G_ERR_DIGIT_RADIX, - G_ERR_FLOAT_RADIX, - G_ERR_FLOAT_MALFORMED -} GErrorType; - -/* Token types */ -typedef enum -{ - G_TOKEN_EOF = 0, - - G_TOKEN_LEFT_PAREN = '(', - G_TOKEN_RIGHT_PAREN = ')', - G_TOKEN_LEFT_CURLY = '{', - G_TOKEN_RIGHT_CURLY = '}', - G_TOKEN_LEFT_BRACE = '[', - G_TOKEN_RIGHT_BRACE = ']', - G_TOKEN_EQUAL_SIGN = '=', - G_TOKEN_COMMA = ',', - - G_TOKEN_NONE = 256, - - G_TOKEN_ERROR, - - G_TOKEN_CHAR, - G_TOKEN_BINARY, - G_TOKEN_OCTAL, - G_TOKEN_INT, - G_TOKEN_HEX, - G_TOKEN_FLOAT, - G_TOKEN_STRING, - - G_TOKEN_SYMBOL, - G_TOKEN_IDENTIFIER, - G_TOKEN_IDENTIFIER_NULL, - - G_TOKEN_COMMENT_SINGLE, - G_TOKEN_COMMENT_MULTI, - G_TOKEN_LAST -} GTokenType; - -union _GTokenValue -{ - gpointer v_symbol; - gchar *v_identifier; - gulong v_binary; - gulong v_octal; - gulong v_int; - gdouble v_float; - gulong v_hex; - gchar *v_string; - gchar *v_comment; - guchar v_char; - guint v_error; -}; - -struct _GScannerConfig -{ - /* Character sets - */ - gchar *cset_skip_characters; /* default: " \t\n" */ - gchar *cset_identifier_first; - gchar *cset_identifier_nth; - gchar *cpair_comment_single; /* default: "#\n" */ - - /* Should symbol lookup work case sensitive? - */ - guint case_sensitive : 1; - - /* Boolean values to be adjusted "on the fly" - * to configure scanning behaviour. - */ - guint skip_comment_multi : 1; /* C like comment */ - guint skip_comment_single : 1; /* single line comment */ - guint scan_comment_multi : 1; /* scan multi line comments? */ - guint scan_identifier : 1; - guint scan_identifier_1char : 1; - guint scan_identifier_NULL : 1; - guint scan_symbols : 1; - guint scan_binary : 1; - guint scan_octal : 1; - guint scan_float : 1; - guint scan_hex : 1; /* `0x0ff0' */ - guint scan_hex_dollar : 1; /* `$0ff0' */ - guint scan_string_sq : 1; /* string: 'anything' */ - guint scan_string_dq : 1; /* string: "\\-escapes!\n" */ - guint numbers_2_int : 1; /* bin, octal, hex => int */ - guint int_2_float : 1; /* int => G_TOKEN_FLOAT? */ - guint identifier_2_string : 1; - guint char_2_token : 1; /* return G_TOKEN_CHAR? */ - guint symbol_2_token : 1; - guint scope_0_fallback : 1; /* try scope 0 on lookups? */ -}; - -struct _GScanner -{ - /* unused fields */ - gpointer user_data; - guint max_parse_errors; - - /* g_scanner_error() increments this field */ - guint parse_errors; - - /* name of input stream, featured by the default message handler */ - gchar const *input_name; - - /* data pointer for derived structures */ - gpointer derived_data; - - /* link into the scanner configuration */ - GScannerConfig *config; - - /* fields filled in after g_scanner_get_next_token() */ - GTokenType token; - GTokenValue value; - guint line; - guint position; - - /* fields filled in after g_scanner_peek_next_token() */ - GTokenType next_token; - GTokenValue next_value; - guint next_line; - guint next_position; - - /* to be considered private */ - GHashTable *symbol_table; - gint input_fd; - gchar const *text; - gchar const *text_end; - gchar *buffer; - guint scope_id; - - /* handler function for _warn and _error */ - GScannerMsgFunc msg_handler; -}; - -GScanner* g_scanner_new (GScannerConfig *config_templ); -void g_scanner_destroy (GScanner *scanner); -void g_scanner_input_file (GScanner *scanner, - gint input_fd); -void g_scanner_sync_file_offset (GScanner *scanner); -void g_scanner_input_text (GScanner *scanner, - const gchar *text, - guint text_len); -GTokenType g_scanner_get_next_token (GScanner *scanner); -GTokenType g_scanner_peek_next_token (GScanner *scanner); -GTokenType g_scanner_cur_token (GScanner *scanner); -GTokenValue g_scanner_cur_value (GScanner *scanner); -guint g_scanner_cur_line (GScanner *scanner); -guint g_scanner_cur_position (GScanner *scanner); -gboolean g_scanner_eof (GScanner *scanner); -guint g_scanner_set_scope (GScanner *scanner, - guint scope_id); -void g_scanner_scope_add_symbol (GScanner *scanner, - guint scope_id, - gchar const *symbol, - gpointer value); -void g_scanner_scope_remove_symbol (GScanner *scanner, - guint scope_id, - gchar const *symbol); -gpointer g_scanner_scope_lookup_symbol (GScanner *scanner, - guint scope_id, - gchar const *symbol); -void g_scanner_scope_foreach_symbol (GScanner *scanner, - guint scope_id, - GHFunc func, - gpointer user_data); -gpointer g_scanner_lookup_symbol (GScanner *scanner, - gchar const *symbol); -void g_scanner_unexp_token (GScanner *scanner, - GTokenType expected_token, - gchar const *identifier_spec, - gchar const *symbol_spec, - gchar const *symbol_name, - gchar const *message, - gint is_error); -void g_scanner_error (GScanner *scanner, - gchar const *format, - ...) G_GNUC_PRINTF (2,3); -void g_scanner_warn (GScanner *scanner, - gchar const *format, - ...) G_GNUC_PRINTF (2,3); -gint g_scanner_stat_mode (gchar const *filename); -/* keep downward source compatibility */ -#define g_scanner_add_symbol( scanner, symbol, value ) G_STMT_START { \ - g_scanner_scope_add_symbol ((scanner), 0, (symbol), (value)); \ -} G_STMT_END -#define g_scanner_remove_symbol( scanner, symbol ) G_STMT_START { \ - g_scanner_scope_remove_symbol ((scanner), 0, (symbol)); \ -} G_STMT_END -#define g_scanner_foreach_symbol( scanner, func, data ) G_STMT_START { \ - g_scanner_scope_foreach_symbol ((scanner), 0, (func), (data)); \ -} G_STMT_END - -/* The following two functions are deprecated and will be removed in - * the next major release. They do no good. */ -void g_scanner_freeze_symbol_table (GScanner *scanner); -void g_scanner_thaw_symbol_table (GScanner *scanner); - -G_END_DECLS - -#endif /* __G_SCANNER_H__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gshell.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gshell.h deleted file mode 100644 index 0ffd34afe2..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gshell.h +++ /dev/null @@ -1,53 +0,0 @@ -/* gshell.h - Shell-related utilities - * - * Copyright 2000 Red Hat, Inc. - * - * GLib is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * GLib is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with GLib; see the file COPYING.LIB. If not, write - * to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __G_SHELL_H__ -#define __G_SHELL_H__ - -#include - -G_BEGIN_DECLS - -#define G_SHELL_ERROR g_shell_error_quark () - -typedef enum -{ - /* mismatched or otherwise mangled quoting */ - G_SHELL_ERROR_BAD_QUOTING, - /* string to be parsed was empty */ - G_SHELL_ERROR_EMPTY_STRING, - G_SHELL_ERROR_FAILED -} GShellError; - -GQuark g_shell_error_quark (void); - -gchar* g_shell_quote (gchar const *unquoted_string); -gchar* g_shell_unquote (gchar const *quoted_string, - GError **error); -gboolean g_shell_parse_argv (gchar const *command_line, - gint *argcp, - gchar ***argvp, - GError **error); - -G_END_DECLS - -#endif /* __G_SHELL_H__ */ - - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gslist.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gslist.h deleted file mode 100644 index 446eab43ea..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gslist.h +++ /dev/null @@ -1,100 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_SLIST_H__ -#define __G_SLIST_H__ - -#include - -G_BEGIN_DECLS - -typedef struct _GSList GSList; - -struct _GSList -{ - gpointer data; - GSList *next; -}; - -/* Singly linked lists - */ -void g_slist_push_allocator (GAllocator *allocator); -void g_slist_pop_allocator (void); -GSList* g_slist_alloc (void); -void g_slist_free (GSList *list); -void g_slist_free_1 (GSList *list); -GSList* g_slist_append (GSList *list, - gpointer data); -GSList* g_slist_prepend (GSList *list, - gpointer data); -GSList* g_slist_insert (GSList *list, - gpointer data, - gint position); -GSList* g_slist_insert_sorted (GSList *list, - gpointer data, - GCompareFunc func); -GSList* g_slist_insert_before (GSList *slist, - GSList *sibling, - gpointer data); -GSList* g_slist_concat (GSList *list1, - GSList *list2); -GSList* g_slist_remove (GSList *list, - gconstpointer data); -GSList* g_slist_remove_link (GSList *list, - GSList *link); -GSList* g_slist_delete_link (GSList *list, - GSList *link); -GSList* g_slist_reverse (GSList *list); -GSList* g_slist_copy (GSList *list); -GSList* g_slist_nth (GSList *list, - guint n); -GSList* g_slist_find (GSList *list, - gconstpointer data); -GSList* g_slist_find_custom (GSList *list, - gconstpointer data, - GCompareFunc func); -gint g_slist_position (GSList *list, - GSList *llink); -gint g_slist_index (GSList *list, - gconstpointer data); -GSList* g_slist_last (GSList *list); -guint g_slist_length (GSList *list); -void g_slist_foreach (GSList *list, - GFunc func, - gpointer user_data); -GSList* g_slist_sort (GSList *list, - GCompareFunc compare_func); -GSList* g_slist_sort_with_data (GSList *list, - GCompareFuncData compare_func, - gpointer user_data); -gpointer g_slist_nth_data (GSList *list, - guint n); -#define g_slist_next(slist) ((slist) ? (((GSList *)(slist))->next) : NULL) - -G_END_DECLS - -#endif /* __G_SLIST_H__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gspawn.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gspawn.h deleted file mode 100644 index 44169d962c..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gspawn.h +++ /dev/null @@ -1,127 +0,0 @@ -/* gspawn.h - Process launching - * - * Copyright 2000 Red Hat, Inc. - * - * GLib is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * GLib is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with GLib; see the file COPYING.LIB. If not, write - * to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __G_SPAWN_H__ -#define __G_SPAWN_H__ - -#include - -G_BEGIN_DECLS - -/* I'm not sure I remember our proposed naming convention here. */ -#define G_SPAWN_ERROR g_spawn_error_quark () - -typedef enum -{ - G_SPAWN_ERROR_FORK, /* fork failed due to lack of memory */ - G_SPAWN_ERROR_READ, /* read or select on pipes failed */ - G_SPAWN_ERROR_CHDIR, /* changing to working dir failed */ - G_SPAWN_ERROR_ACCES, /* execv() returned EACCES */ - G_SPAWN_ERROR_PERM, /* execv() returned EPERM */ - G_SPAWN_ERROR_2BIG, /* execv() returned E2BIG */ - G_SPAWN_ERROR_NOEXEC, /* execv() returned ENOEXEC */ - G_SPAWN_ERROR_NAMETOOLONG, /* "" "" ENAMETOOLONG */ - G_SPAWN_ERROR_NOENT, /* "" "" ENOENT */ - G_SPAWN_ERROR_NOMEM, /* "" "" ENOMEM */ - G_SPAWN_ERROR_NOTDIR, /* "" "" ENOTDIR */ - G_SPAWN_ERROR_LOOP, /* "" "" ELOOP */ - G_SPAWN_ERROR_TXTBUSY, /* "" "" ETXTBUSY */ - G_SPAWN_ERROR_IO, /* "" "" EIO */ - G_SPAWN_ERROR_NFILE, /* "" "" ENFILE */ - G_SPAWN_ERROR_MFILE, /* "" "" EMFLE */ - G_SPAWN_ERROR_INVAL, /* "" "" EINVAL */ - G_SPAWN_ERROR_ISDIR, /* "" "" EISDIR */ - G_SPAWN_ERROR_LIBBAD, /* "" "" ELIBBAD */ - G_SPAWN_ERROR_FAILED /* other fatal failure, error->message - * should explain - */ -} GSpawnError; - -typedef void (* GSpawnChildSetupFunc) (gpointer user_data); - -typedef enum -{ - G_SPAWN_LEAVE_DESCRIPTORS_OPEN = 1 << 0, - G_SPAWN_DO_NOT_REAP_CHILD = 1 << 1, - /* look for argv[0] in the path i.e. use execvp() */ - G_SPAWN_SEARCH_PATH = 1 << 2, - /* Dump output to /dev/null */ - G_SPAWN_STDOUT_TO_DEV_NULL = 1 << 3, - G_SPAWN_STDERR_TO_DEV_NULL = 1 << 4, - G_SPAWN_CHILD_INHERITS_STDIN = 1 << 5 -} GSpawnFlags; - -GQuark g_spawn_error_quark (void); - -gboolean g_spawn_async (gchar const *working_directory, - gchar **argv, - gchar **envp, - GSpawnFlags flags, - GSpawnChildSetupFunc child_setup, - gpointer user_data, - gint *child_pid, - GError **error); - - -/* Opens pipes for non-NULL standard_output, standard_input, standard_error, - * and returns the parent's end of the pipes. - */ -gboolean g_spawn_async_with_pipes (gchar const *working_directory, - gchar **argv, - gchar **envp, - GSpawnFlags flags, - GSpawnChildSetupFunc child_setup, - gpointer user_data, - gint *child_pid, - gint *standard_input, - gint *standard_output, - gint *standard_error, - GError **error); - - -/* If standard_output or standard_error are non-NULL, the full - * standard output or error of the command will be placed there. - */ - -gboolean g_spawn_sync (gchar const *working_directory, - gchar **argv, - gchar **envp, - GSpawnFlags flags, - GSpawnChildSetupFunc child_setup, - gpointer user_data, - gchar **standard_output, - gchar **standard_error, - gint *exit_status, - GError **error); - -gboolean g_spawn_command_line_sync (gchar const *command_line, - gchar **standard_output, - gchar **standard_error, - gint *exit_status, - GError **error); -gboolean g_spawn_command_line_async (gchar const *command_line, - GError **error); - - -G_END_DECLS - -#endif /* __G_SPAWN_H__ */ - - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gstrfuncs.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gstrfuncs.h deleted file mode 100644 index b4f0a6fe73..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gstrfuncs.h +++ /dev/null @@ -1,124 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_STRFUNCS_H__ -#define __G_STRFUNCS_H__ - -#include -#include - -G_BEGIN_DECLS - -/* String utility functions that modify a string argument or - * return a constant string that must not be freed. - */ -#define G_STR_DELIMITERS "_-|> <." -gchar* g_strdelimit (gchar *string, - gchar const *delimiters, - gchar new_delimiter); -gchar* g_strcanon (gchar *string, - gchar const *valid_chars, - gchar subsitutor); -gdouble g_strtod (gchar const *nptr, - gchar **endptr); -gchar* g_strerror (gint errnum) G_GNUC_CONST; -gchar* g_strsignal (gint signum) G_GNUC_CONST; -gint g_strcasecmp (gchar const *s1, - gchar const *s2); -gint g_strncasecmp (gchar const *s1, - gchar const *s2, - guint n); -gchar* g_strdown (gchar *string); -gchar* g_strup (gchar *string); -gchar* g_strreverse (gchar *string); -gsize g_strlcpy (gchar *dest, - gchar const *src, - gsize dest_size); -gsize g_strlcat (gchar *dest, - gchar const *src, - gsize dest_size); -/* removes leading spaces */ -gchar* g_strchug (gchar *string); -/* removes trailing spaces */ -gchar* g_strchomp (gchar *string); -/* removes leading & trailing spaces */ -#define g_strstrip( string ) g_strchomp (g_strchug (string)) - -/* String utility functions that return a newly allocated string which - * ought to be freed with g_free from the caller at some point. - */ -gchar* g_strdup (gchar const *str); -gchar* g_strdup_printf (gchar const *format, - ...) G_GNUC_PRINTF (1, 2); -gchar* g_strdup_vprintf (gchar const *format, - va_list args); -gchar* g_strndup (gchar const *str, - guint n); -gchar* g_strnfill (guint length, - gchar fill_char); -gchar* g_strconcat (gchar const *string1, - ...); /* NULL terminated */ -gchar* g_strjoin (gchar const *separator, - ...); /* NULL terminated */ -/* Make a copy of a string interpreting C string -style escape - * sequences. Inverse of g_strescape. The recognized sequences are \b - * \f \n \r \t \\ \" and the octal format. - */ -gchar* g_strcompress (gchar const *source); - -/* Copy a string escaping nonprintable characters like in C strings. - * Inverse of g_strcompress. The exceptions parameter, if non-NULL, points - * to a string containing characters that are not to be escaped. - * - * Deprecated API: gchar* g_strescape (gchar const *source); - * Luckily this function wasn't used much, using NULL as second parameter - * provides mostly identical semantics. - */ -gchar* g_strescape (gchar const *source, - gchar const *exceptions); - -gpointer g_memdup (gconstpointer mem, - guint byte_size); - -/* NULL terminated string arrays. - * g_strsplit() splits up string into max_tokens tokens at delim and - * returns a newly allocated string array. - * g_strjoinv() concatenates all of str_array's strings, sliding in an - * optional separator, the returned string is newly allocated. - * g_strfreev() frees the array itself and all of its strings. - * g_strdupv() copies a NULL-terminated array of strings - */ -gchar** g_strsplit (gchar const *string, - gchar const *delimiter, - gint max_tokens); -gchar* g_strjoinv (gchar const *separator, - gchar **str_array); -void g_strfreev (gchar **str_array); -gchar** g_strdupv (gchar **str_array); - -G_END_DECLS - -#endif /* __G_STRFUNCS_H__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gstring.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gstring.h deleted file mode 100644 index 5cb18514ce..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gstring.h +++ /dev/null @@ -1,107 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_STRING_H__ -#define __G_STRING_H__ - -#include - -G_BEGIN_DECLS - -typedef struct _GString GString; -typedef struct _GStringChunk GStringChunk; - -struct _GString -{ - gchar *str; - gint len; -}; - -/* String Chunks - */ -GStringChunk* g_string_chunk_new (gint size); -void g_string_chunk_free (GStringChunk *chunk); -gchar* g_string_chunk_insert (GStringChunk *chunk, - gchar const *string); -gchar* g_string_chunk_insert_const (GStringChunk *chunk, - gchar const *string); - - -/* Strings - */ -GString* g_string_new (gchar const *init); -GString* g_string_new_len (gchar const *init, - gint len); -GString* g_string_sized_new (guint dfl_size); -gchar* g_string_free (GString *string, - gboolean free_segment); -gboolean g_string_equal (GString const *v, - GString const *v2); -guint g_string_hash (GString const *str); -GString* g_string_assign (GString *string, - gchar const *rval); -GString* g_string_truncate (GString *string, - guint len); -GString* g_string_insert_len (GString *string, - gint pos, - gchar const *val, - gint len); -GString* g_string_append (GString *string, - gchar const *val); -GString* g_string_append_len (GString *string, - gchar const *val, - gint len); -GString* g_string_append_c (GString *string, - gchar c); -GString* g_string_prepend (GString *string, - gchar const *val); -GString* g_string_prepend_c (GString *string, - gchar c); -GString* g_string_prepend_len (GString *string, - gchar const *val, - gint len); -GString* g_string_insert (GString *string, - gint pos, - gchar const *val); -GString* g_string_insert_c (GString *string, - gint pos, - gchar c); -GString* g_string_erase (GString *string, - gint pos, - gint len); -GString* g_string_down (GString *string); -GString* g_string_up (GString *string); -void g_string_sprintf (GString *string, - gchar const *format, - ...) G_GNUC_PRINTF (2, 3); -void g_string_sprintfa (GString *string, - gchar const *format, - ...) G_GNUC_PRINTF (2, 3); - -G_END_DECLS - -#endif /* __G_STRING_H__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gthread.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gthread.h deleted file mode 100644 index 12681784be..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gthread.h +++ /dev/null @@ -1,335 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_THREAD_H__ -#define __G_THREAD_H__ - -#include - -G_BEGIN_DECLS - -#ifndef GLIB_VAR -# ifdef G_OS_WIN32 -# ifdef GLIB_COMPILATION -# define GLIB_VAR __declspec(dllexport) -# else /* !GLIB_COMPILATION */ -# define GLIB_VAR extern __declspec(dllimport) -# endif /* !GLIB_COMPILATION */ -# else /* !G_OS_WIN32 */ -# define GLIB_VAR extern -# endif /* !G_OS_WIN32 */ -#endif /* GLIB_VAR */ - -/* GLib Thread support - */ - -extern GQuark g_thread_error_quark(); -#define G_THREAD_ERROR g_thread_error_quark() - -typedef enum -{ - G_THREAD_ERROR_AGAIN /* Resource temporarily unavailable */ -} GThreadError; - -typedef void (*GThreadFunc) (gpointer value); - -typedef enum -{ - G_THREAD_PRIORITY_LOW, - G_THREAD_PRIORITY_NORMAL, - G_THREAD_PRIORITY_HIGH, - G_THREAD_PRIORITY_URGENT -} GThreadPriority; - -typedef struct _GThread GThread; -struct _GThread -{ - GThreadPriority priority; - gboolean bound; - gboolean joinable; -}; - -typedef struct _GMutex GMutex; -typedef struct _GCond GCond; -typedef struct _GPrivate GPrivate; -typedef struct _GStaticPrivate GStaticPrivate; - -typedef struct _GThreadFunctions GThreadFunctions; -struct _GThreadFunctions -{ - GMutex* (*mutex_new) (void); - void (*mutex_lock) (GMutex *mutex); - gboolean (*mutex_trylock) (GMutex *mutex); - void (*mutex_unlock) (GMutex *mutex); - void (*mutex_free) (GMutex *mutex); - GCond* (*cond_new) (void); - void (*cond_signal) (GCond *cond); - void (*cond_broadcast) (GCond *cond); - void (*cond_wait) (GCond *cond, - GMutex *mutex); - gboolean (*cond_timed_wait) (GCond *cond, - GMutex *mutex, - GTimeVal *end_time); - void (*cond_free) (GCond *cond); - GPrivate* (*private_new) (GDestroyNotify destructor); - gpointer (*private_get) (GPrivate *private_key); - void (*private_set) (GPrivate *private_key, - gpointer data); - void (*thread_create) (GThreadFunc thread_func, - gpointer arg, - gulong stack_size, - gboolean joinable, - gboolean bound, - GThreadPriority priority, - gpointer thread, - GError **error); - void (*thread_yield) (void); - void (*thread_join) (gpointer thread); - void (*thread_exit) (void); - void (*thread_set_priority)(gpointer thread, - GThreadPriority priority); - void (*thread_self) (gpointer thread); -}; - -GLIB_VAR GThreadFunctions g_thread_functions_for_glib_use; -GLIB_VAR gboolean g_thread_use_default_impl; -GLIB_VAR gboolean g_threads_got_initialized; - -/* initializes the mutex/cond/private implementation for glib, might - * only be called once, and must not be called directly or indirectly - * from another glib-function, e.g. as a callback. - */ -void g_thread_init (GThreadFunctions *vtable); - -/* Errorcheck mutexes. If you define G_ERRORCHECK_MUTEXES, then all - * mutexes will check for re-locking and re-unlocking */ - -/* Initialize thread system with errorcheck mutexes. vtable must be - * NULL. Do not call directly. Use #define G_ERRORCHECK_MUTEXES - * instead. - */ -void g_thread_init_with_errorcheck_mutexes (GThreadFunctions* vtable); - -/* A random number to recognize debug calls to g_mutex_... */ -#define G_MUTEX_DEBUG_MAGIC 0xf8e18ad7 - -#ifdef G_ERRORCHECK_MUTEXES -#define g_thread_init(vtable) g_thread_init_with_errorcheck_mutexes (vtable) -#endif - -/* internal function for fallback static mutex implementation */ -GMutex* g_static_mutex_get_mutex_impl (GMutex **mutex); - -/* shorthands for conditional and unconditional function calls */ - -#define G_THREAD_UF(op, arglist) \ - (*g_thread_functions_for_glib_use . op) arglist -#define G_THREAD_CF(op, fail, arg) \ - (g_thread_supported () ? G_THREAD_UF (op, arg) : (fail)) -#define G_THREAD_ECF(op, fail, mutex, type) \ - (g_thread_supported () ? ((type(*)(GMutex*, gulong, gchar*)) \ - (*g_thread_functions_for_glib_use . op)) \ - (mutex, G_MUTEX_DEBUG_MAGIC, G_STRLOC) : (fail)) - -#ifndef G_ERRORCHECK_MUTEXES -# define g_mutex_lock(mutex) \ - G_THREAD_CF (mutex_lock, (void)0, (mutex)) -# define g_mutex_trylock(mutex) \ - G_THREAD_CF (mutex_trylock, TRUE, (mutex)) -# define g_mutex_unlock(mutex) \ - G_THREAD_CF (mutex_unlock, (void)0, (mutex)) -# define g_cond_wait(cond, mutex) \ - G_THREAD_CF (cond_wait, (void)0, (cond, mutex)) -# define g_cond_timed_wait(cond, mutex, abs_time) \ - G_THREAD_CF (cond_timed_wait, TRUE, (cond, mutex, abs_time)) -#else /* G_ERRORCHECK_MUTEXES */ -# define g_mutex_lock(mutex) \ - G_THREAD_ECF (mutex_lock, (void)0, mutex, void) -# define g_mutex_trylock(mutex) \ - G_THREAD_ECF (mutex_trylock, TRUE, mutex, gboolean) -# define g_mutex_unlock(mutex) \ - G_THREAD_ECF (mutex_unlock, (void)0, mutex, void) -# define g_cond_wait(cond, mutex) \ - (g_thread_supported () ? ((void(*)(GCond*, GMutex*, gulong, gchar*))\ - g_thread_functions_for_glib_use.cond_wait) \ - (cond, mutex, G_MUTEX_DEBUG_MAGIC, G_STRLOC) : (void) 0) -# define g_cond_timed_wait(cond, mutex, abs_time) \ - (g_thread_supported () ? \ - ((gboolean(*)(GCond*, GMutex*, GTimeVal*, gulong, gchar*)) \ - g_thread_functions_for_glib_use.cond_timed_wait) \ - (cond, mutex, abs_time, G_MUTEX_DEBUG_MAGIC, G_STRLOC) : TRUE) -#endif /* G_ERRORCHECK_MUTEXES */ - -#define g_thread_supported() (g_threads_got_initialized) -#define g_mutex_new() G_THREAD_UF (mutex_new, ()) -#define g_mutex_free(mutex) G_THREAD_CF (mutex_free, (void)0, (mutex)) -#define g_cond_new() G_THREAD_UF (cond_new, ()) -#define g_cond_signal(cond) G_THREAD_CF (cond_signal, (void)0, (cond)) -#define g_cond_broadcast(cond) G_THREAD_CF (cond_broadcast, (void)0, (cond)) -#define g_cond_free(cond) G_THREAD_CF (cond_free, (void)0, (cond)) -#define g_private_new(destructor) G_THREAD_UF (private_new, (destructor)) -#define g_private_get(private_key) G_THREAD_CF (private_get, \ - ((gpointer)private_key), \ - (private_key)) -#define g_private_set(private_key, value) G_THREAD_CF (private_set, \ - (void) (private_key = \ - (GPrivate*) (value)), \ - (private_key, value)) -#define g_thread_yield() G_THREAD_CF (thread_yield, (void)0, ()) -#define g_thread_exit() G_THREAD_CF (thread_exit, (void)0, ()) - -GThread* g_thread_create (GThreadFunc thread_func, - gpointer arg, - gulong stack_size, - gboolean joinable, - gboolean bound, - GThreadPriority priority, - GError **error); -GThread* g_thread_self (void); -void g_thread_join (GThread *thread); -void g_thread_set_priority (GThread *thread, - GThreadPriority priority); - -/* GStaticMutexes can be statically initialized with the value - * G_STATIC_MUTEX_INIT, and then they can directly be used, that is - * much easier, than having to explicitly allocate the mutex before - * use - */ -#define g_static_mutex_lock(mutex) \ - g_mutex_lock (g_static_mutex_get_mutex (mutex)) -#define g_static_mutex_trylock(mutex) \ - g_mutex_trylock (g_static_mutex_get_mutex (mutex)) -#define g_static_mutex_unlock(mutex) \ - g_mutex_unlock (g_static_mutex_get_mutex (mutex)) - -struct _GStaticPrivate -{ - guint index; -}; -#define G_STATIC_PRIVATE_INIT { 0 } -gpointer g_static_private_get (GStaticPrivate *private_key); -void g_static_private_set (GStaticPrivate *private_key, - gpointer data, - GDestroyNotify notify); -gpointer g_static_private_get_for_thread (GStaticPrivate *private_key, - GThread *thread); -void g_static_private_set_for_thread (GStaticPrivate *private_key, - GThread *thread, - gpointer data, - GDestroyNotify notify); - -typedef struct _GStaticRecMutex GStaticRecMutex; -struct _GStaticRecMutex -{ - GStaticMutex mutex; - unsigned int depth; - GSystemThread owner; -}; - -#define G_STATIC_REC_MUTEX_INIT { G_STATIC_MUTEX_INIT } -void g_static_rec_mutex_lock (GStaticRecMutex *mutex); -gboolean g_static_rec_mutex_trylock (GStaticRecMutex *mutex); -void g_static_rec_mutex_unlock (GStaticRecMutex *mutex); -void g_static_rec_mutex_lock_full (GStaticRecMutex *mutex, - guint depth); -guint g_static_rec_mutex_unlock_full (GStaticRecMutex *mutex); - -typedef struct _GStaticRWLock GStaticRWLock; -struct _GStaticRWLock -{ - GStaticMutex mutex; - GCond *read_cond; - GCond *write_cond; - guint read_counter; - gboolean write; - guint want_to_write; -}; - -#define G_STATIC_RW_LOCK_INIT { G_STATIC_MUTEX_INIT, NULL, NULL, 0, FALSE, FALSE } - -void g_static_rw_lock_reader_lock (GStaticRWLock* lock); -gboolean g_static_rw_lock_reader_trylock (GStaticRWLock* lock); -void g_static_rw_lock_reader_unlock (GStaticRWLock* lock); -void g_static_rw_lock_writer_lock (GStaticRWLock* lock); -gboolean g_static_rw_lock_writer_trylock (GStaticRWLock* lock); -void g_static_rw_lock_writer_unlock (GStaticRWLock* lock); -void g_static_rw_lock_free (GStaticRWLock* lock); - -/* these are some convenience macros that expand to nothing if GLib - * was configured with --disable-threads. for using StaticMutexes, - * you define them with G_LOCK_DEFINE_STATIC (name) or G_LOCK_DEFINE (name) - * if you need to export the mutex. With G_LOCK_EXTERN (name) you can - * declare such an globally defined lock. name is a unique identifier - * for the protected varibale or code portion. locking, testing and - * unlocking of such mutexes can be done with G_LOCK(), G_UNLOCK() and - * G_TRYLOCK() respectively. - */ -extern void glib_dummy_decl (void); -#define G_LOCK_NAME(name) g__ ## name ## _lock -#ifdef G_THREADS_ENABLED -# define G_LOCK_DEFINE_STATIC(name) static G_LOCK_DEFINE (name) -# define G_LOCK_DEFINE(name) \ - GStaticMutex G_LOCK_NAME (name) = G_STATIC_MUTEX_INIT -# define G_LOCK_EXTERN(name) extern GStaticMutex G_LOCK_NAME (name) - -# ifdef G_DEBUG_LOCKS -# define G_LOCK(name) G_STMT_START{ \ - g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ - "file %s: line %d (%s): locking: %s ", \ - __FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION, \ - #name); \ - g_static_mutex_lock (&G_LOCK_NAME (name)); \ - }G_STMT_END -# define G_UNLOCK(name) G_STMT_START{ \ - g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ - "file %s: line %d (%s): unlocking: %s ", \ - __FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION, \ - #name); \ - g_static_mutex_unlock (&G_LOCK_NAME (name)); \ - }G_STMT_END -# define G_TRYLOCK(name) \ - (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ - "file %s: line %d (%s): try locking: %s ", \ - __FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION, \ - #name), g_static_mutex_trylock (&G_LOCK_NAME (name))) -# else /* !G_DEBUG_LOCKS */ -# define G_LOCK(name) g_static_mutex_lock (&G_LOCK_NAME (name)) -# define G_UNLOCK(name) g_static_mutex_unlock (&G_LOCK_NAME (name)) -# define G_TRYLOCK(name) g_static_mutex_trylock (&G_LOCK_NAME (name)) -# endif /* !G_DEBUG_LOCKS */ -#else /* !G_THREADS_ENABLED */ -# define G_LOCK_DEFINE_STATIC(name) extern void glib_dummy_decl (void) -# define G_LOCK_DEFINE(name) extern void glib_dummy_decl (void) -# define G_LOCK_EXTERN(name) extern void glib_dummy_decl (void) -# define G_LOCK(name) -# define G_UNLOCK(name) -# define G_TRYLOCK(name) (TRUE) -#endif /* !G_THREADS_ENABLED */ - -G_END_DECLS - -#endif /* __G_THREAD_H__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gthreadpool.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gthreadpool.h deleted file mode 100644 index d6fa87c8a9..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gthreadpool.h +++ /dev/null @@ -1,108 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_THREADPOOL_H__ -#define __G_THREADPOOL_H__ - -#include - -G_BEGIN_DECLS - -typedef struct _GThreadPool GThreadPool; - -/* Thread Pools - */ - -/* The real GThreadPool is bigger, so you may only create a thread - * pool with the constructor function */ -struct _GThreadPool -{ - GFunc thread_func; - gulong stack_size; - gboolean bound; - GThreadPriority priority; - gboolean exclusive; - gpointer user_data; -}; - -/* Get a thread pool with the function thread_func, at most max_threads may - * run at a time (max_threads == -1 means no limit), stack_size, bound, - * priority like in g_thread_create, exclusive == TRUE means, that the threads - * shouldn't be shared and that they will be prestarted (otherwise they are - * started, as needed) user_data is the 2nd argument to the thread_func */ -GThreadPool* g_thread_pool_new (GFunc thread_func, - gint max_threads, - gulong stack_size, - gboolean bound, - GThreadPriority priority, - gboolean exclusive, - gpointer user_data, - GError **error); - -/* Push new data into the thread pool. This task is assigned to a thread later - * (when the maximal number of threads is reached for that pool) or now - * (otherwise). If necessary a new thread will be started. The function - * returns immediatly */ -void g_thread_pool_push (GThreadPool *pool, - gpointer data, - GError **error); - -/* Set the number of threads, which can run concurrently for that pool, -1 - * means no limit. 0 means has the effect, that the pool won't process - * requests until the limit is set higher again */ -void g_thread_pool_set_max_threads (GThreadPool *pool, - gint max_threads, - GError **error); -gint g_thread_pool_get_max_threads (GThreadPool *pool); - -/* Get the number of threads assigned to that pool. This number doesn't - * necessarily represent the number of working threads in that pool */ -guint g_thread_pool_get_num_threads (GThreadPool *pool); - -/* Get the number of unprocessed items in the pool */ -guint g_thread_pool_unprocessed (GThreadPool *pool); - -/* Free the pool, immediate means, that all unprocessed items in the queue - * wont be processed, wait means, that the function doesn't return immediatly, - * but after all threads in the pool are ready processing items. immediate - * does however not mean, that threads are killed. */ -void g_thread_pool_free (GThreadPool *pool, - gboolean immediate, - gboolean wait); - -/* Set the maximal number of unused threads before threads will be stopped by - * GLib, -1 means no limit */ -void g_thread_pool_set_max_unused_threads (gint max_threads); -gint g_thread_pool_get_max_unused_threads (void); -guint g_thread_pool_get_num_unused_threads (void); - -/* Stop all currently unused threads, but leave the limit untouched */ -void g_thread_pool_stop_unused_threads (void); - -G_END_DECLS - -#endif /* __G_THREADPOOL_H__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gtimer.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gtimer.h deleted file mode 100644 index 533a778f19..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gtimer.h +++ /dev/null @@ -1,53 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_TIMER_H__ -#define __G_TIMER_H__ - -#include - -G_BEGIN_DECLS - -/* Timer - */ - -/* microseconds per second */ -typedef struct _GTimer GTimer; - -#define G_USEC_PER_SEC 1000000 - -GTimer* g_timer_new (void); -void g_timer_destroy (GTimer *timer); -void g_timer_start (GTimer *timer); -void g_timer_stop (GTimer *timer); -void g_timer_reset (GTimer *timer); -gdouble g_timer_elapsed (GTimer *timer, - gulong *microseconds); -void g_usleep (gulong microseconds); - -G_END_DECLS - -#endif /* __G_TIMER_H__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gtree.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gtree.h deleted file mode 100644 index 3530a6374b..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gtree.h +++ /dev/null @@ -1,68 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_TREE_H__ -#define __G_TREE_H__ - -#include - -G_BEGIN_DECLS - -typedef struct _GTree GTree; - -typedef gint (*GTraverseFunc) (gpointer key, - gpointer value, - gpointer data); - -/* Balanced binary trees - */ -GTree* g_tree_new (GCompareFunc key_compare_func); -GTree* g_tree_new_with_data (GCompareFuncData key_compare_func, - gpointer user_data); -void g_tree_destroy (GTree *tree); -void g_tree_insert (GTree *tree, - gpointer key, - gpointer value); -void g_tree_remove (GTree *tree, - gconstpointer key); -gpointer g_tree_lookup (GTree *tree, - gconstpointer key); -void g_tree_traverse (GTree *tree, - GTraverseFunc traverse_func, - GTraverseType traverse_type, - gpointer data); -gpointer g_tree_search (GTree *tree, - GCompareFunc search_func, - gconstpointer data); -gint g_tree_height (GTree *tree); -gint g_tree_nnodes (GTree *tree); - - - -G_END_DECLS - -#endif /* __G_TREE_H__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gtypes.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gtypes.h deleted file mode 100644 index 0c4e2c449c..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gtypes.h +++ /dev/null @@ -1,328 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_TYPES_H__ -#define __G_TYPES_H__ - -#include - -G_BEGIN_DECLS - -/* Provide type definitions for commonly used types. - * These are useful because a "gint8" can be adjusted - * to be 1 byte (8 bits) on all platforms. Similarly and - * more importantly, "gint32" can be adjusted to be - * 4 bytes (32 bits) on all platforms. - */ - -typedef char gchar; -typedef short gshort; -typedef long glong; -typedef int gint; -typedef gint gboolean; -typedef gchar* gstring; - -typedef unsigned char guchar; -typedef unsigned short gushort; -typedef unsigned long gulong; -typedef unsigned int guint; - -typedef float gfloat; -typedef double gdouble; - -/* HAVE_LONG_DOUBLE doesn't work correctly on all platforms. - * Since gldouble isn't used anywhere, just disable it for now */ - -#if 0 -#ifdef HAVE_LONG_DOUBLE -typedef long double gldouble; -#else /* HAVE_LONG_DOUBLE */ -typedef double gldouble; -#endif /* HAVE_LONG_DOUBLE */ -#endif /* 0 */ - -typedef void* gpointer; -typedef void const *gconstpointer; - -typedef gint (*GCompareFunc) (gconstpointer a, - gconstpointer b); -typedef gint (*GCompareFuncData) (gconstpointer a, - gconstpointer b, - gpointer user_data); -typedef gboolean (*GEqualFunc) (gconstpointer a, - gconstpointer b); -typedef void (*GDestroyNotify) (gpointer data); -typedef void (*GFunc) (gpointer data, - gpointer user_data); -typedef guint (*GHashFunc) (gconstpointer key); -typedef void (*GHFunc) (gpointer key, - gpointer value, - gpointer user_data); -typedef void (*GFreeFunc) (gpointer data); - -/* Define some mathematical constants that aren't available - * symbolically in some strict ISO C implementations. - */ -#define G_E 2.7182818284590452354E0 -#define G_LN2 6.9314718055994530942E-1 -#define G_LN10 2.3025850929940456840E0 -#define G_PI 3.14159265358979323846E0 -#define G_PI_2 1.57079632679489661923E0 -#define G_PI_4 0.78539816339744830962E0 -#define G_SQRT2 1.4142135623730950488E0 - -/* Portable endian checks and conversions - * - * glibconfig.h defines G_BYTE_ORDER which expands to one of - * the below macros. - */ -#define G_LITTLE_ENDIAN 1234 -#define G_BIG_ENDIAN 4321 -#define G_PDP_ENDIAN 3412 /* unused, need specific PDP check */ - - -/* Basic bit swapping functions - */ -#define GUINT16_SWAP_LE_BE_CONSTANT(val) ((guint16) ( \ - (((guint16) (val) & (guint16) 0x00ffU) << 8) | \ - (((guint16) (val) & (guint16) 0xff00U) >> 8))) -#define GUINT32_SWAP_LE_BE_CONSTANT(val) ((guint32) ( \ - (((guint32) (val) & (guint32) 0x000000ffU) << 24) | \ - (((guint32) (val) & (guint32) 0x0000ff00U) << 8) | \ - (((guint32) (val) & (guint32) 0x00ff0000U) >> 8) | \ - (((guint32) (val) & (guint32) 0xff000000U) >> 24))) - -/* Intel specific stuff for speed - */ -#if defined (__i386__) && defined (__GNUC__) && __GNUC__ >= 2 -# define GUINT16_SWAP_LE_BE_X86(val) \ - (__extension__ \ - ({ register guint16 __v; \ - if (__builtin_constant_p (val)) \ - __v = GUINT16_SWAP_LE_BE_CONSTANT (val); \ - else \ - __asm__ __const__ ("rorw $8, %w0" \ - : "=r" (__v) \ - : "0" ((guint16) (val))); \ - __v; })) -# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_X86 (val)) -# if !defined(__i486__) && !defined(__i586__) \ - && !defined(__pentium__) && !defined(__i686__) && !defined(__pentiumpro__) -# define GUINT32_SWAP_LE_BE_X86(val) \ - (__extension__ \ - ({ register guint32 __v; \ - if (__builtin_constant_p (val)) \ - __v = GUINT32_SWAP_LE_BE_CONSTANT (val); \ - else \ - __asm__ __const__ ("rorw $8, %w0\n\t" \ - "rorl $16, %0\n\t" \ - "rorw $8, %w0" \ - : "=r" (__v) \ - : "0" ((guint32) (val))); \ - __v; })) -# else /* 486 and higher has bswap */ -# define GUINT32_SWAP_LE_BE_X86(val) \ - (__extension__ \ - ({ register guint32 __v; \ - if (__builtin_constant_p (val)) \ - __v = GUINT32_SWAP_LE_BE_CONSTANT (val); \ - else \ - __asm__ __const__ ("bswap %0" \ - : "=r" (__v) \ - : "0" ((guint32) (val))); \ - __v; })) -# endif /* processor specific 32-bit stuff */ -# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_X86 (val)) -#else /* !__i386__ */ -# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val)) -# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val)) -#endif /* __i386__ */ - -#ifdef G_HAVE_GINT64 -# define GUINT64_SWAP_LE_BE_CONSTANT(val) ((guint64) ( \ - (((guint64) (val) & \ - (guint64) G_GINT64_CONSTANT(0x00000000000000ffU)) << 56) | \ - (((guint64) (val) & \ - (guint64) G_GINT64_CONSTANT(0x000000000000ff00U)) << 40) | \ - (((guint64) (val) & \ - (guint64) G_GINT64_CONSTANT(0x0000000000ff0000U)) << 24) | \ - (((guint64) (val) & \ - (guint64) G_GINT64_CONSTANT(0x00000000ff000000U)) << 8) | \ - (((guint64) (val) & \ - (guint64) G_GINT64_CONSTANT(0x000000ff00000000U)) >> 8) | \ - (((guint64) (val) & \ - (guint64) G_GINT64_CONSTANT(0x0000ff0000000000U)) >> 24) | \ - (((guint64) (val) & \ - (guint64) G_GINT64_CONSTANT(0x00ff000000000000U)) >> 40) | \ - (((guint64) (val) & \ - (guint64) G_GINT64_CONSTANT(0xff00000000000000U)) >> 56))) -# if defined (__i386__) && defined (__GNUC__) && __GNUC__ >= 2 -# define GUINT64_SWAP_LE_BE_X86(val) \ - (__extension__ \ - ({ union { guint64 __ll; \ - guint32 __l[2]; } __r; \ - if (__builtin_constant_p (val)) \ - __r.__ll = GUINT64_SWAP_LE_BE_CONSTANT (val); \ - else \ - { \ - union { guint64 __ll; \ - guint32 __l[2]; } __w; \ - __w.__ll = ((guint64) val); \ - __r.__l[0] = GUINT32_SWAP_LE_BE (__w.__l[1]); \ - __r.__l[1] = GUINT32_SWAP_LE_BE (__w.__l[0]); \ - } \ - __r.__ll; })) -# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_X86 (val)) -# else /* !__i386__ */ -# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT(val)) -# endif -#endif - -#define GUINT16_SWAP_LE_PDP(val) ((guint16) (val)) -#define GUINT16_SWAP_BE_PDP(val) (GUINT16_SWAP_LE_BE (val)) -#define GUINT32_SWAP_LE_PDP(val) ((guint32) ( \ - (((guint32) (val) & (guint32) 0x0000ffffU) << 16) | \ - (((guint32) (val) & (guint32) 0xffff0000U) >> 16))) -#define GUINT32_SWAP_BE_PDP(val) ((guint32) ( \ - (((guint32) (val) & (guint32) 0x00ff00ffU) << 8) | \ - (((guint32) (val) & (guint32) 0xff00ff00U) >> 8))) - -/* The G*_TO_?E() macros are defined in glibconfig.h. - * The transformation is symmetric, so the FROM just maps to the TO. - */ -#define GINT16_FROM_LE(val) (GINT16_TO_LE (val)) -#define GUINT16_FROM_LE(val) (GUINT16_TO_LE (val)) -#define GINT16_FROM_BE(val) (GINT16_TO_BE (val)) -#define GUINT16_FROM_BE(val) (GUINT16_TO_BE (val)) -#define GINT32_FROM_LE(val) (GINT32_TO_LE (val)) -#define GUINT32_FROM_LE(val) (GUINT32_TO_LE (val)) -#define GINT32_FROM_BE(val) (GINT32_TO_BE (val)) -#define GUINT32_FROM_BE(val) (GUINT32_TO_BE (val)) - -#ifdef G_HAVE_GINT64 -#define GINT64_FROM_LE(val) (GINT64_TO_LE (val)) -#define GUINT64_FROM_LE(val) (GUINT64_TO_LE (val)) -#define GINT64_FROM_BE(val) (GINT64_TO_BE (val)) -#define GUINT64_FROM_BE(val) (GUINT64_TO_BE (val)) -#endif - -#define GLONG_FROM_LE(val) (GLONG_TO_LE (val)) -#define GULONG_FROM_LE(val) (GULONG_TO_LE (val)) -#define GLONG_FROM_BE(val) (GLONG_TO_BE (val)) -#define GULONG_FROM_BE(val) (GULONG_TO_BE (val)) - -#define GINT_FROM_LE(val) (GINT_TO_LE (val)) -#define GUINT_FROM_LE(val) (GUINT_TO_LE (val)) -#define GINT_FROM_BE(val) (GINT_TO_BE (val)) -#define GUINT_FROM_BE(val) (GUINT_TO_BE (val)) - - -/* Portable versions of host-network order stuff - */ -#define g_ntohl(val) (GUINT32_FROM_BE (val)) -#define g_ntohs(val) (GUINT16_FROM_BE (val)) -#define g_htonl(val) (GUINT32_TO_BE (val)) -#define g_htons(val) (GUINT16_TO_BE (val)) - -/* IEEE Standard 754 Single Precision Storage Format (gfloat): - * - * 31 30 23 22 0 - * +--------+---------------+---------------+ - * | s 1bit | e[30:23] 8bit | f[22:0] 23bit | - * +--------+---------------+---------------+ - * B0------------------->B1------->B2-->B3--> - * - * IEEE Standard 754 Double Precision Storage Format (gdouble): - * - * 63 62 52 51 32 31 0 - * +--------+----------------+----------------+ +---------------+ - * | s 1bit | e[62:52] 11bit | f[51:32] 20bit | | f[31:0] 32bit | - * +--------+----------------+----------------+ +---------------+ - * B0--------------->B1---------->B2--->B3----> B4->B5->B6->B7-> - */ -/* subtract from biased_exponent to form base2 exponent (normal numbers) */ -typedef union _GDoubleIEEE754 GDoubleIEEE754; -typedef union _GFloatIEEE754 GFloatIEEE754; -#define G_IEEE754_FLOAT_BIAS (127) -#define G_IEEE754_DOUBLE_BIAS (1023) -/* multiply with base2 exponent to get base10 exponent (nomal numbers) */ -#define G_LOG_2_BASE_10 (0.30102999566398119521) -#if G_BYTE_ORDER == G_LITTLE_ENDIAN -union _GFloatIEEE754 -{ - gfloat v_float; - struct { - guint mantissa : 23; - guint biased_exponent : 8; - guint sign : 1; - } mpn; -}; -union _GDoubleIEEE754 -{ - gdouble v_double; - struct { - guint mantissa_low : 32; - guint mantissa_high : 20; - guint biased_exponent : 11; - guint sign : 1; - } mpn; -}; -#elif G_BYTE_ORDER == G_BIG_ENDIAN -union _GFloatIEEE754 -{ - gfloat v_float; - struct { - guint sign : 1; - guint biased_exponent : 8; - guint mantissa : 23; - } mpn; -}; -union _GDoubleIEEE754 -{ - gdouble v_double; - struct { - guint sign : 1; - guint biased_exponent : 11; - guint mantissa_high : 20; - guint mantissa_low : 32; - } mpn; -}; -#else /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */ -#error unknown ENDIAN type -#endif /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */ - -typedef struct _GTimeVal GTimeVal; - -struct _GTimeVal -{ - glong tv_sec; - glong tv_usec; -}; - -G_END_DECLS - -#endif /* __G_TYPES_H__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gunicode.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gunicode.h deleted file mode 100644 index 3853e149f2..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gunicode.h +++ /dev/null @@ -1,239 +0,0 @@ -/* gunicode.h - Unicode manipulation functions - * - * Copyright (C) 1999, 2000 Tom Tromey - * Copyright 2000 Red Hat, Inc. - * - * The Gnome Library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * The Gnome Library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the Gnome Library; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __G_UNICODE_H__ -#define __G_UNICODE_H__ - -#include /* For size_t */ -#include - -G_BEGIN_DECLS - -typedef guint32 gunichar; -typedef guint16 gunichar2; - -/* These are the possible character classifications. - * See http://www.unicode.org/Public/UNIDATA/UnicodeData.html - */ -typedef enum -{ - G_UNICODE_CONTROL, - G_UNICODE_FORMAT, - G_UNICODE_UNASSIGNED, - G_UNICODE_PRIVATE_USE, - G_UNICODE_SURROGATE, - G_UNICODE_LOWERCASE_LETTER, - G_UNICODE_MODIFIER_LETTER, - G_UNICODE_OTHER_LETTER, - G_UNICODE_TITLECASE_LETTER, - G_UNICODE_UPPERCASE_LETTER, - G_UNICODE_COMBINING_MARK, - G_UNICODE_ENCLOSING_MARK, - G_UNICODE_NON_SPACING_MARK, - G_UNICODE_DECIMAL_NUMBER, - G_UNICODE_LETTER_NUMBER, - G_UNICODE_OTHER_NUMBER, - G_UNICODE_CONNECT_PUNCTUATION, - G_UNICODE_DASH_PUNCTUATION, - G_UNICODE_CLOSE_PUNCTUATION, - G_UNICODE_FINAL_PUNCTUATION, - G_UNICODE_INITIAL_PUNCTUATION, - G_UNICODE_OTHER_PUNCTUATION, - G_UNICODE_OPEN_PUNCTUATION, - G_UNICODE_CURRENCY_SYMBOL, - G_UNICODE_MODIFIER_SYMBOL, - G_UNICODE_MATH_SYMBOL, - G_UNICODE_OTHER_SYMBOL, - G_UNICODE_LINE_SEPARATOR, - G_UNICODE_PARAGRAPH_SEPARATOR, - G_UNICODE_SPACE_SEPARATOR -} GUnicodeType; - -/* These are the possible line break classifications. - * See http://www.unicode.org/unicode/reports/tr14/ - */ -typedef enum -{ - G_UNICODE_BREAK_MANDATORY, - G_UNICODE_BREAK_CARRIAGE_RETURN, - G_UNICODE_BREAK_LINE_FEED, - G_UNICODE_BREAK_COMBINING_MARK, - G_UNICODE_BREAK_SURROGATE, - G_UNICODE_BREAK_ZERO_WIDTH_SPACE, - G_UNICODE_BREAK_INSEPARABLE, - G_UNICODE_BREAK_NON_BREAKING_GLUE, - G_UNICODE_BREAK_CONTINGENT, - G_UNICODE_BREAK_SPACE, - G_UNICODE_BREAK_AFTER, - G_UNICODE_BREAK_BEFORE, - G_UNICODE_BREAK_BEFORE_AND_AFTER, - G_UNICODE_BREAK_HYPHEN, - G_UNICODE_BREAK_NON_STARTER, - G_UNICODE_BREAK_OPEN_PUNCTUATION, - G_UNICODE_BREAK_CLOSE_PUNCTUATION, - G_UNICODE_BREAK_QUOTATION, - G_UNICODE_BREAK_EXCLAMATION, - G_UNICODE_BREAK_IDEOGRAPHIC, - G_UNICODE_BREAK_NUMERIC, - G_UNICODE_BREAK_INFIX_SEPARATOR, - G_UNICODE_BREAK_SYMBOL, - G_UNICODE_BREAK_ALPHABETIC, - G_UNICODE_BREAK_PREFIX, - G_UNICODE_BREAK_POSTFIX, - G_UNICODE_BREAK_COMPLEX_CONTEXT, - G_UNICODE_BREAK_AMBIGUOUS, - G_UNICODE_BREAK_UNKNOWN -} GUnicodeBreakType; - -/* Returns TRUE if current locale uses UTF-8 charset. If CHARSET is - * not null, sets *CHARSET to the name of the current locale's - * charset. This value is statically allocated, and should be copied - * in case the locale's charset will be changed later using setlocale() - * or in some other way. - */ -gboolean g_get_charset (char **charset); - -/* These are all analogs of the functions. - */ -gboolean g_unichar_isalnum (gunichar c) G_GNUC_CONST; -gboolean g_unichar_isalpha (gunichar c) G_GNUC_CONST; -gboolean g_unichar_iscntrl (gunichar c) G_GNUC_CONST; -gboolean g_unichar_isdigit (gunichar c) G_GNUC_CONST; -gboolean g_unichar_isgraph (gunichar c) G_GNUC_CONST; -gboolean g_unichar_islower (gunichar c) G_GNUC_CONST; -gboolean g_unichar_isprint (gunichar c) G_GNUC_CONST; -gboolean g_unichar_ispunct (gunichar c) G_GNUC_CONST; -gboolean g_unichar_isspace (gunichar c) G_GNUC_CONST; -gboolean g_unichar_isupper (gunichar c) G_GNUC_CONST; -gboolean g_unichar_isxdigit (gunichar c) G_GNUC_CONST; -gboolean g_unichar_istitle (gunichar c) G_GNUC_CONST; -gboolean g_unichar_isdefined (gunichar c) G_GNUC_CONST; -gboolean g_unichar_iswide (gunichar c) G_GNUC_CONST; - -/* More functions. These convert between the three cases. - * See the Unicode book to understand title case. */ -gunichar g_unichar_toupper (gunichar c) G_GNUC_CONST; -gunichar g_unichar_tolower (gunichar c) G_GNUC_CONST; -gunichar g_unichar_totitle (gunichar c) G_GNUC_CONST; - -/* If C is a digit (according to `g_unichar_isdigit'), then return its - numeric value. Otherwise return -1. */ -gint g_unichar_digit_value (gunichar c) G_GNUC_CONST; - -gint g_unichar_xdigit_value (gunichar c) G_GNUC_CONST; - -/* Return the Unicode character type of a given character. */ -GUnicodeType g_unichar_type (gunichar c) G_GNUC_CONST; - -/* Return the line break property for a given character */ -GUnicodeBreakType g_unichar_break_type (gunichar c) G_GNUC_CONST; - - -/* Compute canonical ordering of a string in-place. This rearranges - decomposed characters in the string according to their combining - classes. See the Unicode manual for more information. */ -void g_unicode_canonical_ordering (gunichar *string, - size_t len); - -/* Compute canonical decomposition of a character. Returns g_malloc()d - string of Unicode characters. RESULT_LEN is set to the resulting - length of the string. */ -gunichar *g_unicode_canonical_decomposition (gunichar ch, - size_t *result_len); - -/* Array of skip-bytes-per-initial character. - * We prefix variable declarations so they can - * properly get exported in windows dlls. - */ -#ifndef GLIB_VAR -# ifdef G_OS_WIN32 -# ifdef GLIB_COMPILATION -# define GLIB_VAR __declspec(dllexport) -# else /* !GLIB_COMPILATION */ -# define GLIB_VAR extern __declspec(dllimport) -# endif /* !GLIB_COMPILATION */ -# else /* !G_OS_WIN32 */ -# define GLIB_VAR extern -# endif /* !G_OS_WIN32 */ -#endif /* !GLIB_VAR */ - -GLIB_VAR char g_utf8_skip[256]; - -#define g_utf8_next_char(p) (char *)((p) + g_utf8_skip[*(guchar *)(p)]) - -gunichar g_utf8_get_char (gchar const *p); -gchar * g_utf8_offset_to_pointer (gchar const *str, - gint offset); -gint g_utf8_pointer_to_offset (gchar const *str, - gchar const *pos); -gchar * g_utf8_prev_char (gchar const *p); -gchar * g_utf8_find_next_char (gchar const *p, - gchar const *end); -gchar * g_utf8_find_prev_char (gchar const *str, - gchar const *p); - -gint g_utf8_strlen (gchar const *p, - gint max); - -/* Copies n characters from src to dest */ -gchar *g_utf8_strncpy (gchar *dest, - gchar const *src, - size_t n); - -/* Find the UTF-8 character corresponding to ch, in string p. These - functions are equivalants to strchr and strrchr */ - -gchar *g_utf8_strchr (gchar const *p, - gunichar c); -gchar *g_utf8_strrchr (gchar const *p, - gunichar c); - -gunichar2 *g_utf8_to_utf16 (gchar const *str, - gint len); -gunichar * g_utf8_to_ucs4 (gchar const *str, - gint len); -gunichar * g_utf16_to_ucs4 (gunichar2 const *str, - gint len); -gchar * g_utf16_to_utf8 (gunichar2 const *str, - gint len); -gunichar * g_ucs4_to_utf16 (gunichar const *str, - gint len); -gchar * g_ucs4_to_utf8 (gunichar const *str, - gint len); - -/* Convert a single character into UTF-8. outbuf must have at - * least 6 bytes of space. Returns the number of bytes in the - * result. - */ -gint g_unichar_to_utf8 (gunichar c, - char *outbuf); - -/* Validate a UTF8 string, return TRUE if valid, put pointer to - * first invalid char in **end - */ - -gboolean g_utf8_validate (gchar const *str, - gint max_len, - gchar const **end); - -G_END_DECLS - -#endif /* __G_UNICODE_H__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gutils.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gutils.h deleted file mode 100644 index 35793964f1..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gutils.h +++ /dev/null @@ -1,335 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_UTILS_H__ -#define __G_UTILS_H__ - -#include -#include - -G_BEGIN_DECLS - -#ifdef G_OS_WIN32 - -/* On native Win32, directory separator is the backslash, and search path - * separator is the semicolon. - */ -#define G_DIR_SEPARATOR '\\' -#define G_DIR_SEPARATOR_S "\\" -#define G_SEARCHPATH_SEPARATOR ';' -#define G_SEARCHPATH_SEPARATOR_S ";" - -#else /* !G_OS_WIN32 */ - -/* Unix */ - -#define G_DIR_SEPARATOR '/' -#define G_DIR_SEPARATOR_S "/" -#define G_SEARCHPATH_SEPARATOR ':' -#define G_SEARCHPATH_SEPARATOR_S ":" - -#endif /* !G_OS_WIN32 */ - -/* Define G_VA_COPY() to do the right thing for copying va_list variables. - * glibconfig.h may have already defined G_VA_COPY as va_copy or __va_copy. - */ -#if !defined (G_VA_COPY) -# if defined (__GNUC__) && defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32)) -# define G_VA_COPY(ap1, ap2) (*(ap1) = *(ap2)) -# elif defined (G_VA_COPY_AS_ARRAY) -# define G_VA_COPY(ap1, ap2) g_memmove ((ap1), (ap2), sizeof (va_list)) -# else /* va_list is a pointer */ -# define G_VA_COPY(ap1, ap2) ((ap1) = (ap2)) -# endif /* va_list is a pointer */ -#endif /* !G_VA_COPY */ - -/* inlining hassle. for compilers that don't allow the `inline' keyword, - * mostly because of strict ANSI C compliance or dumbness, we try to fall - * back to either `__inline__' or `__inline'. - * we define G_CAN_INLINE, if the compiler seems to be actually - * *capable* to do function inlining, in which case inline function bodys - * do make sense. we also define G_INLINE_FUNC to properly export the - * function prototypes if no inlining can be performed. - * inline function bodies have to be special cased with G_CAN_INLINE and a - * .c file specific macro to allow one compiled instance with extern linkage - * of the functions by defining G_IMPLEMENT_INLINES and the .c file macro. - */ -#ifdef G_IMPLEMENT_INLINES -# define G_INLINE_FUNC extern -# undef G_CAN_INLINE -#endif -#ifndef G_INLINE_FUNC -# define G_CAN_INLINE 1 -#endif -#if defined (G_HAVE_INLINE) && defined (__GNUC__) && defined (__STRICT_ANSI__) -# undef inline -# define inline __inline__ -#elif !defined (G_HAVE_INLINE) -# undef inline -# if defined (G_HAVE___INLINE__) -# define inline __inline__ -# elif defined (G_HAVE___INLINE) -# define inline __inline -# else /* !inline && !__inline__ && !__inline */ -# define inline /* don't inline, then */ -# ifndef G_INLINE_FUNC -# undef G_CAN_INLINE -# endif -# endif -#endif -#ifndef G_INLINE_FUNC -# if defined (__GNUC__) && (__OPTIMIZE__) -# define G_INLINE_FUNC extern inline -# elif defined (G_CAN_INLINE) && !defined (__GNUC__) -# define G_INLINE_FUNC static inline -# else /* can't inline */ -# define G_INLINE_FUNC extern -# undef G_CAN_INLINE -# endif -#endif /* !G_INLINE_FUNC */ - -/* Retrive static string info - */ -gchar* g_get_user_name (void); -gchar* g_get_real_name (void); -gchar* g_get_home_dir (void); -gchar* g_get_tmp_dir (void); -gchar* g_get_prgname (void); -void g_set_prgname (gchar const *prgname); - - -typedef struct _GDebugKey GDebugKey; -struct _GDebugKey -{ - gchar *key; - guint value; -}; - -/* Miscellaneous utility functions - */ -guint g_parse_debug_string (gchar const *string, - GDebugKey *keys, - guint nkeys); -gint g_snprintf (gchar *string, - gulong n, - gchar const *format, - ...) G_GNUC_PRINTF (3, 4); -gint g_vsnprintf (gchar *string, - gulong n, - gchar const *format, - va_list args); -/* Check if a file name is an absolute path */ -gboolean g_path_is_absolute (gchar const *file_name); -/* In case of absolute paths, skip the root part */ -gchar* g_path_skip_root (gchar *file_name); - -/* These two functions are deprecated and will be removed in the next - * major release of GLib. Use g_path_get_dirname/g_path_get_basename - * instead. Whatch out! The string returned by g_path_get_basename - * must be g_freed, while the string returned by g_basename must not.*/ -gchar* g_basename (gchar const *file_name); -gchar* g_dirname (gchar const *file_name); - -/* The returned strings are newly allocated with g_malloc() */ -gchar* g_get_current_dir (void); -gchar* g_path_get_basename (gchar const *file_name); -gchar* g_path_get_dirname (gchar const *file_name); - -/* Get the codeset for the current locale */ -/* gchar * g_get_codeset (void); */ - -/* return the environment string for the variable. The returned memory - * must not be freed. */ -gchar* g_getenv (gchar const *variable); - - -/* we try to provide a usefull equivalent for ATEXIT if it is - * not defined, but use is actually abandoned. people should - * use g_atexit() instead. - */ -typedef void (*GVoidFunc) (void); -#ifndef ATEXIT -# define ATEXIT(proc) g_ATEXIT(proc) -#else -# define G_NATIVE_ATEXIT -#endif /* ATEXIT */ -/* we use a GLib function as a replacement for ATEXIT, so - * the programmer is not required to check the return value - * (if there is any in the implementation) and doesn't encounter - * missing include files. - */ -void g_atexit (GVoidFunc func); - -/* Look for an executable in PATH, following execvp() rules */ -gchar* g_find_program_in_path (gchar const *program); - -/* Bit tests - */ -G_INLINE_FUNC gint g_bit_nth_lsf (guint32 mask, - gint nth_bit); -G_INLINE_FUNC gint g_bit_nth_msf (guint32 mask, - gint nth_bit); -G_INLINE_FUNC guint g_bit_storage (guint number); - -/* Trash Stacks - * elements need to be >= sizeof (gpointer) - */ -typedef struct _GTrashStack GTrashStack; -struct _GTrashStack -{ - GTrashStack *next; -}; - -G_INLINE_FUNC void g_trash_stack_push (GTrashStack **stack_p, - gpointer data_p); -G_INLINE_FUNC gpointer g_trash_stack_pop (GTrashStack **stack_p); -G_INLINE_FUNC gpointer g_trash_stack_peek (GTrashStack **stack_p); -G_INLINE_FUNC guint g_trash_stack_height (GTrashStack **stack_p); - -/* inline function implementations - */ -#if defined (G_CAN_INLINE) || defined (__G_UTILS_C__) -G_INLINE_FUNC gint -g_bit_nth_lsf (guint32 mask, - gint nth_bit) -{ - do - { - nth_bit++; - if (mask & (1 << (guint) nth_bit)) - return nth_bit; - } - while (nth_bit < 32); - return -1; -} -G_INLINE_FUNC gint -g_bit_nth_msf (guint32 mask, - gint nth_bit) -{ - if (nth_bit < 0) - nth_bit = 32; - do - { - nth_bit--; - if (mask & (1 << (guint) nth_bit)) - return nth_bit; - } - while (nth_bit > 0); - return -1; -} -G_INLINE_FUNC guint -g_bit_storage (guint number) -{ - register guint n_bits = 0; - - do - { - n_bits++; - number >>= 1; - } - while (number); - return n_bits; -} -G_INLINE_FUNC void -g_trash_stack_push (GTrashStack **stack_p, - gpointer data_p) -{ - GTrashStack *data = (GTrashStack *) data_p; - - data->next = *stack_p; - *stack_p = data; -} -G_INLINE_FUNC gpointer -g_trash_stack_pop (GTrashStack **stack_p) -{ - GTrashStack *data; - - data = *stack_p; - if (data) - { - *stack_p = data->next; - /* NULLify private pointer here, most platforms store NULL as - * subsequent 0 bytes - */ - data->next = NULL; - } - - return data; -} -G_INLINE_FUNC gpointer -g_trash_stack_peek (GTrashStack **stack_p) -{ - GTrashStack *data; - - data = *stack_p; - - return data; -} -G_INLINE_FUNC guint -g_trash_stack_height (GTrashStack **stack_p) -{ - GTrashStack *data; - guint i = 0; - - for (data = *stack_p; data; data = data->next) - i++; - - return i; -} -#endif /* G_CAN_INLINE || __G_UTILS_C__ */ - -/* Glib version. - * we prefix variable declarations so they can - * properly get exported in windows dlls. - */ -#ifdef G_OS_WIN32 -# ifdef GLIB_COMPILATION -# define GLIB_VAR __declspec(dllexport) -# else /* !GLIB_COMPILATION */ -# define GLIB_VAR extern __declspec(dllimport) -# endif /* !GLIB_COMPILATION */ -#else /* !G_OS_WIN32 */ -# define GLIB_VAR extern -#endif /* !G_OS_WIN32 */ - -GLIB_VAR guint const glib_major_version; -GLIB_VAR guint const glib_minor_version; -GLIB_VAR guint const glib_micro_version; -GLIB_VAR guint const glib_interface_age; -GLIB_VAR guint const glib_binary_age; - -#define GLIB_CHECK_VERSION(major,minor,micro) \ - (GLIB_MAJOR_VERSION > (major) || \ - (GLIB_MAJOR_VERSION == (major) && GLIB_MINOR_VERSION > (minor)) || \ - (GLIB_MAJOR_VERSION == (major) && GLIB_MINOR_VERSION == (minor) && \ - GLIB_MICRO_VERSION >= (micro))) - -G_END_DECLS - -#endif /* __G_UTILS_H__ */ - - - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gwin32.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gwin32.h deleted file mode 100644 index b1bf31a949..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/gwin32.h +++ /dev/null @@ -1,117 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_WIN32_H__ -#define __G_WIN32_H__ - -#include - -#ifdef G_OS_WIN32 - -/* Windows emulation stubs for common Unix functions - */ - -G_BEGIN_DECLS - -#define MAXPATHLEN 1024 - -#ifdef _MSC_VER -typedef int pid_t; -#endif - -/* - * To get prototypes for the following POSIXish functions, you have to - * include the indicated non-POSIX headers. The functions are defined - * in OLDNAMES.LIB (MSVC) or -lmoldname-msvc (mingw32). - * - * getcwd: (MSVC), (mingw32) - * getpid: - * access: - * unlink: or - * open, read, write, lseek, close: - * rmdir: - * pipe: - */ - -/* pipe is not in OLDNAMES.LIB or -lmoldname-msvc. */ -#define pipe(phandles) _pipe (phandles, 4096, _O_BINARY) - -/* For some POSIX functions that are not provided by the MS runtime, - * we provide emulators in glib, which are prefixed with g_win32_. - */ -# define ftruncate(fd, size) g_win32_ftruncate (fd, size) - -/* -lmingw32 also has emulations for these, but we need our own - * for MSVC anyhow, so we might aswell use them always. - */ -# define opendir g_win32_opendir -# define readdir g_win32_readdir -# define rewinddir g_win32_rewinddir -# define closedir g_win32_closedir -# define NAME_MAX 255 - -struct dirent -{ - gchar d_name[NAME_MAX + 1]; -}; - -struct DIR -{ - gchar *dir_name; - gboolean just_opened; - guint find_file_handle; - gpointer find_file_data; - struct dirent readdir_result; -}; -typedef struct DIR DIR; - -/* emulation functions */ -extern int g_win32_ftruncate (gint f, - guint size); -DIR* g_win32_opendir (gchar const *dirname); -struct dirent* g_win32_readdir (DIR *dir); -void g_win32_rewinddir (DIR *dir); -gint g_win32_closedir (DIR *dir); - -/* The MS setlocale uses locale names of the form "English_United - * States.1252" etc. We want the Unixish standard form "en", "zh_TW" - * etc. This function gets the current thread locale from Windows and - * returns it as a string of the above form for use in forming file - * names etc. The returned string should be deallocated with g_free(). - */ -gchar * g_win32_getlocale (void); - -/* Translate a Win32 error code (as returned by GetLastError()) into - * the corresponding message. The returned string should be deallocated - * with g_free(). - */ -gchar * g_win32_error_message (gint error); - -G_END_DECLS - -#endif /* G_OS_WIN32 */ - -#endif /* __G_WIN32_H__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/.cvsignore b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/.cvsignore deleted file mode 100644 index aa6c7eb936..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/.cvsignore +++ /dev/null @@ -1,36 +0,0 @@ -*.pro -*~ -Makefile.cartesian -Makefile.cfev -Makefile.cfevtest -Makefile.collapser -Makefile.common -Makefile.compatibility -Makefile.convex_decomp -Makefile.core -Makefile.corealg -Makefile.coreio -Makefile.geometry -Makefile.interf -Makefile.license -Makefile.linalg -Makefile.meshercommon -Makefile.mkprogen -Makefile.mkprospec -Makefile.newsurface -Makefile.newvolume -Makefile.octree -Makefile.pipeline -Makefile.resurfacer -Makefile.robustgeometry -Makefile.surface -Makefile.surfacerepair -Makefile.surfacewrapper -Makefile.test -Makefile.viewcommon -Makefile.voxelmesher -make.*.list* -qmake.vars -test.general.log -test.specific.log -zzzz* diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/auth.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/auth.h deleted file mode 100644 index 38c2ce9097..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/auth.h +++ /dev/null @@ -1,212 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)auth.h 2.3 88/08/07 4.0 RPCSRC; from 1.17 88/02/08 SMI */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * auth.h, Authentication interface. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - * - * The data structures are completely opaque to the client. The client - * is required to pass a AUTH * to routines that create rpc - * "sessions". - */ - -#ifndef __AUTH_HEADER__ -#define __AUTH_HEADER__ - -#ifdef __cplusplus -extern "C" { -#define DOTS ... -#else -#define DOTS -#endif - -#define MAX_AUTH_BYTES 400 -#define MAXNETNAMELEN 255 /* maximum length of network user's name */ - -/* - * Status returned from authentication check - */ -enum auth_stat { - AUTH_OK=0, - /* - * failed at remote end - */ - AUTH_BADCRED=1, /* bogus credentials (seal broken) */ - AUTH_REJECTEDCRED=2, /* client should begin new session */ - AUTH_BADVERF=3, /* bogus verifier (seal broken) */ - AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */ - AUTH_TOOWEAK=5, /* rejected due to security reasons */ - /* - * failed locally - */ - AUTH_INVALIDRESP=6, /* bogus response verifier */ - AUTH_FAILED=7 /* some unknown reason */ -}; - -#if (mc68000 || sparc || vax || i386) -typedef u_long u_int32; /* 32-bit unsigned integers */ - -union des_block { - struct { - u_int32 high; - u_int32 low; - } key; - char c[8]; -}; -#else -union des_block { - struct { - u_long high; - u_long low; - } key; - char c[8]; -}; -#endif -typedef union des_block des_block; -extern bool_t xdr_des_block(DOTS); - -/* - * Authentication info. Opaque to client. - */ -struct opaque_auth { - enum_t oa_flavor; /* flavor of auth */ - caddr_t oa_base; /* address of more auth stuff */ - u_int oa_length; /* not to exceed MAX_AUTH_BYTES */ -}; - - -/* - * Auth handle, interface to client side authenticators. - */ -typedef struct { - struct opaque_auth ah_cred; - struct opaque_auth ah_verf; - union des_block ah_key; - struct auth_ops { - void (*ah_nextverf)(DOTS); - int (*ah_marshal)(DOTS); /* nextverf & serialize */ - int (*ah_validate)(DOTS); /* validate varifier */ - int (*ah_refresh)(DOTS); /* refresh credentials */ - void (*ah_destroy)(DOTS); /* destroy this structure */ - } *ah_ops; - caddr_t ah_private; -} AUTH; - - -/* - * Authentication ops. - * The ops and the auth handle provide the interface to the authenticators. - * - * AUTH *auth; - * XDR *xdrs; - * struct opaque_auth verf; - */ -#define AUTH_NEXTVERF(auth) \ - ((*((auth)->ah_ops->ah_nextverf))(auth)) -#define auth_nextverf(auth) \ - ((*((auth)->ah_ops->ah_nextverf))(auth)) - -#define AUTH_MARSHALL(auth, xdrs) \ - ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) -#define auth_marshall(auth, xdrs) \ - ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) - -#define AUTH_VALIDATE(auth, verfp) \ - ((*((auth)->ah_ops->ah_validate))((auth), verfp)) -#define auth_validate(auth, verfp) \ - ((*((auth)->ah_ops->ah_validate))((auth), verfp)) - -#define AUTH_REFRESH(auth) \ - ((*((auth)->ah_ops->ah_refresh))(auth)) -#define auth_refresh(auth) \ - ((*((auth)->ah_ops->ah_refresh))(auth)) - -#define AUTH_DESTROY(auth) \ - ((*((auth)->ah_ops->ah_destroy))(auth)) -#define auth_destroy(auth) \ - ((*((auth)->ah_ops->ah_destroy))(auth)) - -#if defined(WIN32) || defined(WINDOWS_X86) || defined(WINDOWS_X86_GCC) -#ifdef ONCRPCDLL -extern struct opaque_auth _null_auth; -#else -#ifdef __BORLANDC__ -extern __declspec(dllimport) struct opaque_auth _null_auth; -#else -_declspec(dllimport) struct opaque_auth _null_auth; -#endif -#endif -#else -extern struct opaque_auth _null_auth; -#endif - - -/* - * These are the various implementations of client side authenticators. - */ - -/* - * Unix style authentication - * AUTH *authunix_create(machname, uid, gid, len, aup_gids) - * char *machname; - * int uid; - * int gid; - * int len; - * int *aup_gids; - */ -extern AUTH *authunix_create(DOTS); -extern AUTH *authunix_create_default(DOTS); /* takes no parameters */ -extern AUTH *authnone_create(DOTS); /* takes no parameters */ -extern AUTH *authdes_create(DOTS); - -#define AUTH_NONE 0 /* no authentication */ -#define AUTH_NULL 0 /* backward compatibility */ -#define AUTH_UNIX 1 /* unix style (uid, gids) */ -#define AUTH_SHORT 2 /* short hand unix style */ -#define AUTH_DES 3 /* des style (encrypted timestamps) */ - -#ifdef __cplusplus -}; -#endif - -#endif /* __AUTH_HEADER__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/auth_uni.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/auth_uni.h deleted file mode 100644 index 6946aec649..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/auth_uni.h +++ /dev/null @@ -1,101 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)auth_unix.h 2.2 88/07/29 4.0 RPCSRC; from 1.8 88/02/08 SMI */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* @(#)auth_unix.h 1.5 86/07/16 SMI */ - -/* - * auth_unix.h, Protocol for UNIX style authentication parameters for RPC - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -/* - * The system is very weak. The client uses no encryption for it - * credentials and only sends null verifiers. The server sends backs - * null verifiers or optionally a verifier that suggests a new short hand - * for the credentials. - */ - -#ifndef __AUTH_UNIX_HEADER__ -#define __AUTH_UNIX_HEADER__ - -#ifdef __cplusplus -extern "C" { -#define DOTS ... -#else -#define DOTS -#endif - -/* The machine name is part of a credential; it may not exceed 255 bytes */ -#define MAX_MACHINE_NAME 255 - -/* gids compose part of a credential; there may not be more than 16 of them */ -#define NGRPS 16 - -/* - * Unix style credentials. - */ -struct authunix_parms { - u_long aup_time; - char *aup_machname; - int aup_uid; - int aup_gid; - u_int aup_len; - int *aup_gids; -}; - -extern bool_t xdr_authunix_parms(DOTS); - -/* - * If a response verifier has flavor AUTH_SHORT, - * then the body of the response verifier encapsulates the following structure; - * again it is serialized in the obvious fashion. - */ -struct short_hand_verf { - struct opaque_auth new_cred; -}; - -#ifdef __cplusplus -}; -#endif - - -#endif /* __AUTH_UNIX_HEADER__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/bcopy.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/bcopy.h deleted file mode 100644 index 2b3ed8c2ec..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/bcopy.h +++ /dev/null @@ -1,22 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif - -void bcopy(char *,char*,int); -void bcopy_nf(char *,char *,int); -void bcopy_fn(char *,char *,int); -void bcopy_ff(char *,char *,int); -void bzero(char*,int); -#ifdef __cplusplus -}; -#endif - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/clnt.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/clnt.h deleted file mode 100644 index 87db5501fb..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/clnt.h +++ /dev/null @@ -1,364 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC; from 1.31 88/02/08 SMI*/ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * clnt.h - Client side remote procedure call interface. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#ifndef _CLNT_ -#define _CLNT_ - -#ifdef __cplusplus -extern "C" { -#define DOTS ... -#else -#define DOTS -#endif - -/* - * Rpc calls return an enum clnt_stat. This should be looked at more, - * since each implementation is required to live with this (implementation - * independent) list of errors. - */ -enum clnt_stat { - RPC_SUCCESS=0, /* call succeeded */ - /* - * local errors - */ - RPC_CANTENCODEARGS=1, /* can't encode arguments */ - RPC_CANTDECODERES=2, /* can't decode results */ - RPC_CANTSEND=3, /* failure in sending call */ - RPC_CANTRECV=4, /* failure in receiving result */ - RPC_TIMEDOUT=5, /* call timed out */ - /* - * remote errors - */ - RPC_VERSMISMATCH=6, /* rpc versions not compatible */ - RPC_AUTHERROR=7, /* authentication error */ - RPC_PROGUNAVAIL=8, /* program not available */ - RPC_PROGVERSMISMATCH=9, /* program version mismatched */ - RPC_PROCUNAVAIL=10, /* procedure unavailable */ - RPC_CANTDECODEARGS=11, /* decode arguments error */ - RPC_SYSTEMERROR=12, /* generic "other problem" */ - - /* - * callrpc & clnt_create errors - */ - RPC_UNKNOWNHOST=13, /* unknown host name */ - RPC_UNKNOWNPROTO=17, /* unkown protocol */ - - /* - * _ create errors - */ - RPC_PMAPFAILURE=14, /* the pmapper failed in its call */ - RPC_PROGNOTREGISTERED=15, /* remote program is not registered */ - /* - * unspecified error - */ - RPC_FAILED=16 -}; - - -/* - * Error info. - */ -struct rpc_err { - enum clnt_stat re_status; - union { - int RE_errno; /* realated system error */ - enum auth_stat RE_why; /* why the auth error occurred */ - struct { - u_long low; /* lowest verion supported */ - u_long high; /* highest verion supported */ - } RE_vers; - struct { /* maybe meaningful if RPC_FAILED */ - long s1; - long s2; - } RE_lb; /* life boot & debugging only */ - } ru; -#define re_errno ru.RE_errno -#define re_why ru.RE_why -#define re_vers ru.RE_vers -#define re_lb ru.RE_lb -}; - - -/* - * Client rpc handle. - * Created by individual implementations, see e.g. rpc_udp.c. - * Client is responsible for initializing auth, see e.g. auth_none.c. - */ -typedef struct { - AUTH *cl_auth; /* authenticator */ - struct clnt_ops { - enum clnt_stat (*cl_call)(DOTS); /* call remote procedure */ - void (*cl_abort)(DOTS); /* abort a call */ - void (*cl_geterr)(DOTS); /* get specific error code */ - bool_t (*cl_freeres)(DOTS); /* frees results */ - void (*cl_destroy)(DOTS);/* destroy this structure */ - bool_t (*cl_control)(DOTS);/* the ioctl() of rpc */ - } *cl_ops; - caddr_t cl_private; /* private stuff */ -} CLIENT; - - -/* - * client side rpc interface ops - * - * Parameter types are: - * - */ - -/* - * enum clnt_stat - * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout) - * CLIENT *rh; - * u_long proc; - * xdrproc_t xargs; - * caddr_t argsp; - * xdrproc_t xres; - * caddr_t resp; - * struct timeval timeout; - */ -#define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \ - ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) -#define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \ - ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) - -/* - * void - * CLNT_ABORT(rh); - * CLIENT *rh; - */ -#define CLNT_ABORT(rh) ((*(rh)->cl_ops->cl_abort)(rh)) -#define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh)) - -/* - * struct rpc_err - * CLNT_GETERR(rh); - * CLIENT *rh; - */ -#define CLNT_GETERR(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) -#define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) - - -/* - * bool_t - * CLNT_FREERES(rh, xres, resp); - * CLIENT *rh; - * xdrproc_t xres; - * caddr_t resp; - */ -#define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) -#define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) - -/* - * bool_t - * CLNT_CONTROL(cl, request, info) - * CLIENT *cl; - * u_int request; - * char *info; - */ -#define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) -#define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) - -/* - * control operations that apply to both udp and tcp transports - */ -#define CLSET_TIMEOUT 1 /* set timeout (timeval) */ -#define CLGET_TIMEOUT 2 /* get timeout (timeval) */ -#define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */ -/* - * udp only control operations - */ -#define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */ -#define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */ - -/* - * void - * CLNT_DESTROY(rh); - * CLIENT *rh; - */ -#define CLNT_DESTROY(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) -#define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) - - -/* - * RPCTEST is a test program which is accessable on every rpc - * transport/port. It is used for testing, performance evaluation, - * and network administration. - */ - -#define RPCTEST_PROGRAM ((u_long)1) -#define RPCTEST_VERSION ((u_long)1) -#define RPCTEST_NULL_PROC ((u_long)2) -#define RPCTEST_NULL_BATCH_PROC ((u_long)3) - -/* - * By convention, procedure 0 takes null arguments and returns them - */ - -#define NULLPROC ((u_long)0) - -/* - * Below are the client handle creation routines for the various - * implementations of client side rpc. They can return NULL if a - * creation failure occurs. - */ - -/* - * Memory based rpc (for speed check and testing) - * CLIENT * - * clntraw_create(prog, vers) - * u_long prog; - * u_long vers; - */ -extern CLIENT *clntraw_create(DOTS); - - -/* - * Generic client creation routine. Supported protocols are "udp" and "tcp" - */ -extern CLIENT * -clnt_create(/*host, prog, vers, prot*/DOTS); /* - char *host; -- hostname - u_long prog; -- program number - u_long vers; -- version number - char *prot; -- protocol -*/ - - - - -/* - * TCP based rpc - * CLIENT * - * clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz) - * struct sockaddr_in *raddr; - * u_long prog; - * u_long version; - * register int *sockp; - * u_int sendsz; - * u_int recvsz; - */ -extern CLIENT *clnttcp_create(DOTS); - -/* - * UDP based rpc. - * CLIENT * - * clntudp_create(raddr, program, version, wait, sockp) - * struct sockaddr_in *raddr; - * u_long program; - * u_long version; - * struct timeval wait; - * int *sockp; - * - * Same as above, but you specify max packet sizes. - * CLIENT * - * clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz) - * struct sockaddr_in *raddr; - * u_long program; - * u_long version; - * struct timeval wait; - * int *sockp; - * u_int sendsz; - * u_int recvsz; - */ -extern CLIENT *clntudp_create(DOTS); -extern CLIENT *clntudp_bufcreate(DOTS); - -/* - * Print why creation failed - */ -void clnt_pcreateerror(/* char *msg */DOTS); /* stderr */ -char *clnt_spcreateerror(/* char *msg */DOTS); /* string */ - -/* - * Like clnt_perror(), but is more verbose in its output - */ -void clnt_perrno(/* enum clnt_stat num */DOTS); /* stderr */ - -/* - * Print an English error message, given the client error code - */ -void clnt_perror(/* CLIENT *clnt, char *msg */DOTS); /* stderr */ -char *clnt_sperror(/* CLIENT *clnt, char *msg */DOTS); /* string */ - -/* - * If a creation fails, the following allows the user to figure out why. - */ -struct rpc_createerr { - enum clnt_stat cf_stat; - struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */ -}; - -#if defined(WIN32) || defined(WINDOWS_X86) || defined(WINDOWS_X86_GCC) -#ifdef ONCRPCDLL -extern struct rpc_createerr rpc_createerr; -#else -#ifdef __BORLANDC__ -extern __declspec(dllimport) struct rpc_createerr rpc_createerr; -#else -_declspec(dllimport) struct rpc_createerr rpc_createerr; -#endif -#endif -#else -extern struct rpc_createerr rpc_createerr; -#endif - - -/* - * Copy error message to buffer. - */ -char *clnt_sperrno(/* enum clnt_stat num */DOTS); /* string */ - - - -#define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */ -#define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */ - -#ifdef __cplusplus -}; -#endif - -#endif /*!_CLNT_*/ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/netdb.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/netdb.h deleted file mode 100644 index ec7b4dc58a..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/netdb.h +++ /dev/null @@ -1,51 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)netdb.h 2.1 88/07/29 3.9 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* @(#)rpc.h 1.8 87/07/24 SMI */ - -/* Really belongs in */ - -struct rpcent { - char *r_name; /* name of server for this rpc program */ - char **r_aliases; /* alias list */ - int r_number; /* rpc program number */ -}; - -struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent(); diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/pmap_cln.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/pmap_cln.h deleted file mode 100644 index 7335a74c16..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/pmap_cln.h +++ /dev/null @@ -1,88 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)pmap_clnt.h 2.1 88/07/29 4.0 RPCSRC; from 1.11 88/02/08 SMI */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * pmap_clnt.h - * Supplies C routines to get to portmap services. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#ifdef __cplusplus -extern "C" { -#define DOTS ... -#else -#define DOTS -#endif - -/* - * Usage: - * success = pmap_set(program, version, protocol, port); - * success = pmap_unset(program, version); - * port = pmap_getport(address, program, version, protocol); - * head = pmap_getmaps(address); - * clnt_stat = pmap_rmtcall(address, program, version, procedure, - * xdrargs, argsp, xdrres, resp, tout, port_ptr) - * (works for udp only.) - * clnt_stat = clnt_broadcast(program, version, procedure, - * xdrargs, argsp, xdrres, resp, eachresult) - * (like pmap_rmtcall, except the call is broadcasted to all - * locally connected nets. For each valid response received, - * the procedure eachresult is called. Its form is: - * done = eachresult(resp, raddr) - * bool_t done; - * caddr_t resp; - * struct sockaddr_in raddr; - * where resp points to the results of the call and raddr is the - * address if the responder to the broadcast. - */ - -extern bool_t pmap_set(DOTS); -extern bool_t pmap_unset(DOTS); -extern struct pmaplist *pmap_getmaps(DOTS); -enum clnt_stat pmap_rmtcall(DOTS); -enum clnt_stat clnt_broadcast(DOTS); -extern u_short pmap_getport(DOTS); - -#ifdef __cplusplus -}; -#endif - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/pmap_pro.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/pmap_pro.h deleted file mode 100644 index 0fc8642dc3..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/pmap_pro.h +++ /dev/null @@ -1,117 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)pmap_prot.h 2.1 88/07/29 4.0 RPCSRC; from 1.14 88/02/08 SMI */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -#ifdef __cplusplus -extern "C" { -#define DOTS ... -#else -#define DOTS -#endif - -/* - * pmap_prot.h - * Protocol for the local binder service, or pmap. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - * - * The following procedures are supported by the protocol: - * - * PMAPPROC_NULL() returns () - * takes nothing, returns nothing - * - * PMAPPROC_SET(struct pmap) returns (bool_t) - * TRUE is success, FALSE is failure. Registers the tuple - * [prog, vers, prot, port]. - * - * PMAPPROC_UNSET(struct pmap) returns (bool_t) - * TRUE is success, FALSE is failure. Un-registers pair - * [prog, vers]. prot and port are ignored. - * - * PMAPPROC_GETPORT(struct pmap) returns (long unsigned). - * 0 is failure. Otherwise returns the port number where the pair - * [prog, vers] is registered. It may lie! - * - * PMAPPROC_DUMP() RETURNS (struct pmaplist *) - * - * PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>) - * RETURNS (port, string<>); - * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc, encapsulatedargs); - * Calls the procedure on the local machine. If it is not registered, - * this procedure is quite; ie it does not return error information!!! - * This procedure only is supported on rpc/udp and calls via - * rpc/udp. This routine only passes null authentication parameters. - * This file has no interface to xdr routines for PMAPPROC_CALLIT. - * - * The service supports remote procedure calls on udp/ip or tcp/ip socket 111. - */ - -#define PMAPPORT ((u_short)111) -#define PMAPPROG ((u_long)100000) -#define PMAPVERS ((u_long)2) -#define PMAPVERS_PROTO ((u_long)2) -#define PMAPVERS_ORIG ((u_long)1) -#define PMAPPROC_NULL ((u_long)0) -#define PMAPPROC_SET ((u_long)1) -#define PMAPPROC_UNSET ((u_long)2) -#define PMAPPROC_GETPORT ((u_long)3) -#define PMAPPROC_DUMP ((u_long)4) -#define PMAPPROC_CALLIT ((u_long)5) - -struct pmap { - long unsigned pm_prog; - long unsigned pm_vers; - long unsigned pm_prot; - long unsigned pm_port; -}; - -extern bool_t xdr_pmap(DOTS); - -struct pmaplist { - struct pmap pml_map; - struct pmaplist *pml_next; -}; - -extern bool_t xdr_pmaplist(DOTS); - -#ifdef __cplusplus -}; -#endif - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/pmap_rmt.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/pmap_rmt.h deleted file mode 100644 index f36e25abc6..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/pmap_rmt.h +++ /dev/null @@ -1,75 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)pmap_rmt.h 2.1 88/07/29 4.0 RPCSRC; from 1.2 88/02/08 SMI */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -#ifdef __cplusplus -extern "C" { -#define DOTS ... -#else -#define DOTS -#endif - -/* - * Structures and XDR routines for parameters to and replies from - * the portmapper remote-call-service. - * - * Copyright (C) 1986, Sun Microsystems, Inc. - */ - -struct rmtcallargs { - u_long prog, vers, proc, arglen; - caddr_t args_ptr; - xdrproc_t xdr_args; -}; - -bool_t xdr_rmtcall_args(DOTS); - -struct rmtcallres { - u_long *port_ptr; - u_long resultslen; - caddr_t results_ptr; - xdrproc_t xdr_results; -}; - -bool_t xdr_rmtcallres(DOTS); -#ifdef __cplusplus -}; -#endif - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/rpc.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/rpc.h deleted file mode 100644 index aceecc6e15..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/rpc.h +++ /dev/null @@ -1,119 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)rpc.h 2.3 88/08/10 4.0 RPCSRC; from 1.9 88/02/08 SMI */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * rpc.h, Just includes the billions of rpc header files necessary to - * do remote procedure calling. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ -#ifndef __RPC_HEADER__ -#define __RPC_HEADER__ - -#if defined(WIN32) || defined(WINDOWS_X86) || defined(WINDOWS_X86_GCC) -#define FD_SETSIZE 128 - -#include -#include -#include /* some typedefs */ -#include - -#define WSAerrno (WSAGetLastError()) -#define gettimeofday(tv,tz) ((tv)->tv_sec = time(0), (tv)->tv_usec = 0) - -#ifdef __cplusplus -extern "C" { -#define DOTS ... -#else -#define DOTS -#endif - -extern int rpc_nt_init(void); -extern int rpc_nt_exit(void); -extern void nt_rpc_report(DOTS); - -#include -extern int xdr_opaque_auth(DOTS); - -#ifdef __cplusplus -}; -#endif - -#else -#include /* some typedefs */ -#include -#endif - -/* external data representation interfaces */ -#include /* generic (de)serializer */ - -/* Client side only authentication */ -#include /* generic authenticator (client side) */ - -/* Client side (mostly) remote procedure call */ -#include /* generic rpc stuff */ - -/* semi-private protocol headers */ -#include /* protocol for rpc messages */ -#if defined(WIN32) || defined(WINDOWS_X86) || defined(WINDOWS_X86_GCC) -#include /* protocol for unix style cred */ -#else -#include /* protocol for unix style cred */ -#endif -/* - * Uncomment-out the next line if you are building the rpc library with - * DES Authentication (see the README file in the secure_rpc/ directory). - */ -/*#include protocol for des style cred */ - -/* Server side only remote procedure callee */ -#include /* service manager and multiplexer */ -#include /* service side authenticator */ - -/* - * COMMENT OUT THE NEXT INCLUDE IF RUNNING ON SUN OS OR ON A VERSION - * OF UNIX BASED ON NFSSRC. These systems will already have the structures - * defined by included in . - */ -/* routines for parsing /etc/rpc */ -#include /* structures and routines to parse /etc/rpc */ - -#endif /* ndef __RPC_HEADER__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/rpc_msg.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/rpc_msg.h deleted file mode 100644 index 4f6dacd67f..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/rpc_msg.h +++ /dev/null @@ -1,215 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* @(#)rpc_msg.h 1.7 86/07/16 SMI */ - -/* - * rpc_msg.h - * rpc message definition - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#ifndef __RPC_MSG_HEADER__ -#define __RPC_MSG_HEADER__ - -#ifdef __cplusplus -extern "C" { -#define DOTS ... -#else -#define DOTS -#endif - -#define RPC_MSG_VERSION ((u_long) 2) -#define RPC_SERVICE_PORT ((u_short) 2048) - -/* - * Bottom up definition of an rpc message. - * NOTE: call and reply use the same overall stuct but - * different parts of unions within it. - */ - -enum msg_type { - CALL=0, - REPLY=1 -}; - -enum reply_stat { - MSG_ACCEPTED=0, - MSG_DENIED=1 -}; - -enum accept_stat { - SUCCESS=0, - PROG_UNAVAIL=1, - PROG_MISMATCH=2, - PROC_UNAVAIL=3, - GARBAGE_ARGS=4, - SYSTEM_ERR=5 -}; - -enum reject_stat { - RPC_MISMATCH=0, - AUTH_ERROR=1 -}; - -/* - * Reply part of an rpc exchange - */ - -/* - * Reply to an rpc request that was accepted by the server. - * Note: there could be an error even though the request was - * accepted. - */ -struct accepted_reply { - struct opaque_auth ar_verf; - enum accept_stat ar_stat; - union { - struct { - u_long low; - u_long high; - } AR_versions; - struct { - caddr_t where; - xdrproc_t proc; - } AR_results; - /* and many other null cases */ - } ru; -#define ar_results ru.AR_results -#define ar_vers ru.AR_versions -}; - -/* - * Reply to an rpc request that was rejected by the server. - */ -struct rejected_reply { - enum reject_stat rj_stat; - union { - struct { - u_long low; - u_long high; - } RJ_versions; - enum auth_stat RJ_why; /* why authentication did not work */ - } ru; -#define rj_vers ru.RJ_versions -#define rj_why ru.RJ_why -}; - -/* - * Body of a reply to an rpc request. - */ -struct reply_body { - enum reply_stat rp_stat; - union { - struct accepted_reply RP_ar; - struct rejected_reply RP_dr; - } ru; -#define rp_acpt ru.RP_ar -#define rp_rjct ru.RP_dr -}; - -/* - * Body of an rpc request call. - */ -struct call_body { - u_long cb_rpcvers; /* must be equal to two */ - u_long cb_prog; - u_long cb_vers; - u_long cb_proc; - struct opaque_auth cb_cred; - struct opaque_auth cb_verf; /* protocol specific - provided by client */ -}; - -/* - * The rpc message - */ -struct rpc_msg { - u_long rm_xid; - enum msg_type rm_direction; - union { - struct call_body RM_cmb; - struct reply_body RM_rmb; - } ru; -#define rm_call ru.RM_cmb -#define rm_reply ru.RM_rmb -}; -#define acpted_rply ru.RM_rmb.ru.RP_ar -#define rjcted_rply ru.RM_rmb.ru.RP_dr - - -/* - * XDR routine to handle a rpc message. - * xdr_callmsg(xdrs, cmsg) - * XDR *xdrs; - * struct rpc_msg *cmsg; - */ -extern bool_t xdr_callmsg(DOTS); - -/* - * XDR routine to pre-serialize the static part of a rpc message. - * xdr_callhdr(xdrs, cmsg) - * XDR *xdrs; - * struct rpc_msg *cmsg; - */ -extern bool_t xdr_callhdr(DOTS); - -/* - * XDR routine to handle a rpc reply. - * xdr_replymsg(xdrs, rmsg) - * XDR *xdrs; - * struct rpc_msg *rmsg; - */ -extern bool_t xdr_replymsg(DOTS); - -/* - * Fills in the error part of a reply message. - * _seterr_reply(msg, error) - * struct rpc_msg *msg; - * struct rpc_err *error; - */ -extern void _seterr_reply(DOTS); - -#ifdef __cplusplus -}; -#endif - -#endif /* __RPC_MSG_HEADER__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/svc.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/svc.h deleted file mode 100644 index b183839042..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/svc.h +++ /dev/null @@ -1,313 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)svc.h 2.2 88/07/29 4.0 RPCSRC; from 1.20 88/02/08 SMI */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * svc.h, Server-side remote procedure call interface. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#ifndef __SVC_HEADER__ -#define __SVC_HEADER__ - -#ifdef __cplusplus -extern "C" { -#define DOTS ... -#else -#define DOTS -#endif - - -/* - * This interface must manage two items concerning remote procedure calling: - * - * 1) An arbitrary number of transport connections upon which rpc requests - * are received. The two most notable transports are TCP and UDP; they are - * created and registered by routines in svc_tcp.c and svc_udp.c, respectively; - * they in turn call xprt_register and xprt_unregister. - * - * 2) An arbitrary number of locally registered services. Services are - * described by the following four data: program number, version number, - * "service dispatch" function, a transport handle, and a boolean that - * indicates whether or not the exported program should be registered with a - * local binder service; if true the program's number and version and the - * port number from the transport handle are registered with the binder. - * These data are registered with the rpc svc system via svc_register. - * - * A service's dispatch function is called whenever an rpc request comes in - * on a transport. The request's program and version numbers must match - * those of the registered service. The dispatch function is passed two - * parameters, struct svc_req * and SVCXPRT *, defined below. - */ - -enum xprt_stat { - XPRT_DIED, - XPRT_MOREREQS, - XPRT_IDLE -}; - -/* - * Server side transport handle - */ -typedef struct { - int xp_sock; - u_short xp_port; /* associated port number */ - struct xp_ops { - bool_t (*xp_recv)(DOTS); /* receive incomming requests */ - enum xprt_stat (*xp_stat)(DOTS); /* get transport status */ - bool_t (*xp_getargs)(DOTS); /* get arguments */ - bool_t (*xp_reply)(DOTS); /* send reply */ - bool_t (*xp_freeargs)(DOTS);/* free mem allocated for args */ - void (*xp_destroy)(DOTS); /* destroy this struct */ - } *xp_ops; - int xp_addrlen; /* length of remote address */ - struct sockaddr_in xp_raddr; /* remote address */ - struct opaque_auth xp_verf; /* raw response verifier */ - caddr_t xp_p1; /* private */ - caddr_t xp_p2; /* private */ -} SVCXPRT; - -/* - * Approved way of getting address of caller - */ -#define svc_getcaller(x) (&(x)->xp_raddr) - -/* - * Operations defined on an SVCXPRT handle - * - * SVCXPRT *xprt; - * struct rpc_msg *msg; - * xdrproc_t xargs; - * caddr_t argsp; - */ -#define SVC_RECV(xprt, msg) \ - (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) -#define svc_recv(xprt, msg) \ - (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) - -#define SVC_STAT(xprt) \ - (*(xprt)->xp_ops->xp_stat)(xprt) -#define svc_stat(xprt) \ - (*(xprt)->xp_ops->xp_stat)(xprt) - -#define SVC_GETARGS(xprt, xargs, argsp) \ - (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp)) -#define svc_getargs(xprt, xargs, argsp) \ - (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp)) - -#define SVC_REPLY(xprt, msg) \ - (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) -#define svc_reply(xprt, msg) \ - (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) - -#define SVC_FREEARGS(xprt, xargs, argsp) \ - (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp)) -#define svc_freeargs(xprt, xargs, argsp) \ - (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp)) - -#define SVC_DESTROY(xprt) \ - (*(xprt)->xp_ops->xp_destroy)(xprt) -#define svc_destroy(xprt) \ - (*(xprt)->xp_ops->xp_destroy)(xprt) - - -/* - * Service request - */ -struct svc_req { - u_long rq_prog; /* service program number */ - u_long rq_vers; /* service protocol version */ - u_long rq_proc; /* the desired procedure */ - struct opaque_auth rq_cred; /* raw creds from the wire */ - caddr_t rq_clntcred; /* read only cooked cred */ - SVCXPRT *rq_xprt; /* associated transport */ -}; - - -/* - * Service registration - * - * svc_register(xprt, prog, vers, dispatch, protocol) - * SVCXPRT *xprt; - * u_long prog; - * u_long vers; - * void (*dispatch)(DOTS); - * int protocol; // like TCP or UDP, zero means do not register - */ -extern bool_t svc_register(DOTS); - -/* - * Service un-registration - * - * svc_unregister(prog, vers) - * u_long prog; - * u_long vers; - */ -extern void svc_unregister(DOTS); - -/* - * Transport registration. - * - * xprt_register(xprt) - * SVCXPRT *xprt; - */ -extern void xprt_register(DOTS); - -/* - * Transport un-register - * - * xprt_unregister(xprt) - * SVCXPRT *xprt; - */ -extern void xprt_unregister(DOTS); - - - - -/* - * When the service routine is called, it must first check to see if it - * knows about the procedure; if not, it should call svcerr_noproc - * and return. If so, it should deserialize its arguments via - * SVC_GETARGS (defined above). If the deserialization does not work, - * svcerr_decode should be called followed by a return. Successful - * decoding of the arguments should be followed the execution of the - * procedure's code and a call to svc_sendreply. - * - * Also, if the service refuses to execute the procedure due to too- - * weak authentication parameters, svcerr_weakauth should be called. - * Note: do not confuse access-control failure with weak authentication! - * - * NB: In pure implementations of rpc, the caller always waits for a reply - * msg. This message is sent when svc_sendreply is called. - * Therefore pure service implementations should always call - * svc_sendreply even if the function logically returns void; use - * xdr.h - xdr_void for the xdr routine. HOWEVER, tcp based rpc allows - * for the abuse of pure rpc via batched calling or pipelining. In the - * case of a batched call, svc_sendreply should NOT be called since - * this would send a return message, which is what batching tries to avoid. - * It is the service/protocol writer's responsibility to know which calls are - * batched and which are not. Warning: responding to batch calls may - * deadlock the caller and server processes! - */ - -extern bool_t svc_sendreply(DOTS); -extern void svcerr_decode(DOTS); -extern void svcerr_weakauth(DOTS); -extern void svcerr_noproc(DOTS); -extern void svcerr_progvers(DOTS); -extern void svcerr_auth(DOTS); -extern void svcerr_noprog(DOTS); -extern void svcerr_systemerr(DOTS); - -/* - * Lowest level dispatching -OR- who owns this process anyway. - * Somebody has to wait for incoming requests and then call the correct - * service routine. The routine svc_run does infinite waiting; i.e., - * svc_run never returns. - * Since another (co-existant) package may wish to selectively wait for - * incoming calls or other events outside of the rpc architecture, the - * routine svc_getreq is provided. It must be passed readfds, the - * "in-place" results of a select system call (see select, section 2). - */ - -/* - * Global keeper of rpc service descriptors in use - * dynamic; must be inspected before each call to select - */ -#ifdef FD_SETSIZE -#if defined(WIN32) || defined(WINDOWS_X86) || defined(WINDOWS_X86_GCC) -#ifdef ONCRPCDLL -extern fd_set svc_fdset; -#else -#ifdef __BORLANDC__ -extern __import fd_set svc_fdset; -#else -_declspec(dllimport) fd_set svc_fdset; -#endif -#endif -#else -extern fd_set svc_fdset; -#endif -#define svc_fds svc_fdset.fds_bits[0] /* compatibility */ -#else -extern int svc_fds; -#endif /* def FD_SETSIZE */ - -/* - * a small program implemented by the svc_rpc implementation itself; - * also see clnt.h for protocol numbers. - */ -extern void rpctest_service(DOTS); - -extern void svc_getreq(DOTS); -extern void svc_getreqset(DOTS); /* takes fdset instead of int */ -extern void svc_run(DOTS); /* never returns */ - -/* - * Socket to use on svcxxx_create call to get default socket - */ -#define RPC_ANYSOCK -1 - -/* - * These are the existing service side transport implementations - */ - -/* - * Memory based rpc for testing and timing. - */ -extern SVCXPRT *svcraw_create(DOTS); - -/* - * Udp based rpc. - */ -extern SVCXPRT *svcudp_create(DOTS); -extern SVCXPRT *svcudp_bufcreate(DOTS); - -/* - * Tcp based rpc. - */ -extern SVCXPRT *svctcp_create(DOTS); - -#ifdef __cplusplus -}; -#endif - -#endif /* __SVC_HEADER__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/svc_auth.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/svc_auth.h deleted file mode 100644 index 75e2f232b8..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/svc_auth.h +++ /dev/null @@ -1,58 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)svc_auth.h 2.1 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* @(#)svc_auth.h 1.6 86/07/16 SMI */ - -/* - * svc_auth.h, Service side of rpc authentication. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - - -/* - * Server side authenticator - */ -#ifdef __cplusplus -extern "C" auth_stat _authenticate(...); -#else -extern struct auth_stat _authenticate(); -#endif - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/types.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/types.h deleted file mode 100644 index 41f57b4f19..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/types.h +++ /dev/null @@ -1,87 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)types.h 2.3 88/08/15 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* @(#)types.h 1.18 87/07/24 SMI */ - -/* - * Rpc additions to - */ -#ifndef __TYPES_RPC_HEADER__ -#define __TYPES_RPC_HEADER__ - -#define bool_t int -#define enum_t int -#ifndef FALSE -#define FALSE (0) -#endif -#ifndef TRUE -#define TRUE (1) -#endif -#define __dontcare__ -1 -#ifndef NULL -# define NULL 0 -#endif - -#if ! (defined(WIN32) || defined(WINDOWS_X86) ||defined(WINDOWS_X86_GCC)) -extern char *malloc(); -#endif -#define mem_alloc malloc -#define mem_free(ptr, bsize) free(ptr) - -#ifndef makedev /* ie, we haven't already included it */ -#include -#endif -#if ! (defined(WIN32) || defined(WINDOWS_X86) ||defined(WINDOWS_X86_GCC)) -#include -#endif - -#ifndef INADDR_LOOPBACK -#define INADDR_LOOPBACK (u_long)0x7F000001 -#endif -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 64 -#endif - -typedef char *caddr_t; -typedef unsigned int u_int; -typedef unsigned long u_long; -typedef unsigned short u_short; - -#endif /* ndef __TYPES_RPC_HEADER__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/xdr.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/xdr.h deleted file mode 100644 index 146372c1b3..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/rpc/xdr.h +++ /dev/null @@ -1,292 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)xdr.h 2.2 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* @(#)xdr.h 1.19 87/04/22 SMI */ - -/* - * xdr.h, External Data Representation Serialization Routines. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#ifndef __XDR_HEADER__ -#define __XDR_HEADER__ - -#ifdef __cplusplus -extern "C" { -#define DOTS ... -#else -#define DOTS -#endif - -/* - * XDR provides a conventional way for converting between C data - * types and an external bit-string representation. Library supplied - * routines provide for the conversion on built-in C data types. These - * routines and utility routines defined here are used to help implement - * a type encode/decode routine for each user-defined type. - * - * Each data type provides a single procedure which takes two arguments: - * - * bool_t - * xdrproc(xdrs, argresp) - * XDR *xdrs; - * *argresp; - * - * xdrs is an instance of a XDR handle, to which or from which the data - * type is to be converted. argresp is a pointer to the structure to be - * converted. The XDR handle contains an operation field which indicates - * which of the operations (ENCODE, DECODE * or FREE) is to be performed. - * - * XDR_DECODE may allocate space if the pointer argresp is null. This - * data can be freed with the XDR_FREE operation. - * - * We write only one procedure per data type to make it easy - * to keep the encode and decode procedures for a data type consistent. - * In many cases the same code performs all operations on a user defined type, - * because all the hard work is done in the component type routines. - * decode as a series of calls on the nested data types. - */ - -/* - * Xdr operations. XDR_ENCODE causes the type to be encoded into the - * stream. XDR_DECODE causes the type to be extracted from the stream. - * XDR_FREE can be used to release the space allocated by an XDR_DECODE - * request. - */ -enum xdr_op { - XDR_ENCODE=0, - XDR_DECODE=1, - XDR_FREE=2 -}; - -/* - * This is the number of bytes per unit of external data. - */ -#define BYTES_PER_XDR_UNIT (4) -#define RNDUP(x) ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \ - * BYTES_PER_XDR_UNIT) - -/* - * A xdrproc_t exists for each data type which is to be encoded or decoded. - * - * The second argument to the xdrproc_t is a pointer to an opaque pointer. - * The opaque pointer generally points to a structure of the data type - * to be decoded. If this pointer is 0, then the type routines should - * allocate dynamic storage of the appropriate size and return it. - * bool_t (*xdrproc_t)(XDR *, caddr_t *); - */ -typedef bool_t (*xdrproc_t)(DOTS); - -/* - * The XDR handle. - * Contains operation which is being applied to the stream, - * an operations vector for the paticular implementation (e.g. see xdr_mem.c), - * and two private fields for the use of the particular impelementation. - */ -typedef struct { - enum xdr_op x_op; /* operation; fast additional param */ - struct xdr_ops { - bool_t (*x_getlong)(DOTS); /* get a long from underlying stream */ - bool_t (*x_putlong)(DOTS); /* put a long to " */ - bool_t (*x_getbytes)(DOTS);/* get some bytes from " */ - bool_t (*x_putbytes)(DOTS);/* put some bytes to " */ - u_int (*x_getpostn)(DOTS);/* returns bytes off from beginning */ - bool_t (*x_setpostn)(DOTS);/* lets you reposition the stream */ - long * (*x_inline)(DOTS); /* buf quick ptr to buffered data */ - void (*x_destroy)(DOTS); /* free privates of this xdr_stream */ - } *x_ops; - caddr_t x_public; /* users' data */ - caddr_t x_private; /* pointer to private data */ - caddr_t x_base; /* private used for position info */ - int x_handy; /* extra private word */ -} XDR; - -/* - * Operations defined on a XDR handle - * - * XDR *xdrs; - * long *longp; - * caddr_t addr; - * u_int len; - * u_int pos; - */ -#define XDR_GETLONG(xdrs, longp) \ - (*(xdrs)->x_ops->x_getlong)(xdrs, longp) -#define xdr_getlong(xdrs, longp) \ - (*(xdrs)->x_ops->x_getlong)(xdrs, longp) - -#define XDR_PUTLONG(xdrs, longp) \ - (*(xdrs)->x_ops->x_putlong)(xdrs, longp) -#define xdr_putlong(xdrs, longp) \ - (*(xdrs)->x_ops->x_putlong)(xdrs, longp) - -#define XDR_GETBYTES(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) -#define xdr_getbytes(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) - -#define XDR_PUTBYTES(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) -#define xdr_putbytes(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) - -#define XDR_GETPOS(xdrs) \ - (*(xdrs)->x_ops->x_getpostn)(xdrs) -#define xdr_getpos(xdrs) \ - (*(xdrs)->x_ops->x_getpostn)(xdrs) - -#define XDR_SETPOS(xdrs, pos) \ - (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) -#define xdr_setpos(xdrs, pos) \ - (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) - -#define XDR_INLINE(xdrs, len) \ - (*(xdrs)->x_ops->x_inline)(xdrs, len) -#define xdr_inline(xdrs, len) \ - (*(xdrs)->x_ops->x_inline)(xdrs, len) - -#define XDR_DESTROY(xdrs) \ - if ((xdrs)->x_ops->x_destroy) \ - (*(xdrs)->x_ops->x_destroy)(xdrs) -#define xdr_destroy(xdrs) \ - if ((xdrs)->x_ops->x_destroy) \ - (*(xdrs)->x_ops->x_destroy)(xdrs) - -/* - * Support struct for discriminated unions. - * You create an array of xdrdiscrim structures, terminated with - * a entry with a null procedure pointer. The xdr_union routine gets - * the discriminant value and then searches the array of structures - * for a matching value. If a match is found the associated xdr routine - * is called to handle that part of the union. If there is - * no match, then a default routine may be called. - * If there is no match and no default routine it is an error. - */ -#define NULL_xdrproc_t ((xdrproc_t)0) -struct xdr_discrim { - int value; - xdrproc_t proc; -}; - -/* - * In-line routines for fast encode/decode of primitve data types. - * Caveat emptor: these use single memory cycles to get the - * data from the underlying buffer, and will fail to operate - * properly if the data is not aligned. The standard way to use these - * is to say: - * if ((buf = XDR_INLINE(xdrs, count)) == NULL) - * return (FALSE); - * <<< macro calls >>> - * where ``count'' is the number of bytes of data occupied - * by the primitive data types. - * - * N.B. and frozen for all time: each data type here uses 4 bytes - * of external representation. - */ -#define IXDR_GET_LONG(buf) ((long)ntohl((u_long)*(buf)++)) -#define IXDR_PUT_LONG(buf, v) (*(buf)++ = (long)htonl((u_long)v)) - -#define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf)) -#define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf)) -#define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf)) -#define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf)) -#define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_LONG(buf)) - -#define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) -#define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) -#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) -#define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) -#define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) - -/* - * These are the "generic" xdr routines. - */ -extern bool_t xdr_void(DOTS); -extern bool_t xdr_int(DOTS); -extern bool_t xdr_u_int(DOTS); -extern bool_t xdr_long(DOTS); -extern bool_t xdr_u_long(DOTS); -extern bool_t xdr_short(DOTS); -extern bool_t xdr_u_short(DOTS); -extern bool_t xdr_bool(DOTS); -extern bool_t xdr_enum(DOTS); -extern bool_t xdr_array(DOTS); -extern bool_t xdr_bytes(DOTS); -extern bool_t xdr_opaque(DOTS); -extern bool_t xdr_string(DOTS); -extern bool_t xdr_union(DOTS); -extern bool_t xdr_char(DOTS); -extern bool_t xdr_u_char(DOTS); -extern bool_t xdr_vector(DOTS); -extern bool_t xdr_float(DOTS); -extern bool_t xdr_double(DOTS); -extern bool_t xdr_reference(DOTS); -extern bool_t xdr_pointer(DOTS); -extern bool_t xdr_wrapstring(DOTS); - -/* - * Common opaque bytes objects used by many rpc protocols; - * declared here due to commonality. - */ -#define MAX_NETOBJ_SZ 1024 -struct netobj { - u_int n_len; - char *n_bytes; -}; -typedef struct netobj netobj; -extern bool_t xdr_netobj(DOTS); - -/* - * These are the public routines for the various implementations of - * xdr streams. - */ -extern void xdrmem_create(DOTS); /* XDR using memory buffers */ -extern void xdrstdio_create(DOTS); /* XDR using stdio library */ -extern void xdrrec_create(DOTS); /* XDR pseudo records for tcp */ -extern bool_t xdrrec_endofrecord(DOTS); /* make end of xdr record */ -extern bool_t xdrrec_skiprecord(DOTS); /* move to beginning of next record */ -extern bool_t xdrrec_eof(DOTS); /* true if no more input */ - -#ifdef __cplusplus -}; -#endif - -#endif /* __XDR_HEADER__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/zconf.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/zconf.h deleted file mode 100644 index 7fd735a1d8..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/zconf.h +++ /dev/null @@ -1,279 +0,0 @@ -/* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-1998 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id: zconf.h,v 1.1 2004/09/02 14:43:53 wayne Exp $ */ - -#ifndef _ZCONF_H -#define _ZCONF_H - -/* - * If you *really* need a unique prefix for all types and library functions, - * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. - */ -#ifdef Z_PREFIX -# define deflateInit_ z_deflateInit_ -# define deflate z_deflate -# define deflateEnd z_deflateEnd -# define inflateInit_ z_inflateInit_ -# define inflate z_inflate -# define inflateEnd z_inflateEnd -# define deflateInit2_ z_deflateInit2_ -# define deflateSetDictionary z_deflateSetDictionary -# define deflateCopy z_deflateCopy -# define deflateReset z_deflateReset -# define deflateParams z_deflateParams -# define inflateInit2_ z_inflateInit2_ -# define inflateSetDictionary z_inflateSetDictionary -# define inflateSync z_inflateSync -# define inflateSyncPoint z_inflateSyncPoint -# define inflateReset z_inflateReset -# define compress z_compress -# define compress2 z_compress2 -# define uncompress z_uncompress -# define adler32 z_adler32 -# define crc32 z_crc32 -# define get_crc_table z_get_crc_table - -# define Byte z_Byte -# define uInt z_uInt -# define uLong z_uLong -# define Bytef z_Bytef -# define charf z_charf -# define intf z_intf -# define uIntf z_uIntf -# define uLongf z_uLongf -# define voidpf z_voidpf -# define voidp z_voidp -#endif - -#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) -# define WIN32 -#endif -#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386) -# ifndef __32BIT__ -# define __32BIT__ -# endif -#endif -#if defined(__MSDOS__) && !defined(MSDOS) -# define MSDOS -#endif - -/* - * Compile with -DMAXSEG_64K if the alloc function cannot allocate more - * than 64k bytes at a time (needed on systems with 16-bit int). - */ -#if defined(MSDOS) && !defined(__32BIT__) -# define MAXSEG_64K -#endif -#ifdef MSDOS -# define UNALIGNED_OK -#endif - -#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC) -# define STDC -#endif -#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__) -# ifndef STDC -# define STDC -# endif -#endif - -#ifndef STDC -# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ -# define const -# endif -#endif - -/* Some Mac compilers merge all .h files incorrectly: */ -#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__) -# define NO_DUMMY_DECL -#endif - -/* Old Borland C incorrectly complains about missing returns: */ -#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) -# define NEED_DUMMY_RETURN -#endif - - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# ifdef MAXSEG_64K -# define MAX_MEM_LEVEL 8 -# else -# define MAX_MEM_LEVEL 9 -# endif -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus a few kilobytes - for small objects. -*/ - - /* Type declarations */ - -#ifndef OF /* function prototypes */ -# ifdef STDC -# define OF(args) args -# else -# define OF(args) () -# endif -#endif - -/* The following definitions for FAR are needed only for MSDOS mixed - * model programming (small or medium model with some far allocations). - * This was tested only with MSC; for other MSDOS compilers you may have - * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, - * just define FAR to be empty. - */ -#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__) - /* MSC small or medium model */ -# define SMALL_MEDIUM -# ifdef _MSC_VER -# define FAR _far -# else -# define FAR far -# endif -#endif -#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) -# ifndef __32BIT__ -# define SMALL_MEDIUM -# define FAR _far -# endif -#endif - -/* Compile with -DZLIB_DLL for Windows DLL support */ -#if defined(ZLIB_DLL) -# if defined(_WINDOWS) || defined(WINDOWS) -# ifdef FAR -# undef FAR -# endif -# include -# define ZEXPORT WINAPI -# ifdef WIN32 -# define ZEXPORTVA WINAPIV -# else -# define ZEXPORTVA FAR _cdecl _export -# endif -# endif -# if defined (__BORLANDC__) -# if (__BORLANDC__ >= 0x0500) && defined (WIN32) -# include -# define ZEXPORT __declspec(dllexport) WINAPI -# define ZEXPORTRVA __declspec(dllexport) WINAPIV -# else -# if defined (_Windows) && defined (__DLL__) -# define ZEXPORT _export -# define ZEXPORTVA _export -# endif -# endif -# endif -#endif - -#if defined (__BEOS__) -# if defined (ZLIB_DLL) -# define ZEXTERN extern __declspec(dllexport) -# else -# define ZEXTERN extern __declspec(dllimport) -# endif -#endif - -#ifndef ZEXPORT -# define ZEXPORT -#endif -#ifndef ZEXPORTVA -# define ZEXPORTVA -#endif -#ifndef ZEXTERN -# define ZEXTERN extern -#endif - -#ifndef FAR -# define FAR -#endif - -#if !defined(MACOS) && !defined(TARGET_OS_MAC) -typedef unsigned char Byte; /* 8 bits */ -#endif -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ - -#ifdef SMALL_MEDIUM - /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ -# define Bytef Byte FAR -#else - typedef Byte FAR Bytef; -#endif -typedef char FAR charf; -typedef int FAR intf; -typedef uInt FAR uIntf; -typedef uLong FAR uLongf; - -#ifdef STDC - typedef void FAR *voidpf; - typedef void *voidp; -#else - typedef Byte FAR *voidpf; - typedef Byte *voidp; -#endif - -#ifdef HAVE_UNISTD_H -# include /* for off_t */ -# include /* for SEEK_* and off_t */ -# define z_off_t off_t -#endif -#ifndef SEEK_SET -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif -#ifndef z_off_t -# define z_off_t long -#endif - -/* MVS linker does not support external names larger than 8 bytes */ -#if defined(__MVS__) -# pragma map(deflateInit_,"DEIN") -# pragma map(deflateInit2_,"DEIN2") -# pragma map(deflateEnd,"DEEND") -# pragma map(inflateInit_,"ININ") -# pragma map(inflateInit2_,"ININ2") -# pragma map(inflateEnd,"INEND") -# pragma map(inflateSync,"INSY") -# pragma map(inflateSetDictionary,"INSEDI") -# pragma map(inflate_blocks,"INBL") -# pragma map(inflate_blocks_new,"INBLNE") -# pragma map(inflate_blocks_free,"INBLFR") -# pragma map(inflate_blocks_reset,"INBLRE") -# pragma map(inflate_codes_free,"INCOFR") -# pragma map(inflate_codes,"INCO") -# pragma map(inflate_fast,"INFA") -# pragma map(inflate_flush,"INFLU") -# pragma map(inflate_mask,"INMA") -# pragma map(inflate_set_dictionary,"INSEDI2") -# pragma map(inflate_copyright,"INCOPY") -# pragma map(inflate_trees_bits,"INTRBI") -# pragma map(inflate_trees_dynamic,"INTRDY") -# pragma map(inflate_trees_fixed,"INTRFI") -# pragma map(inflate_trees_free,"INTRFR") -#endif - -#endif /* _ZCONF_H */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/zlib.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/zlib.h deleted file mode 100644 index da424f3f1e..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/include/zlib.h +++ /dev/null @@ -1,893 +0,0 @@ -/* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.1.3, July 9th, 1998 - - Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - - - The data format used by the zlib library is described by RFCs (Request for - Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt - (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). -*/ - -#ifndef _ZLIB_H -#define _ZLIB_H - -#include "zconf.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define ZLIB_VERSION "1.1.3" - -/* - The 'zlib' compression library provides in-memory compression and - decompression functions, including integrity checks of the uncompressed - data. This version of the library supports only one compression method - (deflation) but other algorithms will be added later and will have the same - stream interface. - - Compression can be done in a single step if the buffers are large - enough (for example if an input file is mmap'ed), or can be done by - repeated calls of the compression function. In the latter case, the - application must provide more input and/or consume the output - (providing more output space) before each call. - - The library also supports reading and writing files in gzip (.gz) format - with an interface similar to that of stdio. - - The library does not install any signal handler. The decoder checks - the consistency of the compressed data, so the library should never - crash even in case of corrupted input. -*/ - -typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); -typedef void (*free_func) OF((voidpf opaque, voidpf address)); - -struct internal_state; - -typedef struct z_stream_s { - Bytef *next_in; /* next input byte */ - uInt avail_in; /* number of bytes available at next_in */ - uLong total_in; /* total nb of input bytes read so far */ - - Bytef *next_out; /* next output byte should be put there */ - uInt avail_out; /* remaining free space at next_out */ - uLong total_out; /* total nb of bytes output so far */ - - char *msg; /* last error message, NULL if no error */ - struct internal_state FAR *state; /* not visible by applications */ - - alloc_func zalloc; /* used to allocate the internal state */ - free_func zfree; /* used to free the internal state */ - voidpf opaque; /* private data object passed to zalloc and zfree */ - - int data_type; /* best guess about the data type: ascii or binary */ - uLong adler; /* adler32 value of the uncompressed data */ - uLong reserved; /* reserved for future use */ -} z_stream; - -typedef z_stream FAR *z_streamp; - -/* - The application must update next_in and avail_in when avail_in has - dropped to zero. It must update next_out and avail_out when avail_out - has dropped to zero. The application must initialize zalloc, zfree and - opaque before calling the init function. All other fields are set by the - compression library and must not be updated by the application. - - The opaque value provided by the application will be passed as the first - parameter for calls of zalloc and zfree. This can be useful for custom - memory management. The compression library attaches no meaning to the - opaque value. - - zalloc must return Z_NULL if there is not enough memory for the object. - If zlib is used in a multi-threaded application, zalloc and zfree must be - thread safe. - - On 16-bit systems, the functions zalloc and zfree must be able to allocate - exactly 65536 bytes, but will not be required to allocate more than this - if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, - pointers returned by zalloc for objects of exactly 65536 bytes *must* - have their offset normalized to zero. The default allocation function - provided by this library ensures this (see zutil.c). To reduce memory - requirements and avoid any allocation of 64K objects, at the expense of - compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). - - The fields total_in and total_out can be used for statistics or - progress reports. After compression, total_in holds the total size of - the uncompressed data and may be saved for use in the decompressor - (particularly if the decompressor wants to decompress everything in - a single step). -*/ - - /* constants */ - -#define Z_NO_FLUSH 0 -#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ -#define Z_SYNC_FLUSH 2 -#define Z_FULL_FLUSH 3 -#define Z_FINISH 4 -/* Allowed flush values; see deflate() below for details */ - -#define Z_OK 0 -#define Z_STREAM_END 1 -#define Z_NEED_DICT 2 -#define Z_ERRNO (-1) -#define Z_STREAM_ERROR (-2) -#define Z_DATA_ERROR (-3) -#define Z_MEM_ERROR (-4) -#define Z_BUF_ERROR (-5) -#define Z_VERSION_ERROR (-6) -/* Return codes for the compression/decompression functions. Negative - * values are errors, positive values are used for special but normal events. - */ - -#define Z_NO_COMPRESSION 0 -#define Z_BEST_SPEED 1 -#define Z_BEST_COMPRESSION 9 -#define Z_DEFAULT_COMPRESSION (-1) -/* compression levels */ - -#define Z_FILTERED 1 -#define Z_HUFFMAN_ONLY 2 -#define Z_DEFAULT_STRATEGY 0 -/* compression strategy; see deflateInit2() below for details */ - -#define Z_BINARY 0 -#define Z_ASCII 1 -#define Z_UNKNOWN 2 -/* Possible values of the data_type field */ - -#define Z_DEFLATED 8 -/* The deflate compression method (the only one supported in this version) */ - -#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ - -#define zlib_version zlibVersion() -/* for compatibility with versions < 1.0.2 */ - - /* basic functions */ - -ZEXTERN char const *ZEXPORT zlibVersion OF((void)); -/* The application can compare zlibVersion and ZLIB_VERSION for consistency. - If the first character differs, the library code actually used is - not compatible with the zlib.h header file used by the application. - This check is automatically made by deflateInit and inflateInit. - */ - -/* -ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); - - Initializes the internal stream state for compression. The fields - zalloc, zfree and opaque must be initialized before by the caller. - If zalloc and zfree are set to Z_NULL, deflateInit updates them to - use default allocation functions. - - The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: - 1 gives best speed, 9 gives best compression, 0 gives no compression at - all (the input data is simply copied a block at a time). - Z_DEFAULT_COMPRESSION requests a default compromise between speed and - compression (currently equivalent to level 6). - - deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if level is not a valid compression level, - Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible - with the version assumed by the caller (ZLIB_VERSION). - msg is set to null if there is no error message. deflateInit does not - perform any compression: this will be done by deflate(). -*/ - - -ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); -/* - deflate compresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce some - output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. deflate performs one or both of the - following actions: - - - Compress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in and avail_in are updated and - processing will resume at this point for the next call of deflate(). - - - Provide more output starting at next_out and update next_out and avail_out - accordingly. This action is forced if the parameter flush is non zero. - Forcing flush frequently degrades the compression ratio, so this parameter - should be set only when necessary (in interactive applications). - Some output may be provided even if flush is not set. - - Before the call of deflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming - more output, and updating avail_in or avail_out accordingly; avail_out - should never be zero before the call. The application can consume the - compressed output when it wants, for example when the output buffer is full - (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK - and with zero avail_out, it must be called again after making room in the - output buffer because there might be more output pending. - - If the parameter flush is set to Z_SYNC_FLUSH, all pending output is - flushed to the output buffer and the output is aligned on a byte boundary, so - that the decompressor can get all input data available so far. (In particular - avail_in is zero after the call if enough output space has been provided - before the call.) Flushing may degrade compression for some compression - algorithms and so it should be used only when necessary. - - If flush is set to Z_FULL_FLUSH, all output is flushed as with - Z_SYNC_FLUSH, and the compression state is reset so that decompression can - restart from this point if previous compressed data has been damaged or if - random access is desired. Using Z_FULL_FLUSH too often can seriously degrade - the compression. - - If deflate returns with avail_out == 0, this function must be called again - with the same value of the flush parameter and more output space (updated - avail_out), until the flush is complete (deflate returns with non-zero - avail_out). - - If the parameter flush is set to Z_FINISH, pending input is processed, - pending output is flushed and deflate returns with Z_STREAM_END if there - was enough output space; if deflate returns with Z_OK, this function must be - called again with Z_FINISH and more output space (updated avail_out) but no - more input data, until it returns with Z_STREAM_END or an error. After - deflate has returned Z_STREAM_END, the only possible operations on the - stream are deflateReset or deflateEnd. - - Z_FINISH can be used immediately after deflateInit if all the compression - is to be done in a single step. In this case, avail_out must be at least - 0.1% larger than avail_in plus 12 bytes. If deflate does not return - Z_STREAM_END, then it must be called again as described above. - - deflate() sets strm->adler to the adler32 checksum of all input read - so far (that is, total_in bytes). - - deflate() may update data_type if it can make a good guess about - the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered - binary. This field is only for information purposes and does not affect - the compression algorithm in any manner. - - deflate() returns Z_OK if some progress has been made (more input - processed or more output produced), Z_STREAM_END if all input has been - consumed and all output has been produced (only when flush is set to - Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible - (for example avail_in or avail_out was zero). -*/ - - -ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any - pending output. - - deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the - stream state was inconsistent, Z_DATA_ERROR if the stream was freed - prematurely (some input or output was discarded). In the error case, - msg may be set but then points to a static string (which must not be - deallocated). -*/ - - -/* -ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); - - Initializes the internal stream state for decompression. The fields - next_in, avail_in, zalloc, zfree and opaque must be initialized before by - the caller. If next_in is not Z_NULL and avail_in is large enough (the exact - value depends on the compression method), inflateInit determines the - compression method from the zlib header and allocates all data structures - accordingly; otherwise the allocation will be deferred to the first call of - inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to - use default allocation functions. - - inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller. msg is set to null if there is no error - message. inflateInit does not perform any decompression apart from reading - the zlib header if present: this will be done by inflate(). (So next_in and - avail_in may be modified, but next_out and avail_out are unchanged.) -*/ - - -ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); -/* - inflate decompresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may some - introduce some output latency (reading input without producing any output) - except when forced to flush. - - The detailed semantics are as follows. inflate performs one or both of the - following actions: - - - Decompress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in is updated and processing - will resume at this point for the next call of inflate(). - - - Provide more output starting at next_out and update next_out and avail_out - accordingly. inflate() provides as much output as possible, until there - is no more input data or no more space in the output buffer (see below - about the flush parameter). - - Before the call of inflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming - more output, and updating the next_* and avail_* values accordingly. - The application can consume the uncompressed output when it wants, for - example when the output buffer is full (avail_out == 0), or after each - call of inflate(). If inflate returns Z_OK and with zero avail_out, it - must be called again after making room in the output buffer because there - might be more output pending. - - If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much - output as possible to the output buffer. The flushing behavior of inflate is - not specified for values of the flush parameter other than Z_SYNC_FLUSH - and Z_FINISH, but the current implementation actually flushes as much output - as possible anyway. - - inflate() should normally be called until it returns Z_STREAM_END or an - error. However if all decompression is to be performed in a single step - (a single call of inflate), the parameter flush should be set to - Z_FINISH. In this case all pending input is processed and all pending - output is flushed; avail_out must be large enough to hold all the - uncompressed data. (The size of the uncompressed data may have been saved - by the compressor for this purpose.) The next operation on this stream must - be inflateEnd to deallocate the decompression state. The use of Z_FINISH - is never required, but can be used to inform inflate that a faster routine - may be used for the single inflate() call. - - If a preset dictionary is needed at this point (see inflateSetDictionary - below), inflate sets strm-adler to the adler32 checksum of the - dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise - it sets strm->adler to the adler32 checksum of all output produced - so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or - an error code as described below. At the end of the stream, inflate() - checks that its computed adler32 checksum is equal to that saved by the - compressor and returns Z_STREAM_END only if the checksum is correct. - - inflate() returns Z_OK if some progress has been made (more input processed - or more output produced), Z_STREAM_END if the end of the compressed data has - been reached and all uncompressed output has been produced, Z_NEED_DICT if a - preset dictionary is needed at this point, Z_DATA_ERROR if the input data was - corrupted (input stream not conforming to the zlib format or incorrect - adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent - (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if no progress is possible or if there was not - enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR - case, the application may then call inflateSync to look for a good - compression block. -*/ - - -ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any - pending output. - - inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state - was inconsistent. In the error case, msg may be set but then points to a - static string (which must not be deallocated). -*/ - - /* Advanced functions */ - -/* - The following functions are needed only in some special applications. -*/ - -/* -ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, - int level, - int method, - int windowBits, - int memLevel, - int strategy)); - - This is another version of deflateInit with more compression options. The - fields next_in, zalloc, zfree and opaque must be initialized before by - the caller. - - The method parameter is the compression method. It must be Z_DEFLATED in - this version of the library. - - The windowBits parameter is the base two logarithm of the window size - (the size of the history buffer). It should be in the range 8..15 for this - version of the library. Larger values of this parameter result in better - compression at the expense of memory usage. The default value is 15 if - deflateInit is used instead. - - The memLevel parameter specifies how much memory should be allocated - for the internal compression state. memLevel=1 uses minimum memory but - is slow and reduces compression ratio; memLevel=9 uses maximum memory - for optimal speed. The default value is 8. See zconf.h for total memory - usage as a function of windowBits and memLevel. - - The strategy parameter is used to tune the compression algorithm. Use the - value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a - filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no - string match). Filtered data consists mostly of small values with a - somewhat random distribution. In this case, the compression algorithm is - tuned to compress them better. The effect of Z_FILTERED is to force more - Huffman coding and less string matching; it is somewhat intermediate - between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects - the compression ratio but not the correctness of the compressed output even - if it is not set appropriately. - - deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid - method). msg is set to null if there is no error message. deflateInit2 does - not perform any compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, - Bytef const *dictionary, - uInt dictLength)); -/* - Initializes the compression dictionary from the given byte sequence - without producing any compressed output. This function must be called - immediately after deflateInit, deflateInit2 or deflateReset, before any - call of deflate. The compressor and decompressor must use exactly the same - dictionary (see inflateSetDictionary). - - The dictionary should consist of strings (byte sequences) that are likely - to be encountered later in the data to be compressed, with the most commonly - used strings preferably put towards the end of the dictionary. Using a - dictionary is most useful when the data to be compressed is short and can be - predicted with good accuracy; the data can then be compressed better than - with the default empty dictionary. - - Depending on the size of the compression data structures selected by - deflateInit or deflateInit2, a part of the dictionary may in effect be - discarded, for example if the dictionary is larger than the window size in - deflate or deflate2. Thus the strings most likely to be useful should be - put at the end of the dictionary, not at the front. - - Upon return of this function, strm->adler is set to the Adler32 value - of the dictionary; the decompressor may later use this value to determine - which dictionary has been used by the compressor. (The Adler32 value - applies to the whole dictionary even if only a subset of the dictionary is - actually used by the compressor.) - - deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is - inconsistent (for example if deflate has already been called for this stream - or if the compression method is bsort). deflateSetDictionary does not - perform any compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, - z_streamp source)); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when several compression strategies will be - tried, for example when there are several ways of pre-processing the input - data with a filter. The streams that will be discarded should then be freed - by calling deflateEnd. Note that deflateCopy duplicates the internal - compression state which can be quite large, so this strategy is slow and - can consume lots of memory. - - deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); -/* - This function is equivalent to deflateEnd followed by deflateInit, - but does not free and reallocate all the internal compression state. - The stream will keep the same compression level and any other attributes - that may have been set by deflateInit2. - - deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). -*/ - -ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, - int level, - int strategy)); -/* - Dynamically update the compression level and compression strategy. The - interpretation of level and strategy is as in deflateInit2. This can be - used to switch between compression and straight copy of the input data, or - to switch to a different kind of input data requiring a different - strategy. If the compression level is changed, the input available so far - is compressed with the old level (and may be flushed); the new level will - take effect only at the next call of deflate(). - - Before the call of deflateParams, the stream state must be set as for - a call of deflate(), since the currently available input may have to - be compressed and flushed. In particular, strm->avail_out must be non-zero. - - deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source - stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR - if strm->avail_out was zero. -*/ - -/* -ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, - int windowBits)); - - This is another version of inflateInit with an extra parameter. The - fields next_in, avail_in, zalloc, zfree and opaque must be initialized - before by the caller. - - The windowBits parameter is the base two logarithm of the maximum window - size (the size of the history buffer). It should be in the range 8..15 for - this version of the library. The default value is 15 if inflateInit is used - instead. If a compressed stream with a larger window size is given as - input, inflate() will return with the error code Z_DATA_ERROR instead of - trying to allocate a larger window. - - inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative - memLevel). msg is set to null if there is no error message. inflateInit2 - does not perform any decompression apart from reading the zlib header if - present: this will be done by inflate(). (So next_in and avail_in may be - modified, but next_out and avail_out are unchanged.) -*/ - -ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, - Bytef const *dictionary, - uInt dictLength)); -/* - Initializes the decompression dictionary from the given uncompressed byte - sequence. This function must be called immediately after a call of inflate - if this call returned Z_NEED_DICT. The dictionary chosen by the compressor - can be determined from the Adler32 value returned by this call of - inflate. The compressor and decompressor must use exactly the same - dictionary (see deflateSetDictionary). - - inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is - inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the - expected one (incorrect Adler32 value). inflateSetDictionary does not - perform any decompression: this will be done by subsequent calls of - inflate(). -*/ - -ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); -/* - Skips invalid compressed data until a full flush point (see above the - description of deflate with Z_FULL_FLUSH) can be found, or until all - available input is skipped. No output is provided. - - inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR - if no more input was provided, Z_DATA_ERROR if no flush point has been found, - or Z_STREAM_ERROR if the stream structure was inconsistent. In the success - case, the application may save the current current value of total_in which - indicates where valid compressed data was found. In the error case, the - application may repeatedly call inflateSync, providing more input each time, - until success or end of the input data. -*/ - -ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); -/* - This function is equivalent to inflateEnd followed by inflateInit, - but does not free and reallocate all the internal decompression state. - The stream will keep attributes that may have been set by inflateInit2. - - inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). -*/ - - - /* utility functions */ - -/* - The following utility functions are implemented on top of the - basic stream-oriented functions. To simplify the interface, some - default options are assumed (compression level and memory usage, - standard memory allocation functions). The source code of these - utility functions can easily be modified if you need special options. -*/ - -ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, - Bytef const *source, uLong sourceLen)); -/* - Compresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be at least 0.1% larger than - sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the - compressed buffer. - This function can be used to compress a whole file at once if the - input file is mmap'ed. - compress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer. -*/ - -ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, - Bytef const *source, uLong sourceLen, - int level)); -/* - Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least 0.1% larger than sourceLen plus - 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. - - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -*/ - -ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, - Bytef const *source, uLong sourceLen)); -/* - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be large enough to hold the - entire uncompressed data. (The size of the uncompressed data must have - been saved previously by the compressor and transmitted to the decompressor - by some mechanism outside the scope of this compression library.) - Upon exit, destLen is the actual size of the compressed buffer. - This function can be used to decompress a whole file at once if the - input file is mmap'ed. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted. -*/ - - -typedef voidp gzFile; - -ZEXTERN gzFile ZEXPORT gzopen OF((char const *path, char const *mode)); -/* - Opens a gzip (.gz) file for reading or writing. The mode parameter - is as in fopen ("rb" or "wb") but can also include a compression level - ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for - Huffman only compression as in "wb1h". (See the description - of deflateInit2 for more information about the strategy parameter.) - - gzopen can be used to read a file which is not in gzip format; in this - case gzread will directly read from the file without decompression. - - gzopen returns NULL if the file could not be opened or if there was - insufficient memory to allocate the (de)compression state; errno - can be checked to distinguish the two cases (if errno is zero, the - zlib error is Z_MEM_ERROR). */ - -ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, char const *mode)); -/* - gzdopen() associates a gzFile with the file descriptor fd. File - descriptors are obtained from calls like open, dup, creat, pipe or - fileno (in the file has been previously opened with fopen). - The mode parameter is as in gzopen. - The next call of gzclose on the returned gzFile will also close the - file descriptor fd, just like fclose(fdopen(fd), mode) closes the file - descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). - gzdopen returns NULL if there was insufficient memory to allocate - the (de)compression state. -*/ - -ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); -/* - Dynamically update the compression level or strategy. See the description - of deflateInit2 for the meaning of these parameters. - gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not - opened for writing. -*/ - -ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); -/* - Reads the given number of uncompressed bytes from the compressed file. - If the input file was not in gzip format, gzread copies the given number - of bytes into the buffer. - gzread returns the number of uncompressed bytes actually read (0 for - end of file, -1 for error). */ - -ZEXTERN int ZEXPORT gzwrite OF((gzFile file, - voidp const buf, unsigned len)); -/* - Writes the given number of uncompressed bytes into the compressed file. - gzwrite returns the number of uncompressed bytes actually written - (0 in case of error). -*/ - -ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, char const *format, ...)); -/* - Converts, formats, and writes the args to the compressed file under - control of the format string, as in fprintf. gzprintf returns the number of - uncompressed bytes actually written (0 in case of error). -*/ - -ZEXTERN int ZEXPORT gzputs OF((gzFile file, char const *s)); -/* - Writes the given null-terminated string to the compressed file, excluding - the terminating null character. - gzputs returns the number of characters written, or -1 in case of error. -*/ - -ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); -/* - Reads bytes from the compressed file until len-1 characters are read, or - a newline character is read and transferred to buf, or an end-of-file - condition is encountered. The string is then terminated with a null - character. - gzgets returns buf, or Z_NULL in case of error. -*/ - -ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); -/* - Writes c, converted to an unsigned char, into the compressed file. - gzputc returns the value that was written, or -1 in case of error. -*/ - -ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); -/* - Reads one byte from the compressed file. gzgetc returns this byte - or -1 in case of end of file or error. -*/ - -ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); -/* - Flushes all pending output into the compressed file. The parameter - flush is as in the deflate() function. The return value is the zlib - error number (see function gzerror below). gzflush returns Z_OK if - the flush parameter is Z_FINISH and all output could be flushed. - gzflush should be called only when strictly necessary because it can - degrade compression. -*/ - -ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, - z_off_t offset, int whence)); -/* - Sets the starting position for the next gzread or gzwrite on the - given compressed file. The offset represents a number of bytes in the - uncompressed data stream. The whence parameter is defined as in lseek(2); - the value SEEK_END is not supported. - If the file is opened for reading, this function is emulated but can be - extremely slow. If the file is opened for writing, only forward seeks are - supported; gzseek then compresses a sequence of zeroes up to the new - starting position. - - gzseek returns the resulting offset location as measured in bytes from - the beginning of the uncompressed stream, or -1 in case of error, in - particular if the file is opened for writing and the new starting position - would be before the current position. -*/ - -ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); -/* - Rewinds the given file. This function is supported only for reading. - - gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) -*/ - -ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); -/* - Returns the starting position for the next gzread or gzwrite on the - given compressed file. This position represents a number of bytes in the - uncompressed data stream. - - gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) -*/ - -ZEXTERN int ZEXPORT gzeof OF((gzFile file)); -/* - Returns 1 when EOF has previously been detected reading the given - input stream, otherwise zero. -*/ - -ZEXTERN int ZEXPORT gzclose OF((gzFile file)); -/* - Flushes all pending output if necessary, closes the compressed file - and deallocates all the (de)compression state. The return value is the zlib - error number (see function gzerror below). -*/ - -ZEXTERN char const *ZEXPORT gzerror OF((gzFile file, int *errnum)); -/* - Returns the error message for the last error which occurred on the - given compressed file. errnum is set to zlib error number. If an - error occurred in the file system and not in the compression library, - errnum is set to Z_ERRNO and the application may consult errno - to get the exact error code. -*/ - - /* checksum functions */ - -/* - These functions are not related to compression but are exported - anyway because they might be useful in applications using the - compression library. -*/ - -ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, Bytef const *buf, uInt len)); - -/* - Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is NULL, this function returns - the required initial value for the checksum. - An Adler-32 checksum is almost as reliable as a CRC32 but can be computed - much faster. Usage example: - - uLong adler = adler32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - adler = adler32(adler, buffer, length); - } - if (adler != original_adler) error(); -*/ - -ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, Bytef const *buf, uInt len)); -/* - Update a running crc with the bytes buf[0..len-1] and return the updated - crc. If buf is NULL, this function returns the required initial value - for the crc. Pre- and post-conditioning (one's complement) is performed - within this function so it shouldn't be done by the application. - Usage example: - - uLong crc = crc32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - crc = crc32(crc, buffer, length); - } - if (crc != original_crc) error(); -*/ - - - /* various hacks, don't look :) */ - -/* deflateInit and inflateInit are macros to allow checking the zlib version - * and the compiler's view of z_stream: - */ -ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, - char const *version, int stream_size)); -ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, - char const *version, int stream_size)); -ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, - int windowBits, int memLevel, - int strategy, char const *version, - int stream_size)); -ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, - char const *version, int stream_size)); -#define deflateInit(strm, level) \ - deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) -#define inflateInit(strm) \ - inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) -#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ - deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ - (strategy), ZLIB_VERSION, sizeof(z_stream)) -#define inflateInit2(strm, windowBits) \ - inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) - - -#if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL) - struct internal_state {int dummy;}; /* hack for buggy compilers */ -#endif - -ZEXTERN char const *ZEXPORT zError OF((int err)); -ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); -ZEXTERN uLongf const *ZEXPORT get_crc_table OF((void)); - -#ifdef __cplusplus -} -#endif - -#endif /* _ZLIB_H */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/lib/.cvsignore b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/lib/.cvsignore deleted file mode 100644 index aa6c7eb936..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/lib/.cvsignore +++ /dev/null @@ -1,36 +0,0 @@ -*.pro -*~ -Makefile.cartesian -Makefile.cfev -Makefile.cfevtest -Makefile.collapser -Makefile.common -Makefile.compatibility -Makefile.convex_decomp -Makefile.core -Makefile.corealg -Makefile.coreio -Makefile.geometry -Makefile.interf -Makefile.license -Makefile.linalg -Makefile.meshercommon -Makefile.mkprogen -Makefile.mkprospec -Makefile.newsurface -Makefile.newvolume -Makefile.octree -Makefile.pipeline -Makefile.resurfacer -Makefile.robustgeometry -Makefile.surface -Makefile.surfacerepair -Makefile.surfacewrapper -Makefile.test -Makefile.viewcommon -Makefile.voxelmesher -make.*.list* -qmake.vars -test.general.log -test.specific.log -zzzz* diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/lib/glib-1.3.dll b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/lib/glib-1.3.dll deleted file mode 100644 index b3d65ec500..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/lib/glib-1.3.dll and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/lib/iconv-1.3.dll b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/lib/iconv-1.3.dll deleted file mode 100644 index 8b60105628..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/lib/iconv-1.3.dll and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/lib/oncrpc.dll b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/lib/oncrpc.dll deleted file mode 100644 index 7d6f68bf32..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/lib/oncrpc.dll and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/qmake.conf b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/qmake.conf deleted file mode 100644 index b9a3edfca6..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/qmake.conf +++ /dev/null @@ -1,112 +0,0 @@ -# -# $Id: qmake.conf,v 1.2 2004/11/03 19:34:56 wayne Exp $ -# -# qmake configuration for win32-g++ -# -# Written for MinGW -# - -MAKEFILE_GENERATOR = UNIX -TEMPLATE = app -CONFIG += qt warn_on release link_prl -#DEFINES += UNICODE - -exists( $(QTDIR)\.qtwinconfig ) { - include( $(QTDIR)\.qtwinconfig ) -} - -QMAKE_DIR_SEP = / - -QMAKE_CC = gcc -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = byacc -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -QMAKE_CFLAGS_DEPS = -M -QMAKE_CFLAGS_WARN_ON = -Wall -QMAKE_CFLAGS_WARN_OFF = -w -QMAKE_CFLAGS_RELEASE = -O3 -QMAKE_CFLAGS_DEBUG = -g -QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses -QMAKE_CFLAGS_THREAD = -mthreads -#QMAKE_CFLAGS_RTTI_ON = -frtti -#QMAKE_CFLAGS_RTTI_OFF = -fno-rtti -#QMAKE_CFLAGS_EXCEPTIONS_ON = -fexceptions -#QMAKE_CFLAGS_EXCEPTIONS_OFF = -fno-exceptions - -QMAKE_CXX = g++ -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD -QMAKE_CXXFLAGS_RTTI_ON = $$QMAKE_CFLAGS_RTTI_ON -QMAKE_CXXFLAGS_RTTI_OFF = $$QMAKE_CFLAGS_RTTI_OFF -QMAKE_CXXFLAGS_EXCEPTIONS_ON = $$QMAKE_CFLAGS_EXCEPTIONS_ON -QMAKE_CXXFLAGS_EXCEPTIONS_OFF = $$QMAKE_CFLAGS_EXCEPTIONS_OFF - -QMAKE_INCDIR = -QMAKE_INCDIR_QT = $(QTDIR)\include -QMAKE_LIBDIR_QT = $(QTDIR)\lib - -QMAKE_RUN_CC = $(CC) -c $(CFLAGS) $(INCPATH) -o $obj $src -QMAKE_RUN_CC_IMP = $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< -QMAKE_RUN_CXX = $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $obj $src -QMAKE_RUN_CXX_IMP = $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< - -QMAKE_LINK = g++ -QMAKE_LFLAGS = -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -QMAKE_LFLAGS_RELEASE = -Wl,-s -QMAKE_LFLAGS_DEBUG = -QMAKE_LFLAGS_SHLIB = -shared -QMAKE_LFLAGS_THREAD = -mthreads -QMAKE_LFLAGS_CONSOLE = -Wl,-subsystem,console -QMAKE_LFLAGS_WINDOWS = -Wl,-subsystem,windows -e __Z19QtWinMainCRTStartupv -QMAKE_LFLAGS_CONSOLE_DLL= -Wl,-subsystem,console -shared -Wl,--export-all-symbols -QMAKE_LFLAGS_WINDOWS_DLL= -Wl,-subsystem,windows -shared -Wl,--export-all-symbols -QMAKE_LINK_OBJECT_MAX = 10 -QMAKE_LINK_OBJECT_SCRIPT= object_ld_script -QMAKE_LINK_OBJMOC_SCRIPT= objmoc_ld_script - -QMAKE_LIBS = -QMAKE_LIBS_CONSOLE = -QMAKE_LIBS_WINDOWS = -lkernel32 -luser32 -lgdi32 -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -limm32 -lwinmm -lwsock32 -lwinspool -QMAKE_LIBS_QT = -lqt -QMAKE_LIBS_QT_THREAD = -lqt-mt -QMAKE_LIBS_QT_ENTRY = -lqtmain - -QMAKE_LIBS_OPENGL = -lopengl32 -lglu32 - -QMAKE_MOC = $(QTDIR)\bin\moc.exe -QMAKE_UIC = $(QTDIR)\bin\uic.exe -QMAKE_IDC = $(QTDIR)\bin\idc.exe - -QMAKE_IDL = midl -QMAKE_LIB = lib /NOLOGO -QMAKE_RC = rc - -QMAKE_AR = ar cqs -QMAKE_RANLIB = - -QMAKE_ZIP = zip -r -9 - -QMAKE_COPY = cp -f -p -QMAKE_COPY_FILE = $(COPY) -QMAKE_COPY_DIR = $(COPY) -r -QMAKE_MOVE = mv -f -QMAKE_DEL_FILE = rm -f -QMAKE_DEL_DIR = rmdir -QMAKE_CHK_DIR_EXISTS = test -d -QMAKE_MKDIR = mkdir -p -#QMAKE_STRIP = strip -#QMAKE_STRIPFLAGS_LIB += --strip-unneeded - -# added options for MeshKernel: -DEFINES += WINDOWS_X86_GCC -MK_BUILDNAME = windows-x86-gcc -MK_LIBS_STLPORT = -lstlport_mingw32_static -MK_LIBS_STLPORT_DEBUG = -lstlport_mingw32_stldebug_static diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/qmake.exe b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/qmake.exe deleted file mode 100644 index 28b9016bd9..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/qmake.exe and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/qplatformdefs.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/qplatformdefs.h deleted file mode 100644 index 9f4d318d8b..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86-gcc/qplatformdefs.h +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H - -#ifdef UNICODE -#ifndef _UNICODE -#define _UNICODE -#endif -#endif - -// Get Qt defines/settings - -#include "qglobal.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if !defined(_WIN32_WINNT) || (_WIN32_WINNT-0 < 0x0500) -typedef enum { - NameUnknown = 0, - NameFullyQualifiedDN = 1, - NameSamCompatible = 2, - NameDisplay = 3, - NameUniqueId = 6, - NameCanonical = 7, - NameUserPrincipal = 8, - NameCanonicalEx = 9, - NameServicePrincipal = 10, - NameDnsDomain = 12 -} EXTENDED_NAME_FORMAT, *PEXTENDED_NAME_FORMAT; -#endif - -#define Q_FS_FAT -#ifdef QT_LARGEFILE_SUPPORT -#define QT_STATBUF struct _stati64 // non-ANSI defs -#define QT_STATBUF4TSTAT struct _stati64 // non-ANSI defs -#define QT_STAT ::_stati64 -#define QT_FSTAT ::_fstati64 -#else -#define QT_STATBUF struct _stat // non-ANSI defs -#define QT_STATBUF4TSTAT struct _stat // non-ANSI defs -#define QT_STAT ::_stat -#define QT_FSTAT ::_fstat -#endif -#define QT_STAT_REG _S_IFREG -#define QT_STAT_DIR _S_IFDIR -#define QT_STAT_MASK _S_IFMT -#if defined(_S_IFLNK) -# define QT_STAT_LNK _S_IFLNK -#endif -#define QT_FILENO _fileno -#define QT_OPEN ::_open -#define QT_CLOSE ::_close -#ifdef QT_LARGEFILE_SUPPORT -#define QT_LSEEK ::_lseeki64 -#define QT_TSTAT ::_tstati64 -#else -#define QT_LSEEK ::_lseek -#define QT_TSTAT ::_tstat -#endif -#define QT_READ ::_read -#define QT_WRITE ::_write -#define QT_ACCESS ::_access -#define QT_GETCWD ::_getcwd -#define QT_CHDIR ::_chdir -#define QT_MKDIR ::_mkdir -#define QT_RMDIR ::_rmdir -#define QT_OPEN_RDONLY _O_RDONLY -#define QT_OPEN_WRONLY _O_WRONLY -#define QT_OPEN_RDWR _O_RDWR -#define QT_OPEN_CREAT _O_CREAT -#define QT_OPEN_TRUNC _O_TRUNC -#define QT_OPEN_APPEND _O_APPEND -#if defined(O_TEXT) -# define QT_OPEN_TEXT _O_TEXT -# define QT_OPEN_BINARY _O_BINARY -#endif - -#define QT_SIGNAL_ARGS int - -#define QT_VSNPRINTF ::_vsnprintf -#define QT_SNPRINTF ::_snprintf - -# define F_OK 0 -# define X_OK 1 -# define W_OK 2 -# define R_OK 4 - - -#endif // QPLATFORMDEFS_H diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/.cvsignore b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/.cvsignore deleted file mode 100644 index aa6c7eb936..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/.cvsignore +++ /dev/null @@ -1,36 +0,0 @@ -*.pro -*~ -Makefile.cartesian -Makefile.cfev -Makefile.cfevtest -Makefile.collapser -Makefile.common -Makefile.compatibility -Makefile.convex_decomp -Makefile.core -Makefile.corealg -Makefile.coreio -Makefile.geometry -Makefile.interf -Makefile.license -Makefile.linalg -Makefile.meshercommon -Makefile.mkprogen -Makefile.mkprospec -Makefile.newsurface -Makefile.newvolume -Makefile.octree -Makefile.pipeline -Makefile.resurfacer -Makefile.robustgeometry -Makefile.surface -Makefile.surfacerepair -Makefile.surfacewrapper -Makefile.test -Makefile.viewcommon -Makefile.voxelmesher -make.*.list* -qmake.vars -test.general.log -test.specific.log -zzzz* diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/.cvsignore b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/.cvsignore deleted file mode 100644 index aa6c7eb936..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/.cvsignore +++ /dev/null @@ -1,36 +0,0 @@ -*.pro -*~ -Makefile.cartesian -Makefile.cfev -Makefile.cfevtest -Makefile.collapser -Makefile.common -Makefile.compatibility -Makefile.convex_decomp -Makefile.core -Makefile.corealg -Makefile.coreio -Makefile.geometry -Makefile.interf -Makefile.license -Makefile.linalg -Makefile.meshercommon -Makefile.mkprogen -Makefile.mkprospec -Makefile.newsurface -Makefile.newvolume -Makefile.octree -Makefile.pipeline -Makefile.resurfacer -Makefile.robustgeometry -Makefile.surface -Makefile.surfacerepair -Makefile.surfacewrapper -Makefile.test -Makefile.viewcommon -Makefile.voxelmesher -make.*.list* -qmake.vars -test.general.log -test.specific.log -zzzz* diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/glib/.cvsignore b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/glib/.cvsignore deleted file mode 100644 index aa6c7eb936..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/glib/.cvsignore +++ /dev/null @@ -1,36 +0,0 @@ -*.pro -*~ -Makefile.cartesian -Makefile.cfev -Makefile.cfevtest -Makefile.collapser -Makefile.common -Makefile.compatibility -Makefile.convex_decomp -Makefile.core -Makefile.corealg -Makefile.coreio -Makefile.geometry -Makefile.interf -Makefile.license -Makefile.linalg -Makefile.meshercommon -Makefile.mkprogen -Makefile.mkprospec -Makefile.newsurface -Makefile.newvolume -Makefile.octree -Makefile.pipeline -Makefile.resurfacer -Makefile.robustgeometry -Makefile.surface -Makefile.surfacerepair -Makefile.surfacewrapper -Makefile.test -Makefile.viewcommon -Makefile.voxelmesher -make.*.list* -qmake.vars -test.general.log -test.specific.log -zzzz* diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/glib/gmacros.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/glib/gmacros.h deleted file mode 100644 index 558b168f81..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/glib/gmacros.h +++ /dev/null @@ -1,242 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -/* This file must not include any other glib header file and must thus - * not refer to variables from glibconfig.h - */ - -#ifndef __G_MACROS_H__ -#define __G_MACROS_H__ - -/* We include stddef.h to get the system's definition of NULL - */ -#include - -/* Here we provide G_GNUC_EXTENSION as an alias for __extension__, - * where this is valid. This allows for warningless compilation of - * "long long" types even in the presence of '-ansi -pedantic'. - */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) -# define G_GNUC_EXTENSION __extension__ -#else -# define G_GNUC_EXTENSION -#endif - -/* Provide macros to feature the GCC function attribute. - */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -#define G_GNUC_PURE \ - __attribute__((__pure__)) -#else -#define G_GNUC_PURE -#endif - -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) -#define G_GNUC_PRINTF( format_idx, arg_idx ) \ - __attribute__((__format__ (__printf__, format_idx, arg_idx))) -#define G_GNUC_SCANF( format_idx, arg_idx ) \ - __attribute__((__format__ (__scanf__, format_idx, arg_idx))) -#define G_GNUC_FORMAT( arg_idx ) \ - __attribute__((__format_arg__ (arg_idx))) -#define G_GNUC_NORETURN \ - __attribute__((__noreturn__)) -#define G_GNUC_CONST \ - __attribute__((__const__)) -#define G_GNUC_UNUSED \ - __attribute__((__unused__)) -#define G_GNUC_NO_INSTRUMENT \ - __attribute__((__no_instrument_function__)) -#else /* !__GNUC__ */ -#define G_GNUC_PRINTF( format_idx, arg_idx ) -#define G_GNUC_SCANF( format_idx, arg_idx ) -#define G_GNUC_FORMAT( arg_idx ) -#define G_GNUC_NORETURN -#define G_GNUC_CONST -#define G_GNUC_UNUSED -#define G_GNUC_NO_INSTRUMENT -#endif /* !__GNUC__ */ - -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) -#define G_GNUC_DEPRECATED \ - __attribute__((__deprecated__)) -#else -#define G_GNUC_DEPRECATED -#endif /* __GNUC__ */ - -/* Wrap the gcc __PRETTY_FUNCTION__ and __FUNCTION__ variables with - * macros, so we can refer to them as strings unconditionally. - * usage not-recommended since gcc-3.0 - */ -#if defined (__GNUC__) && (__GNUC__ < 3) -#define G_GNUC_FUNCTION __FUNCTION__ -#define G_GNUC_PRETTY_FUNCTION __PRETTY_FUNCTION__ -#else /* !__GNUC__ */ -#define G_GNUC_FUNCTION "" -#define G_GNUC_PRETTY_FUNCTION "" -#endif /* !__GNUC__ */ - -#define G_STRINGIFY(macro_or_string) G_STRINGIFY_ARG (macro_or_string) -#define G_STRINGIFY_ARG(contents) #contents - -/* Provide a string identifying the current code position */ -#if defined(__GNUC__) && (__GNUC__ < 3) && !defined(__cplusplus) -# define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) ":" __PRETTY_FUNCTION__ "()" -#else -# define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) -#endif - -/* Provide a string identifying the current function, non-concatenatable */ -#if defined (__GNUC__) -# define G_STRFUNC ((char const *) (__PRETTY_FUNCTION__)) -#elif defined (G_HAVE_ISO_VARARGS) -# define G_STRFUNC ((char const *) (__func__)) -#else -# define G_STRFUNC ((char const *) ("???")) -#endif - -/* Guard C code in headers, while including them from C++ */ -#ifdef __cplusplus -# define G_BEGIN_DECLS extern "C" { -# define G_END_DECLS } -#else -# define G_BEGIN_DECLS -# define G_END_DECLS -#endif - -/* Provide definitions for some commonly used macros. - * Some of them are only provided if they haven't already - * been defined. It is assumed that if they are already - * defined then the current definition is correct. - */ -#ifndef NULL -# ifdef __cplusplus -# define NULL (0L) -# else /* !__cplusplus */ -# define NULL ((void*) 0) -# endif /* !__cplusplus */ -#endif - -#ifndef FALSE -#define FALSE (0) -#endif - -#ifndef TRUE -#define TRUE (!FALSE) -#endif - -#undef MAX -#define MAX(a, b) (((a) > (b)) ? (a) : (b)) - -#undef MIN -#define MIN(a, b) (((a) < (b)) ? (a) : (b)) - -#undef ABS -#define ABS(a) (((a) < 0) ? -(a) : (a)) - -#undef CLAMP -#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) - -/* Count the number of elements in an array. The array must be defined - * as such; using this with a dynamically allocated array will give - * incorrect results. - */ -#define G_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0])) - -/* Macros by analogy to GINT_TO_POINTER, GPOINTER_TO_INT - */ -#define GPOINTER_TO_SIZE(p) ((gsize) (p)) -#define GSIZE_TO_POINTER(s) ((gpointer) (gsize) (s)) - -/* Provide convenience macros for handling structure - * fields through their offsets. - */ -#define G_STRUCT_OFFSET(struct_type, member) \ - ((glong) ((guint8*) &((struct_type*) 0)->member)) -#define G_STRUCT_MEMBER_P(struct_p, struct_offset) \ - ((gpointer) ((guint8*) (struct_p) + (glong) (struct_offset))) -#define G_STRUCT_MEMBER(member_type, struct_p, struct_offset) \ - (*(member_type*) G_STRUCT_MEMBER_P ((struct_p), (struct_offset))) - -/* Provide simple macro statement wrappers (adapted from Perl): - * G_STMT_START { statements; } G_STMT_END; - * can be used as a single statement, as in - * if (x) G_STMT_START { ... } G_STMT_END; else ... - * - * For gcc we will wrap the statements within `({' and `})' braces. - * For SunOS they will be wrapped within `if (1)' and `else (void) 0', - * and otherwise within `do' and `while (0)'. - */ -#if !(defined (G_STMT_START) && defined (G_STMT_END)) -# if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus) -# define G_STMT_START (void) __extension__ ( -# define G_STMT_END ) -# else -# if (defined (sun) || defined (__sun__)) -# define G_STMT_START if (1) -# define G_STMT_END else (void)0 -# else -# define G_STMT_START do -# define G_STMT_END while (0) -# endif -# endif -#endif - -/* Allow the app programmer to select whether or not return values - * (usually char*) are const or not. Don't try using this feature for - * functions with C++ linkage. - */ -#ifdef G_DISABLE_CONST_RETURNS -#define G_CONST_RETURN -#else -#define G_CONST_RETURN const -#endif - -/* - * The G_LIKELY and G_UNLIKELY macros let the programmer give hints to - * the compiler about the expected result of an expression. Some compilers - * can use this information for optimizations. - * - * The _G_BOOLEAN_EXPR macro is intended to trigger a gcc warning when - * putting assignments in g_return_if_fail (). - */ -#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) -#define _G_BOOLEAN_EXPR(expr) \ - __extension__ ({ \ - int _g_boolean_var_; \ - if (expr) \ - _g_boolean_var_ = 1; \ - else \ - _g_boolean_var_ = 0; \ - _g_boolean_var_; \ -}) -#define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 1)) -#define G_UNLIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 0)) -#else -#define G_LIKELY(expr) (expr) -#define G_UNLIKELY(expr) (expr) -#endif - -#endif /* __G_MACROS_H__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/glib/gtypes.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/glib/gtypes.h deleted file mode 100644 index da3c086602..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/glib/gtypes.h +++ /dev/null @@ -1,419 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_TYPES_H__ -#define __G_TYPES_H__ - -#include - -G_BEGIN_DECLS - -/* Provide type definitions for commonly used types. - * These are useful because a "gint8" can be adjusted - * to be 1 byte (8 bits) on all platforms. Similarly and - * more importantly, "gint32" can be adjusted to be - * 4 bytes (32 bits) on all platforms. - */ - -typedef char gchar; -typedef short gshort; -typedef long glong; -typedef int gint; -typedef gint gboolean; - -typedef unsigned char guchar; -typedef unsigned short gushort; -typedef unsigned long gulong; -typedef unsigned int guint; - -typedef float gfloat; -typedef double gdouble; - -/* Define min and max constants for the fixed size numerical types */ -#define G_MININT8 ((gint8) 0x80) -#define G_MAXINT8 ((gint8) 0x7f) -#define G_MAXUINT8 ((guint8) 0xff) - -#define G_MININT16 ((gint16) 0x8000) -#define G_MAXINT16 ((gint16) 0x7fff) -#define G_MAXUINT16 ((guint16) 0xffff) - -#define G_MININT32 ((gint32) 0x80000000) -#define G_MAXINT32 ((gint32) 0x7fffffff) -#define G_MAXUINT32 ((guint32) 0xffffffff) - -#define G_MININT64 G_GINT64_CONSTANT(0x8000000000000000) -#define G_MAXINT64 G_GINT64_CONSTANT(0x7fffffffffffffff) -#define G_MAXUINT64 G_GINT64_CONSTANT(0xffffffffffffffffU) - -typedef void* gpointer; -typedef void const *gconstpointer; - -typedef gint (*GCompareFunc) (gconstpointer a, - gconstpointer b); -typedef gint (*GCompareDataFunc) (gconstpointer a, - gconstpointer b, - gpointer user_data); -typedef gboolean (*GEqualFunc) (gconstpointer a, - gconstpointer b); -typedef void (*GDestroyNotify) (gpointer data); -typedef void (*GFunc) (gpointer data, - gpointer user_data); -typedef guint (*GHashFunc) (gconstpointer key); -typedef void (*GHFunc) (gpointer key, - gpointer value, - gpointer user_data); -typedef void (*GFreeFunc) (gpointer data); - -/* Define some mathematical constants that aren't available - * symbolically in some strict ISO C implementations. - */ -#define G_E 2.7182818284590452354E0 -#define G_LN2 6.9314718055994530942E-1 -#define G_LN10 2.3025850929940456840E0 -#define G_PI 3.14159265358979323846E0 -#define G_PI_2 1.57079632679489661923E0 -#define G_PI_4 0.78539816339744830962E0 -#define G_SQRT2 1.4142135623730950488E0 - -/* Portable endian checks and conversions - * - * glibconfig.h defines G_BYTE_ORDER which expands to one of - * the below macros. - */ -#define G_LITTLE_ENDIAN 1234 -#define G_BIG_ENDIAN 4321 -#define G_PDP_ENDIAN 3412 /* unused, need specific PDP check */ - - -/* Basic bit swapping functions - */ -#define GUINT16_SWAP_LE_BE_CONSTANT(val) ((guint16) ( \ - (guint16) ((guint16) (val) >> 8) | \ - (guint16) ((guint16) (val) << 8))) - -#define GUINT32_SWAP_LE_BE_CONSTANT(val) ((guint32) ( \ - (((guint32) (val) & (guint32) 0x000000ffU) << 24) | \ - (((guint32) (val) & (guint32) 0x0000ff00U) << 8) | \ - (((guint32) (val) & (guint32) 0x00ff0000U) >> 8) | \ - (((guint32) (val) & (guint32) 0xff000000U) >> 24))) - -#define GUINT64_SWAP_LE_BE_CONSTANT(val) ((guint64) ( \ - (((guint64) (val) & \ - (guint64) G_GINT64_CONSTANT (0x00000000000000ffU)) << 56) | \ - (((guint64) (val) & \ - (guint64) G_GINT64_CONSTANT (0x000000000000ff00U)) << 40) | \ - (((guint64) (val) & \ - (guint64) G_GINT64_CONSTANT (0x0000000000ff0000U)) << 24) | \ - (((guint64) (val) & \ - (guint64) G_GINT64_CONSTANT (0x00000000ff000000U)) << 8) | \ - (((guint64) (val) & \ - (guint64) G_GINT64_CONSTANT (0x000000ff00000000U)) >> 8) | \ - (((guint64) (val) & \ - (guint64) G_GINT64_CONSTANT (0x0000ff0000000000U)) >> 24) | \ - (((guint64) (val) & \ - (guint64) G_GINT64_CONSTANT (0x00ff000000000000U)) >> 40) | \ - (((guint64) (val) & \ - (guint64) G_GINT64_CONSTANT (0xff00000000000000U)) >> 56))) - -/* Arch specific stuff for speed - */ -#if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__) -# if defined (__i386__) -# define GUINT16_SWAP_LE_BE_IA32(val) \ - (__extension__ \ - ({ register guint16 __v, __x = ((guint16) (val)); \ - if (__builtin_constant_p (__x)) \ - __v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \ - else \ - __asm__ ("rorw $8, %w0" \ - : "=r" (__v) \ - : "0" (__x) \ - : "cc"); \ - __v; })) -# if !defined (__i486__) && !defined (__i586__) \ - && !defined (__pentium__) && !defined (__i686__) \ - && !defined (__pentiumpro__) && !defined (__pentium4__) -# define GUINT32_SWAP_LE_BE_IA32(val) \ - (__extension__ \ - ({ register guint32 __v, __x = ((guint32) (val)); \ - if (__builtin_constant_p (__x)) \ - __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \ - else \ - __asm__ ("rorw $8, %w0\n\t" \ - "rorl $16, %0\n\t" \ - "rorw $8, %w0" \ - : "=r" (__v) \ - : "0" (__x) \ - : "cc"); \ - __v; })) -# else /* 486 and higher has bswap */ -# define GUINT32_SWAP_LE_BE_IA32(val) \ - (__extension__ \ - ({ register guint32 __v, __x = ((guint32) (val)); \ - if (__builtin_constant_p (__x)) \ - __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \ - else \ - __asm__ ("bswap %0" \ - : "=r" (__v) \ - : "0" (__x)); \ - __v; })) -# endif /* processor specific 32-bit stuff */ -# define GUINT64_SWAP_LE_BE_IA32(val) \ - (__extension__ \ - ({ union { guint64 __ll; \ - guint32 __l[2]; } __w, __r; \ - __w.__ll = ((guint64) (val)); \ - if (__builtin_constant_p (__w.__ll)) \ - __r.__ll = GUINT64_SWAP_LE_BE_CONSTANT (__w.__ll); \ - else \ - { \ - __r.__l[0] = GUINT32_SWAP_LE_BE (__w.__l[1]); \ - __r.__l[1] = GUINT32_SWAP_LE_BE (__w.__l[0]); \ - } \ - __r.__ll; })) - /* Possibly just use the constant version and let gcc figure it out? */ -# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA32 (val)) -# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_IA32 (val)) -# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_IA32 (val)) -# elif defined (__ia64__) -# define GUINT16_SWAP_LE_BE_IA64(val) \ - (__extension__ \ - ({ register guint16 __v, __x = ((guint16) (val)); \ - if (__builtin_constant_p (__x)) \ - __v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \ - else \ - __asm__ __volatile__ ("shl %0 = %1, 48 ;;" \ - "mux1 %0 = %0, @rev ;;" \ - : "=r" (__v) \ - : "r" (__x)); \ - __v; })) -# define GUINT32_SWAP_LE_BE_IA64(val) \ - (__extension__ \ - ({ register guint32 __v, __x = ((guint32) (val)); \ - if (__builtin_constant_p (__x)) \ - __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \ - else \ - __asm__ __volatile__ ("shl %0 = %1, 32 ;;" \ - "mux1 %0 = %0, @rev ;;" \ - : "=r" (__v) \ - : "r" (__x)); \ - __v; })) -# define GUINT64_SWAP_LE_BE_IA64(val) \ - (__extension__ \ - ({ register guint64 __v, __x = ((guint64) (val)); \ - if (__builtin_constant_p (__x)) \ - __v = GUINT64_SWAP_LE_BE_CONSTANT (__x); \ - else \ - __asm__ __volatile__ ("mux1 %0 = %1, @rev ;;" \ - : "=r" (__v) \ - : "r" (__x)); \ - __v; })) -# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA64 (val)) -# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_IA64 (val)) -# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_IA64 (val)) -# elif defined (__x86_64__) -# define GUINT32_SWAP_LE_BE_X86_64(val) \ - (__extension__ \ - ({ register guint32 __v, __x = ((guint32) (val)); \ - if (__builtin_constant_p (__x)) \ - __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \ - else \ - __asm__ ("bswapl %0" \ - : "=r" (__v) \ - : "0" (__x)); \ - __v; })) -# define GUINT64_SWAP_LE_BE_X86_64(val) \ - (__extension__ \ - ({ register guint64 __v, __x = ((guint64) (val)); \ - if (__builtin_constant_p (__x)) \ - __v = GUINT64_SWAP_LE_BE_CONSTANT (__x); \ - else \ - __asm__ ("bswapq %0" \ - : "=r" (__v) \ - : "0" (__x)); \ - __v; })) - /* gcc seems to figure out optimal code for this on its own */ -# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val)) -# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_X86_64 (val)) -# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_X86_64 (val)) -# else /* generic gcc */ -# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val)) -# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val)) -# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT (val)) -# endif -#else /* generic */ -# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val)) -# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val)) -# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT (val)) -#endif /* generic */ - -#define GUINT16_SWAP_LE_PDP(val) ((guint16) (val)) -#define GUINT16_SWAP_BE_PDP(val) (GUINT16_SWAP_LE_BE (val)) -#define GUINT32_SWAP_LE_PDP(val) ((guint32) ( \ - (((guint32) (val) & (guint32) 0x0000ffffU) << 16) | \ - (((guint32) (val) & (guint32) 0xffff0000U) >> 16))) -#define GUINT32_SWAP_BE_PDP(val) ((guint32) ( \ - (((guint32) (val) & (guint32) 0x00ff00ffU) << 8) | \ - (((guint32) (val) & (guint32) 0xff00ff00U) >> 8))) - -/* The G*_TO_?E() macros are defined in glibconfig.h. - * The transformation is symmetric, so the FROM just maps to the TO. - */ -#define GINT16_FROM_LE(val) (GINT16_TO_LE (val)) -#define GUINT16_FROM_LE(val) (GUINT16_TO_LE (val)) -#define GINT16_FROM_BE(val) (GINT16_TO_BE (val)) -#define GUINT16_FROM_BE(val) (GUINT16_TO_BE (val)) -#define GINT32_FROM_LE(val) (GINT32_TO_LE (val)) -#define GUINT32_FROM_LE(val) (GUINT32_TO_LE (val)) -#define GINT32_FROM_BE(val) (GINT32_TO_BE (val)) -#define GUINT32_FROM_BE(val) (GUINT32_TO_BE (val)) - -#define GINT64_FROM_LE(val) (GINT64_TO_LE (val)) -#define GUINT64_FROM_LE(val) (GUINT64_TO_LE (val)) -#define GINT64_FROM_BE(val) (GINT64_TO_BE (val)) -#define GUINT64_FROM_BE(val) (GUINT64_TO_BE (val)) - -#define GLONG_FROM_LE(val) (GLONG_TO_LE (val)) -#define GULONG_FROM_LE(val) (GULONG_TO_LE (val)) -#define GLONG_FROM_BE(val) (GLONG_TO_BE (val)) -#define GULONG_FROM_BE(val) (GULONG_TO_BE (val)) - -#define GINT_FROM_LE(val) (GINT_TO_LE (val)) -#define GUINT_FROM_LE(val) (GUINT_TO_LE (val)) -#define GINT_FROM_BE(val) (GINT_TO_BE (val)) -#define GUINT_FROM_BE(val) (GUINT_TO_BE (val)) - - -/* Portable versions of host-network order stuff - */ -#define g_ntohl(val) (GUINT32_FROM_BE (val)) -#define g_ntohs(val) (GUINT16_FROM_BE (val)) -#define g_htonl(val) (GUINT32_TO_BE (val)) -#define g_htons(val) (GUINT16_TO_BE (val)) - -/* IEEE Standard 754 Single Precision Storage Format (gfloat): - * - * 31 30 23 22 0 - * +--------+---------------+---------------+ - * | s 1bit | e[30:23] 8bit | f[22:0] 23bit | - * +--------+---------------+---------------+ - * B0------------------->B1------->B2-->B3--> - * - * IEEE Standard 754 Double Precision Storage Format (gdouble): - * - * 63 62 52 51 32 31 0 - * +--------+----------------+----------------+ +---------------+ - * | s 1bit | e[62:52] 11bit | f[51:32] 20bit | | f[31:0] 32bit | - * +--------+----------------+----------------+ +---------------+ - * B0--------------->B1---------->B2--->B3----> B4->B5->B6->B7-> - */ -/* subtract from biased_exponent to form base2 exponent (normal numbers) */ -typedef union _GDoubleIEEE754 GDoubleIEEE754; -typedef union _GFloatIEEE754 GFloatIEEE754; -#define G_IEEE754_FLOAT_BIAS (127) -#define G_IEEE754_DOUBLE_BIAS (1023) -/* multiply with base2 exponent to get base10 exponent (normal numbers) */ -#define G_LOG_2_BASE_10 (0.30102999566398119521) -#if G_BYTE_ORDER == G_LITTLE_ENDIAN -union _GFloatIEEE754 -{ - gfloat v_float; - struct { - guint mantissa : 23; - guint biased_exponent : 8; - guint sign : 1; - } mpn; -}; -union _GDoubleIEEE754 -{ - gdouble v_double; - struct { - guint mantissa_low : 32; - guint mantissa_high : 20; - guint biased_exponent : 11; - guint sign : 1; - } mpn; -}; -#elif G_BYTE_ORDER == G_BIG_ENDIAN -union _GFloatIEEE754 -{ - gfloat v_float; - struct { - guint sign : 1; - guint biased_exponent : 8; - guint mantissa : 23; - } mpn; -}; -union _GDoubleIEEE754 -{ - gdouble v_double; - struct { - guint sign : 1; - guint biased_exponent : 11; - guint mantissa_high : 20; - guint mantissa_low : 32; - } mpn; -}; -#else /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */ -#error unknown ENDIAN type -#endif /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */ - -typedef struct _GTimeVal GTimeVal; - -struct _GTimeVal -{ - glong tv_sec; - glong tv_usec; -}; - -G_END_DECLS - -/* We prefix variable declarations so they can - * properly get exported in windows dlls. - */ -#ifndef GLIB_VAR -# ifdef G_PLATFORM_WIN32 -# ifdef GLIB_STATIC_COMPILATION -# define GLIB_VAR extern -# else /* !GLIB_STATIC_COMPILATION */ -# ifdef GLIB_COMPILATION -# ifdef DLL_EXPORT -# define GLIB_VAR __declspec(dllexport) -# else /* !DLL_EXPORT */ -# define GLIB_VAR extern -# endif /* !DLL_EXPORT */ -# else /* !GLIB_COMPILATION */ -# define GLIB_VAR extern __declspec(dllimport) -# endif /* !GLIB_COMPILATION */ -# endif /* !GLIB_STATIC_COMPILATION */ -# else /* !G_PLATFORM_WIN32 */ -# define GLIB_VAR extern -# endif /* !G_PLATFORM_WIN32 */ -#endif /* GLIB_VAR */ - -#endif /* __G_TYPES_H__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/glib/gwin32.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/glib/gwin32.h deleted file mode 100644 index 5aca580195..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/glib/gwin32.h +++ /dev/null @@ -1,100 +0,0 @@ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_WIN32_H__ -#define __G_WIN32_H__ - -#include - -#ifdef G_PLATFORM_WIN32 - -/* Windows emulation stubs for common Unix functions - */ - -G_BEGIN_DECLS - -#ifndef MAXPATHLEN -#define MAXPATHLEN 1024 -#endif - -#ifdef _MSC_VER -typedef int pid_t; -#endif - -#ifdef G_OS_WIN32 - -/* - * To get prototypes for the following POSIXish functions, you have to - * include the indicated non-POSIX headers. The functions are defined - * in OLDNAMES.LIB (MSVC) or -lmoldname-msvc (mingw32). - * - * getcwd: (MSVC), (mingw32) - * getpid: - * access: - * unlink: or - * open, read, write, lseek, close: - * rmdir: - * pipe: - */ - -/* pipe is not in OLDNAMES.LIB or -lmoldname-msvc. */ -#define pipe(phandles) _pipe (phandles, 4096, _O_BINARY) - -/* For some POSIX functions that are not provided by the MS runtime, - * we provide emulators in glib, which are prefixed with g_win32_. - */ -# define ftruncate(fd, size) g_win32_ftruncate (fd, size) - -gint g_win32_ftruncate (gint f, - guint size); -#endif /* G_OS_WIN32 */ - -/* The MS setlocale uses locale names of the form "English_United - * States.1252" etc. We want the Unixish standard form "en", "zh_TW" - * etc. This function gets the current thread locale from Windows and - * returns it as a string of the above form for use in forming file - * names etc. The returned string should be deallocated with g_free(). - */ -gchar* g_win32_getlocale (void); - -/* Translate a Win32 error code (as returned by GetLastError()) into - * the corresponding message. The returned string should be deallocated - * with g_free(). - */ -gchar* g_win32_error_message (gint error); - -gchar* g_win32_get_package_installation_directory (gchar *package, - gchar *dll_name); - -gchar* g_win32_get_package_installation_subdirectory (gchar *package, - gchar *dll_name, - gchar *subdir); - -G_END_DECLS - -#endif /* G_PLATFORM_WIN32 */ - -#endif /* __G_WIN32_H__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/glibconfig.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/glibconfig.h deleted file mode 100644 index 59dcf2dd18..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/glibconfig.h +++ /dev/null @@ -1,188 +0,0 @@ -/* glibconfig.h.win32.in Merged from two versions generated by configure for gcc and MSVC. */ -/* glibconfig.h - * - * This is a generated file. Please modify 'configure.in' - */ - -#ifndef __G_LIBCONFIG_H__ -#define __G_LIBCONFIG_H__ - -#include - -#include -#include - -G_BEGIN_DECLS - -#define G_MINFLOAT FLT_MIN -#define G_MAXFLOAT FLT_MAX -#define G_MINDOUBLE DBL_MIN -#define G_MAXDOUBLE DBL_MAX -#define G_MINSHORT SHRT_MIN -#define G_MAXSHORT SHRT_MAX -#define G_MAXUSHORT USHRT_MAX -#define G_MININT INT_MIN -#define G_MAXINT INT_MAX -#define G_MAXUINT UINT_MAX -#define G_MINLONG LONG_MIN -#define G_MAXLONG LONG_MAX -#define G_MAXULONG ULONG_MAX - -typedef signed char gint8; -typedef unsigned char guint8; -typedef signed short gint16; -typedef unsigned short guint16; -#define G_GINT16_MODIFIER "h" -#define G_GINT16_FORMAT "hi" -#define G_GUINT16_FORMAT "hu" -typedef signed int gint32; -typedef unsigned int guint32; -#define G_GINT32_MODIFIER "" -#define G_GINT32_FORMAT "i" -#define G_GUINT32_FORMAT "u" -#define G_HAVE_GINT64 1 /* deprecated, always true */ - -#ifndef _MSC_VER -G_GNUC_EXTENSION typedef signed long long gint64; -G_GNUC_EXTENSION typedef unsigned long long guint64; -#else /* _MSC_VER */ -typedef signed __int64 gint64; -typedef unsigned __int64 guint64; -#endif /* _MSC_VER */ - -#ifndef _MSC_VER -#define G_GINT64_CONSTANT(val) (G_GNUC_EXTENSION (val##LL)) -#else /* _MSC_VER */ -#define G_GINT64_CONSTANT(val) (val##i64) -#endif /* _MSC_VER */ -#define G_GINT64_MODIFIER "I64" -#define G_GINT64_FORMAT "I64i" -#define G_GUINT64_FORMAT "I64u" - -#define GLIB_SIZEOF_VOID_P 4 -#define GLIB_SIZEOF_LONG 4 -#define GLIB_SIZEOF_SIZE_T 4 - -typedef signed int gssize; -typedef unsigned int gsize; -#define G_GSIZE_MODIFIER "" -#define G_GSSIZE_FORMAT "i" -#define G_GSIZE_FORMAT "u" - -#define G_MAXSIZE G_MAXUINT - -#define GPOINTER_TO_INT(p) ((gint) (p)) -#define GPOINTER_TO_UINT(p) ((guint) (p)) - -#define GINT_TO_POINTER(i) ((gpointer) (i)) -#define GUINT_TO_POINTER(u) ((gpointer) (u)) - -#ifdef NeXT /* @#%@! NeXTStep */ -# define g_ATEXIT(proc) (!atexit (proc)) -#else -# define g_ATEXIT(proc) (atexit (proc)) -#endif - -#define g_memmove(d,s,n) G_STMT_START { memmove ((d), (s), (n)); } G_STMT_END - -#define GLIB_MAJOR_VERSION 2 -#define GLIB_MINOR_VERSION 4 -#define GLIB_MICRO_VERSION 5 - -#define G_OS_WIN32 -#define G_PLATFORM_WIN32 - -#ifndef _MSC_VER -#define G_VA_COPY va_copy -#endif /* not _MSC_VER */ - -#ifdef __cplusplus -#define G_HAVE_INLINE 1 -#else /* !__cplusplus */ -#ifndef _MSC_VER -#define G_HAVE_INLINE 1 -#else /* _MSC_VER */ - -#endif /* _MSC_VER */ -#define G_HAVE___INLINE 1 -#ifndef _MSC_VER -#define G_HAVE___INLINE__ 1 -#endif /* not _MSC_VER */ -#endif /* !__cplusplus */ - -#ifndef _MSC_VER -#ifndef __cplusplus -# define G_HAVE_ISO_VARARGS 1 -#endif -#ifdef __cplusplus -# define G_HAVE_ISO_VARARGS 1 -#endif - -/* gcc-2.95.x supports both gnu style and ISO varargs, but if -ansi - * is passed ISO vararg support is turned off, and there is no work - * around to turn it on, so we unconditionally turn it off. - */ -#if __GNUC__ == 2 && __GNUC_MINOR__ == 95 -# undef G_HAVE_ISO_VARARGS -#endif - -#define G_HAVE_GNUC_VARARGS 1 -#endif /* not _MSC_VER */ -#define G_HAVE_GROWING_STACK 0 - - -#define G_THREADS_ENABLED -#define G_THREADS_IMPL_WIN32 -typedef struct _GMutex* GStaticMutex; -#define G_STATIC_MUTEX_INIT NULL -#define g_static_mutex_get_mutex(mutex) \ - (g_static_mutex_get_mutex_impl_shortcut (mutex)) -/* This represents a system thread as used by the implementation. An - * alien implementaion, as loaded by g_thread_init can only count on - * "sizeof (gpointer)" bytes to store their info. We however need more - * for some of our native implementations. */ -typedef union _GSystemThread GSystemThread; -union _GSystemThread -{ - char data[4]; - double dummy_double; - void *dummy_pointer; - long dummy_long; -}; - -#define GINT16_TO_LE(val) ((gint16) (val)) -#define GUINT16_TO_LE(val) ((guint16) (val)) -#define GINT16_TO_BE(val) ((gint16) GUINT16_SWAP_LE_BE (val)) -#define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val)) -#define GINT32_TO_LE(val) ((gint32) (val)) -#define GUINT32_TO_LE(val) ((guint32) (val)) -#define GINT32_TO_BE(val) ((gint32) GUINT32_SWAP_LE_BE (val)) -#define GUINT32_TO_BE(val) (GUINT32_SWAP_LE_BE (val)) -#define GINT64_TO_LE(val) ((gint64) (val)) -#define GUINT64_TO_LE(val) ((guint64) (val)) -#define GINT64_TO_BE(val) ((gint64) GUINT64_SWAP_LE_BE (val)) -#define GUINT64_TO_BE(val) (GUINT64_SWAP_LE_BE (val)) -#define GLONG_TO_LE(val) ((glong) GINT32_TO_LE (val)) -#define GULONG_TO_LE(val) ((gulong) GUINT32_TO_LE (val)) -#define GLONG_TO_BE(val) ((glong) GINT32_TO_BE (val)) -#define GULONG_TO_BE(val) ((gulong) GUINT32_TO_BE (val)) -#define GINT_TO_LE(val) ((gint) GINT32_TO_LE (val)) -#define GUINT_TO_LE(val) ((guint) GUINT32_TO_LE (val)) -#define GINT_TO_BE(val) ((gint) GINT32_TO_BE (val)) -#define GUINT_TO_BE(val) ((guint) GUINT32_TO_BE (val)) -#define G_BYTE_ORDER G_LITTLE_ENDIAN - -#define GLIB_SYSDEF_POLLIN =1 -#define GLIB_SYSDEF_POLLOUT =4 -#define GLIB_SYSDEF_POLLPRI =2 -#define GLIB_SYSDEF_POLLHUP =16 -#define GLIB_SYSDEF_POLLERR =8 -#define GLIB_SYSDEF_POLLNVAL =32 - -#define G_MODULE_SUFFIX "dll" - -typedef void * GPid; - -G_END_DECLS - -#endif /* GLIBCONFIG_H */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/.cvsignore b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/.cvsignore deleted file mode 100644 index aa6c7eb936..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/.cvsignore +++ /dev/null @@ -1,36 +0,0 @@ -*.pro -*~ -Makefile.cartesian -Makefile.cfev -Makefile.cfevtest -Makefile.collapser -Makefile.common -Makefile.compatibility -Makefile.convex_decomp -Makefile.core -Makefile.corealg -Makefile.coreio -Makefile.geometry -Makefile.interf -Makefile.license -Makefile.linalg -Makefile.meshercommon -Makefile.mkprogen -Makefile.mkprospec -Makefile.newsurface -Makefile.newvolume -Makefile.octree -Makefile.pipeline -Makefile.resurfacer -Makefile.robustgeometry -Makefile.surface -Makefile.surfacerepair -Makefile.surfacewrapper -Makefile.test -Makefile.viewcommon -Makefile.voxelmesher -make.*.list* -qmake.vars -test.general.log -test.specific.log -zzzz* diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/auth.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/auth.h deleted file mode 100644 index 38c2ce9097..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/auth.h +++ /dev/null @@ -1,212 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)auth.h 2.3 88/08/07 4.0 RPCSRC; from 1.17 88/02/08 SMI */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * auth.h, Authentication interface. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - * - * The data structures are completely opaque to the client. The client - * is required to pass a AUTH * to routines that create rpc - * "sessions". - */ - -#ifndef __AUTH_HEADER__ -#define __AUTH_HEADER__ - -#ifdef __cplusplus -extern "C" { -#define DOTS ... -#else -#define DOTS -#endif - -#define MAX_AUTH_BYTES 400 -#define MAXNETNAMELEN 255 /* maximum length of network user's name */ - -/* - * Status returned from authentication check - */ -enum auth_stat { - AUTH_OK=0, - /* - * failed at remote end - */ - AUTH_BADCRED=1, /* bogus credentials (seal broken) */ - AUTH_REJECTEDCRED=2, /* client should begin new session */ - AUTH_BADVERF=3, /* bogus verifier (seal broken) */ - AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */ - AUTH_TOOWEAK=5, /* rejected due to security reasons */ - /* - * failed locally - */ - AUTH_INVALIDRESP=6, /* bogus response verifier */ - AUTH_FAILED=7 /* some unknown reason */ -}; - -#if (mc68000 || sparc || vax || i386) -typedef u_long u_int32; /* 32-bit unsigned integers */ - -union des_block { - struct { - u_int32 high; - u_int32 low; - } key; - char c[8]; -}; -#else -union des_block { - struct { - u_long high; - u_long low; - } key; - char c[8]; -}; -#endif -typedef union des_block des_block; -extern bool_t xdr_des_block(DOTS); - -/* - * Authentication info. Opaque to client. - */ -struct opaque_auth { - enum_t oa_flavor; /* flavor of auth */ - caddr_t oa_base; /* address of more auth stuff */ - u_int oa_length; /* not to exceed MAX_AUTH_BYTES */ -}; - - -/* - * Auth handle, interface to client side authenticators. - */ -typedef struct { - struct opaque_auth ah_cred; - struct opaque_auth ah_verf; - union des_block ah_key; - struct auth_ops { - void (*ah_nextverf)(DOTS); - int (*ah_marshal)(DOTS); /* nextverf & serialize */ - int (*ah_validate)(DOTS); /* validate varifier */ - int (*ah_refresh)(DOTS); /* refresh credentials */ - void (*ah_destroy)(DOTS); /* destroy this structure */ - } *ah_ops; - caddr_t ah_private; -} AUTH; - - -/* - * Authentication ops. - * The ops and the auth handle provide the interface to the authenticators. - * - * AUTH *auth; - * XDR *xdrs; - * struct opaque_auth verf; - */ -#define AUTH_NEXTVERF(auth) \ - ((*((auth)->ah_ops->ah_nextverf))(auth)) -#define auth_nextverf(auth) \ - ((*((auth)->ah_ops->ah_nextverf))(auth)) - -#define AUTH_MARSHALL(auth, xdrs) \ - ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) -#define auth_marshall(auth, xdrs) \ - ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) - -#define AUTH_VALIDATE(auth, verfp) \ - ((*((auth)->ah_ops->ah_validate))((auth), verfp)) -#define auth_validate(auth, verfp) \ - ((*((auth)->ah_ops->ah_validate))((auth), verfp)) - -#define AUTH_REFRESH(auth) \ - ((*((auth)->ah_ops->ah_refresh))(auth)) -#define auth_refresh(auth) \ - ((*((auth)->ah_ops->ah_refresh))(auth)) - -#define AUTH_DESTROY(auth) \ - ((*((auth)->ah_ops->ah_destroy))(auth)) -#define auth_destroy(auth) \ - ((*((auth)->ah_ops->ah_destroy))(auth)) - -#if defined(WIN32) || defined(WINDOWS_X86) || defined(WINDOWS_X86_GCC) -#ifdef ONCRPCDLL -extern struct opaque_auth _null_auth; -#else -#ifdef __BORLANDC__ -extern __declspec(dllimport) struct opaque_auth _null_auth; -#else -_declspec(dllimport) struct opaque_auth _null_auth; -#endif -#endif -#else -extern struct opaque_auth _null_auth; -#endif - - -/* - * These are the various implementations of client side authenticators. - */ - -/* - * Unix style authentication - * AUTH *authunix_create(machname, uid, gid, len, aup_gids) - * char *machname; - * int uid; - * int gid; - * int len; - * int *aup_gids; - */ -extern AUTH *authunix_create(DOTS); -extern AUTH *authunix_create_default(DOTS); /* takes no parameters */ -extern AUTH *authnone_create(DOTS); /* takes no parameters */ -extern AUTH *authdes_create(DOTS); - -#define AUTH_NONE 0 /* no authentication */ -#define AUTH_NULL 0 /* backward compatibility */ -#define AUTH_UNIX 1 /* unix style (uid, gids) */ -#define AUTH_SHORT 2 /* short hand unix style */ -#define AUTH_DES 3 /* des style (encrypted timestamps) */ - -#ifdef __cplusplus -}; -#endif - -#endif /* __AUTH_HEADER__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/auth_uni.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/auth_uni.h deleted file mode 100644 index 6946aec649..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/auth_uni.h +++ /dev/null @@ -1,101 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)auth_unix.h 2.2 88/07/29 4.0 RPCSRC; from 1.8 88/02/08 SMI */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* @(#)auth_unix.h 1.5 86/07/16 SMI */ - -/* - * auth_unix.h, Protocol for UNIX style authentication parameters for RPC - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -/* - * The system is very weak. The client uses no encryption for it - * credentials and only sends null verifiers. The server sends backs - * null verifiers or optionally a verifier that suggests a new short hand - * for the credentials. - */ - -#ifndef __AUTH_UNIX_HEADER__ -#define __AUTH_UNIX_HEADER__ - -#ifdef __cplusplus -extern "C" { -#define DOTS ... -#else -#define DOTS -#endif - -/* The machine name is part of a credential; it may not exceed 255 bytes */ -#define MAX_MACHINE_NAME 255 - -/* gids compose part of a credential; there may not be more than 16 of them */ -#define NGRPS 16 - -/* - * Unix style credentials. - */ -struct authunix_parms { - u_long aup_time; - char *aup_machname; - int aup_uid; - int aup_gid; - u_int aup_len; - int *aup_gids; -}; - -extern bool_t xdr_authunix_parms(DOTS); - -/* - * If a response verifier has flavor AUTH_SHORT, - * then the body of the response verifier encapsulates the following structure; - * again it is serialized in the obvious fashion. - */ -struct short_hand_verf { - struct opaque_auth new_cred; -}; - -#ifdef __cplusplus -}; -#endif - - -#endif /* __AUTH_UNIX_HEADER__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/bcopy.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/bcopy.h deleted file mode 100644 index 2b3ed8c2ec..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/bcopy.h +++ /dev/null @@ -1,22 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif - -void bcopy(char *,char*,int); -void bcopy_nf(char *,char *,int); -void bcopy_fn(char *,char *,int); -void bcopy_ff(char *,char *,int); -void bzero(char*,int); -#ifdef __cplusplus -}; -#endif - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/clnt.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/clnt.h deleted file mode 100644 index 87db5501fb..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/clnt.h +++ /dev/null @@ -1,364 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC; from 1.31 88/02/08 SMI*/ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * clnt.h - Client side remote procedure call interface. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#ifndef _CLNT_ -#define _CLNT_ - -#ifdef __cplusplus -extern "C" { -#define DOTS ... -#else -#define DOTS -#endif - -/* - * Rpc calls return an enum clnt_stat. This should be looked at more, - * since each implementation is required to live with this (implementation - * independent) list of errors. - */ -enum clnt_stat { - RPC_SUCCESS=0, /* call succeeded */ - /* - * local errors - */ - RPC_CANTENCODEARGS=1, /* can't encode arguments */ - RPC_CANTDECODERES=2, /* can't decode results */ - RPC_CANTSEND=3, /* failure in sending call */ - RPC_CANTRECV=4, /* failure in receiving result */ - RPC_TIMEDOUT=5, /* call timed out */ - /* - * remote errors - */ - RPC_VERSMISMATCH=6, /* rpc versions not compatible */ - RPC_AUTHERROR=7, /* authentication error */ - RPC_PROGUNAVAIL=8, /* program not available */ - RPC_PROGVERSMISMATCH=9, /* program version mismatched */ - RPC_PROCUNAVAIL=10, /* procedure unavailable */ - RPC_CANTDECODEARGS=11, /* decode arguments error */ - RPC_SYSTEMERROR=12, /* generic "other problem" */ - - /* - * callrpc & clnt_create errors - */ - RPC_UNKNOWNHOST=13, /* unknown host name */ - RPC_UNKNOWNPROTO=17, /* unkown protocol */ - - /* - * _ create errors - */ - RPC_PMAPFAILURE=14, /* the pmapper failed in its call */ - RPC_PROGNOTREGISTERED=15, /* remote program is not registered */ - /* - * unspecified error - */ - RPC_FAILED=16 -}; - - -/* - * Error info. - */ -struct rpc_err { - enum clnt_stat re_status; - union { - int RE_errno; /* realated system error */ - enum auth_stat RE_why; /* why the auth error occurred */ - struct { - u_long low; /* lowest verion supported */ - u_long high; /* highest verion supported */ - } RE_vers; - struct { /* maybe meaningful if RPC_FAILED */ - long s1; - long s2; - } RE_lb; /* life boot & debugging only */ - } ru; -#define re_errno ru.RE_errno -#define re_why ru.RE_why -#define re_vers ru.RE_vers -#define re_lb ru.RE_lb -}; - - -/* - * Client rpc handle. - * Created by individual implementations, see e.g. rpc_udp.c. - * Client is responsible for initializing auth, see e.g. auth_none.c. - */ -typedef struct { - AUTH *cl_auth; /* authenticator */ - struct clnt_ops { - enum clnt_stat (*cl_call)(DOTS); /* call remote procedure */ - void (*cl_abort)(DOTS); /* abort a call */ - void (*cl_geterr)(DOTS); /* get specific error code */ - bool_t (*cl_freeres)(DOTS); /* frees results */ - void (*cl_destroy)(DOTS);/* destroy this structure */ - bool_t (*cl_control)(DOTS);/* the ioctl() of rpc */ - } *cl_ops; - caddr_t cl_private; /* private stuff */ -} CLIENT; - - -/* - * client side rpc interface ops - * - * Parameter types are: - * - */ - -/* - * enum clnt_stat - * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout) - * CLIENT *rh; - * u_long proc; - * xdrproc_t xargs; - * caddr_t argsp; - * xdrproc_t xres; - * caddr_t resp; - * struct timeval timeout; - */ -#define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \ - ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) -#define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \ - ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) - -/* - * void - * CLNT_ABORT(rh); - * CLIENT *rh; - */ -#define CLNT_ABORT(rh) ((*(rh)->cl_ops->cl_abort)(rh)) -#define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh)) - -/* - * struct rpc_err - * CLNT_GETERR(rh); - * CLIENT *rh; - */ -#define CLNT_GETERR(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) -#define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) - - -/* - * bool_t - * CLNT_FREERES(rh, xres, resp); - * CLIENT *rh; - * xdrproc_t xres; - * caddr_t resp; - */ -#define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) -#define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) - -/* - * bool_t - * CLNT_CONTROL(cl, request, info) - * CLIENT *cl; - * u_int request; - * char *info; - */ -#define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) -#define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) - -/* - * control operations that apply to both udp and tcp transports - */ -#define CLSET_TIMEOUT 1 /* set timeout (timeval) */ -#define CLGET_TIMEOUT 2 /* get timeout (timeval) */ -#define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */ -/* - * udp only control operations - */ -#define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */ -#define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */ - -/* - * void - * CLNT_DESTROY(rh); - * CLIENT *rh; - */ -#define CLNT_DESTROY(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) -#define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) - - -/* - * RPCTEST is a test program which is accessable on every rpc - * transport/port. It is used for testing, performance evaluation, - * and network administration. - */ - -#define RPCTEST_PROGRAM ((u_long)1) -#define RPCTEST_VERSION ((u_long)1) -#define RPCTEST_NULL_PROC ((u_long)2) -#define RPCTEST_NULL_BATCH_PROC ((u_long)3) - -/* - * By convention, procedure 0 takes null arguments and returns them - */ - -#define NULLPROC ((u_long)0) - -/* - * Below are the client handle creation routines for the various - * implementations of client side rpc. They can return NULL if a - * creation failure occurs. - */ - -/* - * Memory based rpc (for speed check and testing) - * CLIENT * - * clntraw_create(prog, vers) - * u_long prog; - * u_long vers; - */ -extern CLIENT *clntraw_create(DOTS); - - -/* - * Generic client creation routine. Supported protocols are "udp" and "tcp" - */ -extern CLIENT * -clnt_create(/*host, prog, vers, prot*/DOTS); /* - char *host; -- hostname - u_long prog; -- program number - u_long vers; -- version number - char *prot; -- protocol -*/ - - - - -/* - * TCP based rpc - * CLIENT * - * clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz) - * struct sockaddr_in *raddr; - * u_long prog; - * u_long version; - * register int *sockp; - * u_int sendsz; - * u_int recvsz; - */ -extern CLIENT *clnttcp_create(DOTS); - -/* - * UDP based rpc. - * CLIENT * - * clntudp_create(raddr, program, version, wait, sockp) - * struct sockaddr_in *raddr; - * u_long program; - * u_long version; - * struct timeval wait; - * int *sockp; - * - * Same as above, but you specify max packet sizes. - * CLIENT * - * clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz) - * struct sockaddr_in *raddr; - * u_long program; - * u_long version; - * struct timeval wait; - * int *sockp; - * u_int sendsz; - * u_int recvsz; - */ -extern CLIENT *clntudp_create(DOTS); -extern CLIENT *clntudp_bufcreate(DOTS); - -/* - * Print why creation failed - */ -void clnt_pcreateerror(/* char *msg */DOTS); /* stderr */ -char *clnt_spcreateerror(/* char *msg */DOTS); /* string */ - -/* - * Like clnt_perror(), but is more verbose in its output - */ -void clnt_perrno(/* enum clnt_stat num */DOTS); /* stderr */ - -/* - * Print an English error message, given the client error code - */ -void clnt_perror(/* CLIENT *clnt, char *msg */DOTS); /* stderr */ -char *clnt_sperror(/* CLIENT *clnt, char *msg */DOTS); /* string */ - -/* - * If a creation fails, the following allows the user to figure out why. - */ -struct rpc_createerr { - enum clnt_stat cf_stat; - struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */ -}; - -#if defined(WIN32) || defined(WINDOWS_X86) || defined(WINDOWS_X86_GCC) -#ifdef ONCRPCDLL -extern struct rpc_createerr rpc_createerr; -#else -#ifdef __BORLANDC__ -extern __declspec(dllimport) struct rpc_createerr rpc_createerr; -#else -_declspec(dllimport) struct rpc_createerr rpc_createerr; -#endif -#endif -#else -extern struct rpc_createerr rpc_createerr; -#endif - - -/* - * Copy error message to buffer. - */ -char *clnt_sperrno(/* enum clnt_stat num */DOTS); /* string */ - - - -#define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */ -#define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */ - -#ifdef __cplusplus -}; -#endif - -#endif /*!_CLNT_*/ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/netdb.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/netdb.h deleted file mode 100644 index ec7b4dc58a..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/netdb.h +++ /dev/null @@ -1,51 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)netdb.h 2.1 88/07/29 3.9 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* @(#)rpc.h 1.8 87/07/24 SMI */ - -/* Really belongs in */ - -struct rpcent { - char *r_name; /* name of server for this rpc program */ - char **r_aliases; /* alias list */ - int r_number; /* rpc program number */ -}; - -struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent(); diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/pmap_cln.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/pmap_cln.h deleted file mode 100644 index 7335a74c16..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/pmap_cln.h +++ /dev/null @@ -1,88 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)pmap_clnt.h 2.1 88/07/29 4.0 RPCSRC; from 1.11 88/02/08 SMI */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * pmap_clnt.h - * Supplies C routines to get to portmap services. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#ifdef __cplusplus -extern "C" { -#define DOTS ... -#else -#define DOTS -#endif - -/* - * Usage: - * success = pmap_set(program, version, protocol, port); - * success = pmap_unset(program, version); - * port = pmap_getport(address, program, version, protocol); - * head = pmap_getmaps(address); - * clnt_stat = pmap_rmtcall(address, program, version, procedure, - * xdrargs, argsp, xdrres, resp, tout, port_ptr) - * (works for udp only.) - * clnt_stat = clnt_broadcast(program, version, procedure, - * xdrargs, argsp, xdrres, resp, eachresult) - * (like pmap_rmtcall, except the call is broadcasted to all - * locally connected nets. For each valid response received, - * the procedure eachresult is called. Its form is: - * done = eachresult(resp, raddr) - * bool_t done; - * caddr_t resp; - * struct sockaddr_in raddr; - * where resp points to the results of the call and raddr is the - * address if the responder to the broadcast. - */ - -extern bool_t pmap_set(DOTS); -extern bool_t pmap_unset(DOTS); -extern struct pmaplist *pmap_getmaps(DOTS); -enum clnt_stat pmap_rmtcall(DOTS); -enum clnt_stat clnt_broadcast(DOTS); -extern u_short pmap_getport(DOTS); - -#ifdef __cplusplus -}; -#endif - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/pmap_pro.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/pmap_pro.h deleted file mode 100644 index 0fc8642dc3..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/pmap_pro.h +++ /dev/null @@ -1,117 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)pmap_prot.h 2.1 88/07/29 4.0 RPCSRC; from 1.14 88/02/08 SMI */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -#ifdef __cplusplus -extern "C" { -#define DOTS ... -#else -#define DOTS -#endif - -/* - * pmap_prot.h - * Protocol for the local binder service, or pmap. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - * - * The following procedures are supported by the protocol: - * - * PMAPPROC_NULL() returns () - * takes nothing, returns nothing - * - * PMAPPROC_SET(struct pmap) returns (bool_t) - * TRUE is success, FALSE is failure. Registers the tuple - * [prog, vers, prot, port]. - * - * PMAPPROC_UNSET(struct pmap) returns (bool_t) - * TRUE is success, FALSE is failure. Un-registers pair - * [prog, vers]. prot and port are ignored. - * - * PMAPPROC_GETPORT(struct pmap) returns (long unsigned). - * 0 is failure. Otherwise returns the port number where the pair - * [prog, vers] is registered. It may lie! - * - * PMAPPROC_DUMP() RETURNS (struct pmaplist *) - * - * PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>) - * RETURNS (port, string<>); - * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc, encapsulatedargs); - * Calls the procedure on the local machine. If it is not registered, - * this procedure is quite; ie it does not return error information!!! - * This procedure only is supported on rpc/udp and calls via - * rpc/udp. This routine only passes null authentication parameters. - * This file has no interface to xdr routines for PMAPPROC_CALLIT. - * - * The service supports remote procedure calls on udp/ip or tcp/ip socket 111. - */ - -#define PMAPPORT ((u_short)111) -#define PMAPPROG ((u_long)100000) -#define PMAPVERS ((u_long)2) -#define PMAPVERS_PROTO ((u_long)2) -#define PMAPVERS_ORIG ((u_long)1) -#define PMAPPROC_NULL ((u_long)0) -#define PMAPPROC_SET ((u_long)1) -#define PMAPPROC_UNSET ((u_long)2) -#define PMAPPROC_GETPORT ((u_long)3) -#define PMAPPROC_DUMP ((u_long)4) -#define PMAPPROC_CALLIT ((u_long)5) - -struct pmap { - long unsigned pm_prog; - long unsigned pm_vers; - long unsigned pm_prot; - long unsigned pm_port; -}; - -extern bool_t xdr_pmap(DOTS); - -struct pmaplist { - struct pmap pml_map; - struct pmaplist *pml_next; -}; - -extern bool_t xdr_pmaplist(DOTS); - -#ifdef __cplusplus -}; -#endif - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/pmap_rmt.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/pmap_rmt.h deleted file mode 100644 index f36e25abc6..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/pmap_rmt.h +++ /dev/null @@ -1,75 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)pmap_rmt.h 2.1 88/07/29 4.0 RPCSRC; from 1.2 88/02/08 SMI */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -#ifdef __cplusplus -extern "C" { -#define DOTS ... -#else -#define DOTS -#endif - -/* - * Structures and XDR routines for parameters to and replies from - * the portmapper remote-call-service. - * - * Copyright (C) 1986, Sun Microsystems, Inc. - */ - -struct rmtcallargs { - u_long prog, vers, proc, arglen; - caddr_t args_ptr; - xdrproc_t xdr_args; -}; - -bool_t xdr_rmtcall_args(DOTS); - -struct rmtcallres { - u_long *port_ptr; - u_long resultslen; - caddr_t results_ptr; - xdrproc_t xdr_results; -}; - -bool_t xdr_rmtcallres(DOTS); -#ifdef __cplusplus -}; -#endif - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/rpc.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/rpc.h deleted file mode 100644 index aceecc6e15..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/rpc.h +++ /dev/null @@ -1,119 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)rpc.h 2.3 88/08/10 4.0 RPCSRC; from 1.9 88/02/08 SMI */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * rpc.h, Just includes the billions of rpc header files necessary to - * do remote procedure calling. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ -#ifndef __RPC_HEADER__ -#define __RPC_HEADER__ - -#if defined(WIN32) || defined(WINDOWS_X86) || defined(WINDOWS_X86_GCC) -#define FD_SETSIZE 128 - -#include -#include -#include /* some typedefs */ -#include - -#define WSAerrno (WSAGetLastError()) -#define gettimeofday(tv,tz) ((tv)->tv_sec = time(0), (tv)->tv_usec = 0) - -#ifdef __cplusplus -extern "C" { -#define DOTS ... -#else -#define DOTS -#endif - -extern int rpc_nt_init(void); -extern int rpc_nt_exit(void); -extern void nt_rpc_report(DOTS); - -#include -extern int xdr_opaque_auth(DOTS); - -#ifdef __cplusplus -}; -#endif - -#else -#include /* some typedefs */ -#include -#endif - -/* external data representation interfaces */ -#include /* generic (de)serializer */ - -/* Client side only authentication */ -#include /* generic authenticator (client side) */ - -/* Client side (mostly) remote procedure call */ -#include /* generic rpc stuff */ - -/* semi-private protocol headers */ -#include /* protocol for rpc messages */ -#if defined(WIN32) || defined(WINDOWS_X86) || defined(WINDOWS_X86_GCC) -#include /* protocol for unix style cred */ -#else -#include /* protocol for unix style cred */ -#endif -/* - * Uncomment-out the next line if you are building the rpc library with - * DES Authentication (see the README file in the secure_rpc/ directory). - */ -/*#include protocol for des style cred */ - -/* Server side only remote procedure callee */ -#include /* service manager and multiplexer */ -#include /* service side authenticator */ - -/* - * COMMENT OUT THE NEXT INCLUDE IF RUNNING ON SUN OS OR ON A VERSION - * OF UNIX BASED ON NFSSRC. These systems will already have the structures - * defined by included in . - */ -/* routines for parsing /etc/rpc */ -#include /* structures and routines to parse /etc/rpc */ - -#endif /* ndef __RPC_HEADER__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/rpc_msg.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/rpc_msg.h deleted file mode 100644 index 4f6dacd67f..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/rpc_msg.h +++ /dev/null @@ -1,215 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* @(#)rpc_msg.h 1.7 86/07/16 SMI */ - -/* - * rpc_msg.h - * rpc message definition - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#ifndef __RPC_MSG_HEADER__ -#define __RPC_MSG_HEADER__ - -#ifdef __cplusplus -extern "C" { -#define DOTS ... -#else -#define DOTS -#endif - -#define RPC_MSG_VERSION ((u_long) 2) -#define RPC_SERVICE_PORT ((u_short) 2048) - -/* - * Bottom up definition of an rpc message. - * NOTE: call and reply use the same overall stuct but - * different parts of unions within it. - */ - -enum msg_type { - CALL=0, - REPLY=1 -}; - -enum reply_stat { - MSG_ACCEPTED=0, - MSG_DENIED=1 -}; - -enum accept_stat { - SUCCESS=0, - PROG_UNAVAIL=1, - PROG_MISMATCH=2, - PROC_UNAVAIL=3, - GARBAGE_ARGS=4, - SYSTEM_ERR=5 -}; - -enum reject_stat { - RPC_MISMATCH=0, - AUTH_ERROR=1 -}; - -/* - * Reply part of an rpc exchange - */ - -/* - * Reply to an rpc request that was accepted by the server. - * Note: there could be an error even though the request was - * accepted. - */ -struct accepted_reply { - struct opaque_auth ar_verf; - enum accept_stat ar_stat; - union { - struct { - u_long low; - u_long high; - } AR_versions; - struct { - caddr_t where; - xdrproc_t proc; - } AR_results; - /* and many other null cases */ - } ru; -#define ar_results ru.AR_results -#define ar_vers ru.AR_versions -}; - -/* - * Reply to an rpc request that was rejected by the server. - */ -struct rejected_reply { - enum reject_stat rj_stat; - union { - struct { - u_long low; - u_long high; - } RJ_versions; - enum auth_stat RJ_why; /* why authentication did not work */ - } ru; -#define rj_vers ru.RJ_versions -#define rj_why ru.RJ_why -}; - -/* - * Body of a reply to an rpc request. - */ -struct reply_body { - enum reply_stat rp_stat; - union { - struct accepted_reply RP_ar; - struct rejected_reply RP_dr; - } ru; -#define rp_acpt ru.RP_ar -#define rp_rjct ru.RP_dr -}; - -/* - * Body of an rpc request call. - */ -struct call_body { - u_long cb_rpcvers; /* must be equal to two */ - u_long cb_prog; - u_long cb_vers; - u_long cb_proc; - struct opaque_auth cb_cred; - struct opaque_auth cb_verf; /* protocol specific - provided by client */ -}; - -/* - * The rpc message - */ -struct rpc_msg { - u_long rm_xid; - enum msg_type rm_direction; - union { - struct call_body RM_cmb; - struct reply_body RM_rmb; - } ru; -#define rm_call ru.RM_cmb -#define rm_reply ru.RM_rmb -}; -#define acpted_rply ru.RM_rmb.ru.RP_ar -#define rjcted_rply ru.RM_rmb.ru.RP_dr - - -/* - * XDR routine to handle a rpc message. - * xdr_callmsg(xdrs, cmsg) - * XDR *xdrs; - * struct rpc_msg *cmsg; - */ -extern bool_t xdr_callmsg(DOTS); - -/* - * XDR routine to pre-serialize the static part of a rpc message. - * xdr_callhdr(xdrs, cmsg) - * XDR *xdrs; - * struct rpc_msg *cmsg; - */ -extern bool_t xdr_callhdr(DOTS); - -/* - * XDR routine to handle a rpc reply. - * xdr_replymsg(xdrs, rmsg) - * XDR *xdrs; - * struct rpc_msg *rmsg; - */ -extern bool_t xdr_replymsg(DOTS); - -/* - * Fills in the error part of a reply message. - * _seterr_reply(msg, error) - * struct rpc_msg *msg; - * struct rpc_err *error; - */ -extern void _seterr_reply(DOTS); - -#ifdef __cplusplus -}; -#endif - -#endif /* __RPC_MSG_HEADER__ */ - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/svc.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/svc.h deleted file mode 100644 index b183839042..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/svc.h +++ /dev/null @@ -1,313 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)svc.h 2.2 88/07/29 4.0 RPCSRC; from 1.20 88/02/08 SMI */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * svc.h, Server-side remote procedure call interface. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#ifndef __SVC_HEADER__ -#define __SVC_HEADER__ - -#ifdef __cplusplus -extern "C" { -#define DOTS ... -#else -#define DOTS -#endif - - -/* - * This interface must manage two items concerning remote procedure calling: - * - * 1) An arbitrary number of transport connections upon which rpc requests - * are received. The two most notable transports are TCP and UDP; they are - * created and registered by routines in svc_tcp.c and svc_udp.c, respectively; - * they in turn call xprt_register and xprt_unregister. - * - * 2) An arbitrary number of locally registered services. Services are - * described by the following four data: program number, version number, - * "service dispatch" function, a transport handle, and a boolean that - * indicates whether or not the exported program should be registered with a - * local binder service; if true the program's number and version and the - * port number from the transport handle are registered with the binder. - * These data are registered with the rpc svc system via svc_register. - * - * A service's dispatch function is called whenever an rpc request comes in - * on a transport. The request's program and version numbers must match - * those of the registered service. The dispatch function is passed two - * parameters, struct svc_req * and SVCXPRT *, defined below. - */ - -enum xprt_stat { - XPRT_DIED, - XPRT_MOREREQS, - XPRT_IDLE -}; - -/* - * Server side transport handle - */ -typedef struct { - int xp_sock; - u_short xp_port; /* associated port number */ - struct xp_ops { - bool_t (*xp_recv)(DOTS); /* receive incomming requests */ - enum xprt_stat (*xp_stat)(DOTS); /* get transport status */ - bool_t (*xp_getargs)(DOTS); /* get arguments */ - bool_t (*xp_reply)(DOTS); /* send reply */ - bool_t (*xp_freeargs)(DOTS);/* free mem allocated for args */ - void (*xp_destroy)(DOTS); /* destroy this struct */ - } *xp_ops; - int xp_addrlen; /* length of remote address */ - struct sockaddr_in xp_raddr; /* remote address */ - struct opaque_auth xp_verf; /* raw response verifier */ - caddr_t xp_p1; /* private */ - caddr_t xp_p2; /* private */ -} SVCXPRT; - -/* - * Approved way of getting address of caller - */ -#define svc_getcaller(x) (&(x)->xp_raddr) - -/* - * Operations defined on an SVCXPRT handle - * - * SVCXPRT *xprt; - * struct rpc_msg *msg; - * xdrproc_t xargs; - * caddr_t argsp; - */ -#define SVC_RECV(xprt, msg) \ - (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) -#define svc_recv(xprt, msg) \ - (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) - -#define SVC_STAT(xprt) \ - (*(xprt)->xp_ops->xp_stat)(xprt) -#define svc_stat(xprt) \ - (*(xprt)->xp_ops->xp_stat)(xprt) - -#define SVC_GETARGS(xprt, xargs, argsp) \ - (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp)) -#define svc_getargs(xprt, xargs, argsp) \ - (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp)) - -#define SVC_REPLY(xprt, msg) \ - (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) -#define svc_reply(xprt, msg) \ - (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) - -#define SVC_FREEARGS(xprt, xargs, argsp) \ - (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp)) -#define svc_freeargs(xprt, xargs, argsp) \ - (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp)) - -#define SVC_DESTROY(xprt) \ - (*(xprt)->xp_ops->xp_destroy)(xprt) -#define svc_destroy(xprt) \ - (*(xprt)->xp_ops->xp_destroy)(xprt) - - -/* - * Service request - */ -struct svc_req { - u_long rq_prog; /* service program number */ - u_long rq_vers; /* service protocol version */ - u_long rq_proc; /* the desired procedure */ - struct opaque_auth rq_cred; /* raw creds from the wire */ - caddr_t rq_clntcred; /* read only cooked cred */ - SVCXPRT *rq_xprt; /* associated transport */ -}; - - -/* - * Service registration - * - * svc_register(xprt, prog, vers, dispatch, protocol) - * SVCXPRT *xprt; - * u_long prog; - * u_long vers; - * void (*dispatch)(DOTS); - * int protocol; // like TCP or UDP, zero means do not register - */ -extern bool_t svc_register(DOTS); - -/* - * Service un-registration - * - * svc_unregister(prog, vers) - * u_long prog; - * u_long vers; - */ -extern void svc_unregister(DOTS); - -/* - * Transport registration. - * - * xprt_register(xprt) - * SVCXPRT *xprt; - */ -extern void xprt_register(DOTS); - -/* - * Transport un-register - * - * xprt_unregister(xprt) - * SVCXPRT *xprt; - */ -extern void xprt_unregister(DOTS); - - - - -/* - * When the service routine is called, it must first check to see if it - * knows about the procedure; if not, it should call svcerr_noproc - * and return. If so, it should deserialize its arguments via - * SVC_GETARGS (defined above). If the deserialization does not work, - * svcerr_decode should be called followed by a return. Successful - * decoding of the arguments should be followed the execution of the - * procedure's code and a call to svc_sendreply. - * - * Also, if the service refuses to execute the procedure due to too- - * weak authentication parameters, svcerr_weakauth should be called. - * Note: do not confuse access-control failure with weak authentication! - * - * NB: In pure implementations of rpc, the caller always waits for a reply - * msg. This message is sent when svc_sendreply is called. - * Therefore pure service implementations should always call - * svc_sendreply even if the function logically returns void; use - * xdr.h - xdr_void for the xdr routine. HOWEVER, tcp based rpc allows - * for the abuse of pure rpc via batched calling or pipelining. In the - * case of a batched call, svc_sendreply should NOT be called since - * this would send a return message, which is what batching tries to avoid. - * It is the service/protocol writer's responsibility to know which calls are - * batched and which are not. Warning: responding to batch calls may - * deadlock the caller and server processes! - */ - -extern bool_t svc_sendreply(DOTS); -extern void svcerr_decode(DOTS); -extern void svcerr_weakauth(DOTS); -extern void svcerr_noproc(DOTS); -extern void svcerr_progvers(DOTS); -extern void svcerr_auth(DOTS); -extern void svcerr_noprog(DOTS); -extern void svcerr_systemerr(DOTS); - -/* - * Lowest level dispatching -OR- who owns this process anyway. - * Somebody has to wait for incoming requests and then call the correct - * service routine. The routine svc_run does infinite waiting; i.e., - * svc_run never returns. - * Since another (co-existant) package may wish to selectively wait for - * incoming calls or other events outside of the rpc architecture, the - * routine svc_getreq is provided. It must be passed readfds, the - * "in-place" results of a select system call (see select, section 2). - */ - -/* - * Global keeper of rpc service descriptors in use - * dynamic; must be inspected before each call to select - */ -#ifdef FD_SETSIZE -#if defined(WIN32) || defined(WINDOWS_X86) || defined(WINDOWS_X86_GCC) -#ifdef ONCRPCDLL -extern fd_set svc_fdset; -#else -#ifdef __BORLANDC__ -extern __import fd_set svc_fdset; -#else -_declspec(dllimport) fd_set svc_fdset; -#endif -#endif -#else -extern fd_set svc_fdset; -#endif -#define svc_fds svc_fdset.fds_bits[0] /* compatibility */ -#else -extern int svc_fds; -#endif /* def FD_SETSIZE */ - -/* - * a small program implemented by the svc_rpc implementation itself; - * also see clnt.h for protocol numbers. - */ -extern void rpctest_service(DOTS); - -extern void svc_getreq(DOTS); -extern void svc_getreqset(DOTS); /* takes fdset instead of int */ -extern void svc_run(DOTS); /* never returns */ - -/* - * Socket to use on svcxxx_create call to get default socket - */ -#define RPC_ANYSOCK -1 - -/* - * These are the existing service side transport implementations - */ - -/* - * Memory based rpc for testing and timing. - */ -extern SVCXPRT *svcraw_create(DOTS); - -/* - * Udp based rpc. - */ -extern SVCXPRT *svcudp_create(DOTS); -extern SVCXPRT *svcudp_bufcreate(DOTS); - -/* - * Tcp based rpc. - */ -extern SVCXPRT *svctcp_create(DOTS); - -#ifdef __cplusplus -}; -#endif - -#endif /* __SVC_HEADER__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/svc_auth.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/svc_auth.h deleted file mode 100644 index 75e2f232b8..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/svc_auth.h +++ /dev/null @@ -1,58 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)svc_auth.h 2.1 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* @(#)svc_auth.h 1.6 86/07/16 SMI */ - -/* - * svc_auth.h, Service side of rpc authentication. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - - -/* - * Server side authenticator - */ -#ifdef __cplusplus -extern "C" auth_stat _authenticate(...); -#else -extern struct auth_stat _authenticate(); -#endif - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/types.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/types.h deleted file mode 100644 index 41f57b4f19..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/types.h +++ /dev/null @@ -1,87 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)types.h 2.3 88/08/15 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* @(#)types.h 1.18 87/07/24 SMI */ - -/* - * Rpc additions to - */ -#ifndef __TYPES_RPC_HEADER__ -#define __TYPES_RPC_HEADER__ - -#define bool_t int -#define enum_t int -#ifndef FALSE -#define FALSE (0) -#endif -#ifndef TRUE -#define TRUE (1) -#endif -#define __dontcare__ -1 -#ifndef NULL -# define NULL 0 -#endif - -#if ! (defined(WIN32) || defined(WINDOWS_X86) ||defined(WINDOWS_X86_GCC)) -extern char *malloc(); -#endif -#define mem_alloc malloc -#define mem_free(ptr, bsize) free(ptr) - -#ifndef makedev /* ie, we haven't already included it */ -#include -#endif -#if ! (defined(WIN32) || defined(WINDOWS_X86) ||defined(WINDOWS_X86_GCC)) -#include -#endif - -#ifndef INADDR_LOOPBACK -#define INADDR_LOOPBACK (u_long)0x7F000001 -#endif -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 64 -#endif - -typedef char *caddr_t; -typedef unsigned int u_int; -typedef unsigned long u_long; -typedef unsigned short u_short; - -#endif /* ndef __TYPES_RPC_HEADER__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/xdr.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/xdr.h deleted file mode 100644 index 146372c1b3..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/rpc/xdr.h +++ /dev/null @@ -1,292 +0,0 @@ -/********************************************************************* - * RPC for the Windows NT Operating System - * 1993 by Martin F. Gergeleit - * Users may use, copy or modify Sun RPC for the Windows NT Operating - * System according to the Sun copyright below. - * - * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO - * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE - * USE OF. USE ENTIRELY AT YOUR OWN RISK!!! - *********************************************************************/ - -/* @(#)xdr.h 2.2 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* @(#)xdr.h 1.19 87/04/22 SMI */ - -/* - * xdr.h, External Data Representation Serialization Routines. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#ifndef __XDR_HEADER__ -#define __XDR_HEADER__ - -#ifdef __cplusplus -extern "C" { -#define DOTS ... -#else -#define DOTS -#endif - -/* - * XDR provides a conventional way for converting between C data - * types and an external bit-string representation. Library supplied - * routines provide for the conversion on built-in C data types. These - * routines and utility routines defined here are used to help implement - * a type encode/decode routine for each user-defined type. - * - * Each data type provides a single procedure which takes two arguments: - * - * bool_t - * xdrproc(xdrs, argresp) - * XDR *xdrs; - * *argresp; - * - * xdrs is an instance of a XDR handle, to which or from which the data - * type is to be converted. argresp is a pointer to the structure to be - * converted. The XDR handle contains an operation field which indicates - * which of the operations (ENCODE, DECODE * or FREE) is to be performed. - * - * XDR_DECODE may allocate space if the pointer argresp is null. This - * data can be freed with the XDR_FREE operation. - * - * We write only one procedure per data type to make it easy - * to keep the encode and decode procedures for a data type consistent. - * In many cases the same code performs all operations on a user defined type, - * because all the hard work is done in the component type routines. - * decode as a series of calls on the nested data types. - */ - -/* - * Xdr operations. XDR_ENCODE causes the type to be encoded into the - * stream. XDR_DECODE causes the type to be extracted from the stream. - * XDR_FREE can be used to release the space allocated by an XDR_DECODE - * request. - */ -enum xdr_op { - XDR_ENCODE=0, - XDR_DECODE=1, - XDR_FREE=2 -}; - -/* - * This is the number of bytes per unit of external data. - */ -#define BYTES_PER_XDR_UNIT (4) -#define RNDUP(x) ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \ - * BYTES_PER_XDR_UNIT) - -/* - * A xdrproc_t exists for each data type which is to be encoded or decoded. - * - * The second argument to the xdrproc_t is a pointer to an opaque pointer. - * The opaque pointer generally points to a structure of the data type - * to be decoded. If this pointer is 0, then the type routines should - * allocate dynamic storage of the appropriate size and return it. - * bool_t (*xdrproc_t)(XDR *, caddr_t *); - */ -typedef bool_t (*xdrproc_t)(DOTS); - -/* - * The XDR handle. - * Contains operation which is being applied to the stream, - * an operations vector for the paticular implementation (e.g. see xdr_mem.c), - * and two private fields for the use of the particular impelementation. - */ -typedef struct { - enum xdr_op x_op; /* operation; fast additional param */ - struct xdr_ops { - bool_t (*x_getlong)(DOTS); /* get a long from underlying stream */ - bool_t (*x_putlong)(DOTS); /* put a long to " */ - bool_t (*x_getbytes)(DOTS);/* get some bytes from " */ - bool_t (*x_putbytes)(DOTS);/* put some bytes to " */ - u_int (*x_getpostn)(DOTS);/* returns bytes off from beginning */ - bool_t (*x_setpostn)(DOTS);/* lets you reposition the stream */ - long * (*x_inline)(DOTS); /* buf quick ptr to buffered data */ - void (*x_destroy)(DOTS); /* free privates of this xdr_stream */ - } *x_ops; - caddr_t x_public; /* users' data */ - caddr_t x_private; /* pointer to private data */ - caddr_t x_base; /* private used for position info */ - int x_handy; /* extra private word */ -} XDR; - -/* - * Operations defined on a XDR handle - * - * XDR *xdrs; - * long *longp; - * caddr_t addr; - * u_int len; - * u_int pos; - */ -#define XDR_GETLONG(xdrs, longp) \ - (*(xdrs)->x_ops->x_getlong)(xdrs, longp) -#define xdr_getlong(xdrs, longp) \ - (*(xdrs)->x_ops->x_getlong)(xdrs, longp) - -#define XDR_PUTLONG(xdrs, longp) \ - (*(xdrs)->x_ops->x_putlong)(xdrs, longp) -#define xdr_putlong(xdrs, longp) \ - (*(xdrs)->x_ops->x_putlong)(xdrs, longp) - -#define XDR_GETBYTES(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) -#define xdr_getbytes(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) - -#define XDR_PUTBYTES(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) -#define xdr_putbytes(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) - -#define XDR_GETPOS(xdrs) \ - (*(xdrs)->x_ops->x_getpostn)(xdrs) -#define xdr_getpos(xdrs) \ - (*(xdrs)->x_ops->x_getpostn)(xdrs) - -#define XDR_SETPOS(xdrs, pos) \ - (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) -#define xdr_setpos(xdrs, pos) \ - (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) - -#define XDR_INLINE(xdrs, len) \ - (*(xdrs)->x_ops->x_inline)(xdrs, len) -#define xdr_inline(xdrs, len) \ - (*(xdrs)->x_ops->x_inline)(xdrs, len) - -#define XDR_DESTROY(xdrs) \ - if ((xdrs)->x_ops->x_destroy) \ - (*(xdrs)->x_ops->x_destroy)(xdrs) -#define xdr_destroy(xdrs) \ - if ((xdrs)->x_ops->x_destroy) \ - (*(xdrs)->x_ops->x_destroy)(xdrs) - -/* - * Support struct for discriminated unions. - * You create an array of xdrdiscrim structures, terminated with - * a entry with a null procedure pointer. The xdr_union routine gets - * the discriminant value and then searches the array of structures - * for a matching value. If a match is found the associated xdr routine - * is called to handle that part of the union. If there is - * no match, then a default routine may be called. - * If there is no match and no default routine it is an error. - */ -#define NULL_xdrproc_t ((xdrproc_t)0) -struct xdr_discrim { - int value; - xdrproc_t proc; -}; - -/* - * In-line routines for fast encode/decode of primitve data types. - * Caveat emptor: these use single memory cycles to get the - * data from the underlying buffer, and will fail to operate - * properly if the data is not aligned. The standard way to use these - * is to say: - * if ((buf = XDR_INLINE(xdrs, count)) == NULL) - * return (FALSE); - * <<< macro calls >>> - * where ``count'' is the number of bytes of data occupied - * by the primitive data types. - * - * N.B. and frozen for all time: each data type here uses 4 bytes - * of external representation. - */ -#define IXDR_GET_LONG(buf) ((long)ntohl((u_long)*(buf)++)) -#define IXDR_PUT_LONG(buf, v) (*(buf)++ = (long)htonl((u_long)v)) - -#define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf)) -#define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf)) -#define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf)) -#define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf)) -#define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_LONG(buf)) - -#define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) -#define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) -#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) -#define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) -#define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) - -/* - * These are the "generic" xdr routines. - */ -extern bool_t xdr_void(DOTS); -extern bool_t xdr_int(DOTS); -extern bool_t xdr_u_int(DOTS); -extern bool_t xdr_long(DOTS); -extern bool_t xdr_u_long(DOTS); -extern bool_t xdr_short(DOTS); -extern bool_t xdr_u_short(DOTS); -extern bool_t xdr_bool(DOTS); -extern bool_t xdr_enum(DOTS); -extern bool_t xdr_array(DOTS); -extern bool_t xdr_bytes(DOTS); -extern bool_t xdr_opaque(DOTS); -extern bool_t xdr_string(DOTS); -extern bool_t xdr_union(DOTS); -extern bool_t xdr_char(DOTS); -extern bool_t xdr_u_char(DOTS); -extern bool_t xdr_vector(DOTS); -extern bool_t xdr_float(DOTS); -extern bool_t xdr_double(DOTS); -extern bool_t xdr_reference(DOTS); -extern bool_t xdr_pointer(DOTS); -extern bool_t xdr_wrapstring(DOTS); - -/* - * Common opaque bytes objects used by many rpc protocols; - * declared here due to commonality. - */ -#define MAX_NETOBJ_SZ 1024 -struct netobj { - u_int n_len; - char *n_bytes; -}; -typedef struct netobj netobj; -extern bool_t xdr_netobj(DOTS); - -/* - * These are the public routines for the various implementations of - * xdr streams. - */ -extern void xdrmem_create(DOTS); /* XDR using memory buffers */ -extern void xdrstdio_create(DOTS); /* XDR using stdio library */ -extern void xdrrec_create(DOTS); /* XDR pseudo records for tcp */ -extern bool_t xdrrec_endofrecord(DOTS); /* make end of xdr record */ -extern bool_t xdrrec_skiprecord(DOTS); /* move to beginning of next record */ -extern bool_t xdrrec_eof(DOTS); /* true if no more input */ - -#ifdef __cplusplus -}; -#endif - -#endif /* __XDR_HEADER__ */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/zconf.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/zconf.h deleted file mode 100644 index 245781102a..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/zconf.h +++ /dev/null @@ -1,279 +0,0 @@ -/* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-1998 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id: zconf.h,v 1.1 2004/09/02 14:43:52 wayne Exp $ */ - -#ifndef _ZCONF_H -#define _ZCONF_H - -/* - * If you *really* need a unique prefix for all types and library functions, - * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. - */ -#ifdef Z_PREFIX -# define deflateInit_ z_deflateInit_ -# define deflate z_deflate -# define deflateEnd z_deflateEnd -# define inflateInit_ z_inflateInit_ -# define inflate z_inflate -# define inflateEnd z_inflateEnd -# define deflateInit2_ z_deflateInit2_ -# define deflateSetDictionary z_deflateSetDictionary -# define deflateCopy z_deflateCopy -# define deflateReset z_deflateReset -# define deflateParams z_deflateParams -# define inflateInit2_ z_inflateInit2_ -# define inflateSetDictionary z_inflateSetDictionary -# define inflateSync z_inflateSync -# define inflateSyncPoint z_inflateSyncPoint -# define inflateReset z_inflateReset -# define compress z_compress -# define compress2 z_compress2 -# define uncompress z_uncompress -# define adler32 z_adler32 -# define crc32 z_crc32 -# define get_crc_table z_get_crc_table - -# define Byte z_Byte -# define uInt z_uInt -# define uLong z_uLong -# define Bytef z_Bytef -# define charf z_charf -# define intf z_intf -# define uIntf z_uIntf -# define uLongf z_uLongf -# define voidpf z_voidpf -# define voidp z_voidp -#endif - -#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) -# define WIN32 -#endif -#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386) -# ifndef __32BIT__ -# define __32BIT__ -# endif -#endif -#if defined(__MSDOS__) && !defined(MSDOS) -# define MSDOS -#endif - -/* - * Compile with -DMAXSEG_64K if the alloc function cannot allocate more - * than 64k bytes at a time (needed on systems with 16-bit int). - */ -#if defined(MSDOS) && !defined(__32BIT__) -# define MAXSEG_64K -#endif -#ifdef MSDOS -# define UNALIGNED_OK -#endif - -#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC) -# define STDC -#endif -#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__) -# ifndef STDC -# define STDC -# endif -#endif - -#ifndef STDC -# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ -# define const -# endif -#endif - -/* Some Mac compilers merge all .h files incorrectly: */ -#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__) -# define NO_DUMMY_DECL -#endif - -/* Old Borland C incorrectly complains about missing returns: */ -#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) -# define NEED_DUMMY_RETURN -#endif - - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# ifdef MAXSEG_64K -# define MAX_MEM_LEVEL 8 -# else -# define MAX_MEM_LEVEL 9 -# endif -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus a few kilobytes - for small objects. -*/ - - /* Type declarations */ - -#ifndef OF /* function prototypes */ -# ifdef STDC -# define OF(args) args -# else -# define OF(args) () -# endif -#endif - -/* The following definitions for FAR are needed only for MSDOS mixed - * model programming (small or medium model with some far allocations). - * This was tested only with MSC; for other MSDOS compilers you may have - * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, - * just define FAR to be empty. - */ -#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__) - /* MSC small or medium model */ -# define SMALL_MEDIUM -# ifdef _MSC_VER -# define FAR _far -# else -# define FAR far -# endif -#endif -#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) -# ifndef __32BIT__ -# define SMALL_MEDIUM -# define FAR _far -# endif -#endif - -/* Compile with -DZLIB_DLL for Windows DLL support */ -#if defined(ZLIB_DLL) -# if defined(_WINDOWS) || defined(WINDOWS) -# ifdef FAR -# undef FAR -# endif -# include -# define ZEXPORT WINAPI -# ifdef WIN32 -# define ZEXPORTVA WINAPIV -# else -# define ZEXPORTVA FAR _cdecl _export -# endif -# endif -# if defined (__BORLANDC__) -# if (__BORLANDC__ >= 0x0500) && defined (WIN32) -# include -# define ZEXPORT __declspec(dllexport) WINAPI -# define ZEXPORTRVA __declspec(dllexport) WINAPIV -# else -# if defined (_Windows) && defined (__DLL__) -# define ZEXPORT _export -# define ZEXPORTVA _export -# endif -# endif -# endif -#endif - -#if defined (__BEOS__) -# if defined (ZLIB_DLL) -# define ZEXTERN extern __declspec(dllexport) -# else -# define ZEXTERN extern __declspec(dllimport) -# endif -#endif - -#ifndef ZEXPORT -# define ZEXPORT -#endif -#ifndef ZEXPORTVA -# define ZEXPORTVA -#endif -#ifndef ZEXTERN -# define ZEXTERN extern -#endif - -#ifndef FAR -# define FAR -#endif - -#if !defined(MACOS) && !defined(TARGET_OS_MAC) -typedef unsigned char Byte; /* 8 bits */ -#endif -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ - -#ifdef SMALL_MEDIUM - /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ -# define Bytef Byte FAR -#else - typedef Byte FAR Bytef; -#endif -typedef char FAR charf; -typedef int FAR intf; -typedef uInt FAR uIntf; -typedef uLong FAR uLongf; - -#ifdef STDC - typedef void FAR *voidpf; - typedef void *voidp; -#else - typedef Byte FAR *voidpf; - typedef Byte *voidp; -#endif - -#ifdef HAVE_UNISTD_H -# include /* for off_t */ -# include /* for SEEK_* and off_t */ -# define z_off_t off_t -#endif -#ifndef SEEK_SET -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif -#ifndef z_off_t -# define z_off_t long -#endif - -/* MVS linker does not support external names larger than 8 bytes */ -#if defined(__MVS__) -# pragma map(deflateInit_,"DEIN") -# pragma map(deflateInit2_,"DEIN2") -# pragma map(deflateEnd,"DEEND") -# pragma map(inflateInit_,"ININ") -# pragma map(inflateInit2_,"ININ2") -# pragma map(inflateEnd,"INEND") -# pragma map(inflateSync,"INSY") -# pragma map(inflateSetDictionary,"INSEDI") -# pragma map(inflate_blocks,"INBL") -# pragma map(inflate_blocks_new,"INBLNE") -# pragma map(inflate_blocks_free,"INBLFR") -# pragma map(inflate_blocks_reset,"INBLRE") -# pragma map(inflate_codes_free,"INCOFR") -# pragma map(inflate_codes,"INCO") -# pragma map(inflate_fast,"INFA") -# pragma map(inflate_flush,"INFLU") -# pragma map(inflate_mask,"INMA") -# pragma map(inflate_set_dictionary,"INSEDI2") -# pragma map(inflate_copyright,"INCOPY") -# pragma map(inflate_trees_bits,"INTRBI") -# pragma map(inflate_trees_dynamic,"INTRDY") -# pragma map(inflate_trees_fixed,"INTRFI") -# pragma map(inflate_trees_free,"INTRFR") -#endif - -#endif /* _ZCONF_H */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/zlib.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/zlib.h deleted file mode 100644 index da424f3f1e..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/include/zlib.h +++ /dev/null @@ -1,893 +0,0 @@ -/* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.1.3, July 9th, 1998 - - Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - - - The data format used by the zlib library is described by RFCs (Request for - Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt - (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). -*/ - -#ifndef _ZLIB_H -#define _ZLIB_H - -#include "zconf.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define ZLIB_VERSION "1.1.3" - -/* - The 'zlib' compression library provides in-memory compression and - decompression functions, including integrity checks of the uncompressed - data. This version of the library supports only one compression method - (deflation) but other algorithms will be added later and will have the same - stream interface. - - Compression can be done in a single step if the buffers are large - enough (for example if an input file is mmap'ed), or can be done by - repeated calls of the compression function. In the latter case, the - application must provide more input and/or consume the output - (providing more output space) before each call. - - The library also supports reading and writing files in gzip (.gz) format - with an interface similar to that of stdio. - - The library does not install any signal handler. The decoder checks - the consistency of the compressed data, so the library should never - crash even in case of corrupted input. -*/ - -typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); -typedef void (*free_func) OF((voidpf opaque, voidpf address)); - -struct internal_state; - -typedef struct z_stream_s { - Bytef *next_in; /* next input byte */ - uInt avail_in; /* number of bytes available at next_in */ - uLong total_in; /* total nb of input bytes read so far */ - - Bytef *next_out; /* next output byte should be put there */ - uInt avail_out; /* remaining free space at next_out */ - uLong total_out; /* total nb of bytes output so far */ - - char *msg; /* last error message, NULL if no error */ - struct internal_state FAR *state; /* not visible by applications */ - - alloc_func zalloc; /* used to allocate the internal state */ - free_func zfree; /* used to free the internal state */ - voidpf opaque; /* private data object passed to zalloc and zfree */ - - int data_type; /* best guess about the data type: ascii or binary */ - uLong adler; /* adler32 value of the uncompressed data */ - uLong reserved; /* reserved for future use */ -} z_stream; - -typedef z_stream FAR *z_streamp; - -/* - The application must update next_in and avail_in when avail_in has - dropped to zero. It must update next_out and avail_out when avail_out - has dropped to zero. The application must initialize zalloc, zfree and - opaque before calling the init function. All other fields are set by the - compression library and must not be updated by the application. - - The opaque value provided by the application will be passed as the first - parameter for calls of zalloc and zfree. This can be useful for custom - memory management. The compression library attaches no meaning to the - opaque value. - - zalloc must return Z_NULL if there is not enough memory for the object. - If zlib is used in a multi-threaded application, zalloc and zfree must be - thread safe. - - On 16-bit systems, the functions zalloc and zfree must be able to allocate - exactly 65536 bytes, but will not be required to allocate more than this - if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, - pointers returned by zalloc for objects of exactly 65536 bytes *must* - have their offset normalized to zero. The default allocation function - provided by this library ensures this (see zutil.c). To reduce memory - requirements and avoid any allocation of 64K objects, at the expense of - compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). - - The fields total_in and total_out can be used for statistics or - progress reports. After compression, total_in holds the total size of - the uncompressed data and may be saved for use in the decompressor - (particularly if the decompressor wants to decompress everything in - a single step). -*/ - - /* constants */ - -#define Z_NO_FLUSH 0 -#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ -#define Z_SYNC_FLUSH 2 -#define Z_FULL_FLUSH 3 -#define Z_FINISH 4 -/* Allowed flush values; see deflate() below for details */ - -#define Z_OK 0 -#define Z_STREAM_END 1 -#define Z_NEED_DICT 2 -#define Z_ERRNO (-1) -#define Z_STREAM_ERROR (-2) -#define Z_DATA_ERROR (-3) -#define Z_MEM_ERROR (-4) -#define Z_BUF_ERROR (-5) -#define Z_VERSION_ERROR (-6) -/* Return codes for the compression/decompression functions. Negative - * values are errors, positive values are used for special but normal events. - */ - -#define Z_NO_COMPRESSION 0 -#define Z_BEST_SPEED 1 -#define Z_BEST_COMPRESSION 9 -#define Z_DEFAULT_COMPRESSION (-1) -/* compression levels */ - -#define Z_FILTERED 1 -#define Z_HUFFMAN_ONLY 2 -#define Z_DEFAULT_STRATEGY 0 -/* compression strategy; see deflateInit2() below for details */ - -#define Z_BINARY 0 -#define Z_ASCII 1 -#define Z_UNKNOWN 2 -/* Possible values of the data_type field */ - -#define Z_DEFLATED 8 -/* The deflate compression method (the only one supported in this version) */ - -#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ - -#define zlib_version zlibVersion() -/* for compatibility with versions < 1.0.2 */ - - /* basic functions */ - -ZEXTERN char const *ZEXPORT zlibVersion OF((void)); -/* The application can compare zlibVersion and ZLIB_VERSION for consistency. - If the first character differs, the library code actually used is - not compatible with the zlib.h header file used by the application. - This check is automatically made by deflateInit and inflateInit. - */ - -/* -ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); - - Initializes the internal stream state for compression. The fields - zalloc, zfree and opaque must be initialized before by the caller. - If zalloc and zfree are set to Z_NULL, deflateInit updates them to - use default allocation functions. - - The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: - 1 gives best speed, 9 gives best compression, 0 gives no compression at - all (the input data is simply copied a block at a time). - Z_DEFAULT_COMPRESSION requests a default compromise between speed and - compression (currently equivalent to level 6). - - deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if level is not a valid compression level, - Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible - with the version assumed by the caller (ZLIB_VERSION). - msg is set to null if there is no error message. deflateInit does not - perform any compression: this will be done by deflate(). -*/ - - -ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); -/* - deflate compresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce some - output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. deflate performs one or both of the - following actions: - - - Compress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in and avail_in are updated and - processing will resume at this point for the next call of deflate(). - - - Provide more output starting at next_out and update next_out and avail_out - accordingly. This action is forced if the parameter flush is non zero. - Forcing flush frequently degrades the compression ratio, so this parameter - should be set only when necessary (in interactive applications). - Some output may be provided even if flush is not set. - - Before the call of deflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming - more output, and updating avail_in or avail_out accordingly; avail_out - should never be zero before the call. The application can consume the - compressed output when it wants, for example when the output buffer is full - (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK - and with zero avail_out, it must be called again after making room in the - output buffer because there might be more output pending. - - If the parameter flush is set to Z_SYNC_FLUSH, all pending output is - flushed to the output buffer and the output is aligned on a byte boundary, so - that the decompressor can get all input data available so far. (In particular - avail_in is zero after the call if enough output space has been provided - before the call.) Flushing may degrade compression for some compression - algorithms and so it should be used only when necessary. - - If flush is set to Z_FULL_FLUSH, all output is flushed as with - Z_SYNC_FLUSH, and the compression state is reset so that decompression can - restart from this point if previous compressed data has been damaged or if - random access is desired. Using Z_FULL_FLUSH too often can seriously degrade - the compression. - - If deflate returns with avail_out == 0, this function must be called again - with the same value of the flush parameter and more output space (updated - avail_out), until the flush is complete (deflate returns with non-zero - avail_out). - - If the parameter flush is set to Z_FINISH, pending input is processed, - pending output is flushed and deflate returns with Z_STREAM_END if there - was enough output space; if deflate returns with Z_OK, this function must be - called again with Z_FINISH and more output space (updated avail_out) but no - more input data, until it returns with Z_STREAM_END or an error. After - deflate has returned Z_STREAM_END, the only possible operations on the - stream are deflateReset or deflateEnd. - - Z_FINISH can be used immediately after deflateInit if all the compression - is to be done in a single step. In this case, avail_out must be at least - 0.1% larger than avail_in plus 12 bytes. If deflate does not return - Z_STREAM_END, then it must be called again as described above. - - deflate() sets strm->adler to the adler32 checksum of all input read - so far (that is, total_in bytes). - - deflate() may update data_type if it can make a good guess about - the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered - binary. This field is only for information purposes and does not affect - the compression algorithm in any manner. - - deflate() returns Z_OK if some progress has been made (more input - processed or more output produced), Z_STREAM_END if all input has been - consumed and all output has been produced (only when flush is set to - Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible - (for example avail_in or avail_out was zero). -*/ - - -ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any - pending output. - - deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the - stream state was inconsistent, Z_DATA_ERROR if the stream was freed - prematurely (some input or output was discarded). In the error case, - msg may be set but then points to a static string (which must not be - deallocated). -*/ - - -/* -ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); - - Initializes the internal stream state for decompression. The fields - next_in, avail_in, zalloc, zfree and opaque must be initialized before by - the caller. If next_in is not Z_NULL and avail_in is large enough (the exact - value depends on the compression method), inflateInit determines the - compression method from the zlib header and allocates all data structures - accordingly; otherwise the allocation will be deferred to the first call of - inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to - use default allocation functions. - - inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller. msg is set to null if there is no error - message. inflateInit does not perform any decompression apart from reading - the zlib header if present: this will be done by inflate(). (So next_in and - avail_in may be modified, but next_out and avail_out are unchanged.) -*/ - - -ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); -/* - inflate decompresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may some - introduce some output latency (reading input without producing any output) - except when forced to flush. - - The detailed semantics are as follows. inflate performs one or both of the - following actions: - - - Decompress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in is updated and processing - will resume at this point for the next call of inflate(). - - - Provide more output starting at next_out and update next_out and avail_out - accordingly. inflate() provides as much output as possible, until there - is no more input data or no more space in the output buffer (see below - about the flush parameter). - - Before the call of inflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming - more output, and updating the next_* and avail_* values accordingly. - The application can consume the uncompressed output when it wants, for - example when the output buffer is full (avail_out == 0), or after each - call of inflate(). If inflate returns Z_OK and with zero avail_out, it - must be called again after making room in the output buffer because there - might be more output pending. - - If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much - output as possible to the output buffer. The flushing behavior of inflate is - not specified for values of the flush parameter other than Z_SYNC_FLUSH - and Z_FINISH, but the current implementation actually flushes as much output - as possible anyway. - - inflate() should normally be called until it returns Z_STREAM_END or an - error. However if all decompression is to be performed in a single step - (a single call of inflate), the parameter flush should be set to - Z_FINISH. In this case all pending input is processed and all pending - output is flushed; avail_out must be large enough to hold all the - uncompressed data. (The size of the uncompressed data may have been saved - by the compressor for this purpose.) The next operation on this stream must - be inflateEnd to deallocate the decompression state. The use of Z_FINISH - is never required, but can be used to inform inflate that a faster routine - may be used for the single inflate() call. - - If a preset dictionary is needed at this point (see inflateSetDictionary - below), inflate sets strm-adler to the adler32 checksum of the - dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise - it sets strm->adler to the adler32 checksum of all output produced - so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or - an error code as described below. At the end of the stream, inflate() - checks that its computed adler32 checksum is equal to that saved by the - compressor and returns Z_STREAM_END only if the checksum is correct. - - inflate() returns Z_OK if some progress has been made (more input processed - or more output produced), Z_STREAM_END if the end of the compressed data has - been reached and all uncompressed output has been produced, Z_NEED_DICT if a - preset dictionary is needed at this point, Z_DATA_ERROR if the input data was - corrupted (input stream not conforming to the zlib format or incorrect - adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent - (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if no progress is possible or if there was not - enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR - case, the application may then call inflateSync to look for a good - compression block. -*/ - - -ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any - pending output. - - inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state - was inconsistent. In the error case, msg may be set but then points to a - static string (which must not be deallocated). -*/ - - /* Advanced functions */ - -/* - The following functions are needed only in some special applications. -*/ - -/* -ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, - int level, - int method, - int windowBits, - int memLevel, - int strategy)); - - This is another version of deflateInit with more compression options. The - fields next_in, zalloc, zfree and opaque must be initialized before by - the caller. - - The method parameter is the compression method. It must be Z_DEFLATED in - this version of the library. - - The windowBits parameter is the base two logarithm of the window size - (the size of the history buffer). It should be in the range 8..15 for this - version of the library. Larger values of this parameter result in better - compression at the expense of memory usage. The default value is 15 if - deflateInit is used instead. - - The memLevel parameter specifies how much memory should be allocated - for the internal compression state. memLevel=1 uses minimum memory but - is slow and reduces compression ratio; memLevel=9 uses maximum memory - for optimal speed. The default value is 8. See zconf.h for total memory - usage as a function of windowBits and memLevel. - - The strategy parameter is used to tune the compression algorithm. Use the - value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a - filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no - string match). Filtered data consists mostly of small values with a - somewhat random distribution. In this case, the compression algorithm is - tuned to compress them better. The effect of Z_FILTERED is to force more - Huffman coding and less string matching; it is somewhat intermediate - between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects - the compression ratio but not the correctness of the compressed output even - if it is not set appropriately. - - deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid - method). msg is set to null if there is no error message. deflateInit2 does - not perform any compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, - Bytef const *dictionary, - uInt dictLength)); -/* - Initializes the compression dictionary from the given byte sequence - without producing any compressed output. This function must be called - immediately after deflateInit, deflateInit2 or deflateReset, before any - call of deflate. The compressor and decompressor must use exactly the same - dictionary (see inflateSetDictionary). - - The dictionary should consist of strings (byte sequences) that are likely - to be encountered later in the data to be compressed, with the most commonly - used strings preferably put towards the end of the dictionary. Using a - dictionary is most useful when the data to be compressed is short and can be - predicted with good accuracy; the data can then be compressed better than - with the default empty dictionary. - - Depending on the size of the compression data structures selected by - deflateInit or deflateInit2, a part of the dictionary may in effect be - discarded, for example if the dictionary is larger than the window size in - deflate or deflate2. Thus the strings most likely to be useful should be - put at the end of the dictionary, not at the front. - - Upon return of this function, strm->adler is set to the Adler32 value - of the dictionary; the decompressor may later use this value to determine - which dictionary has been used by the compressor. (The Adler32 value - applies to the whole dictionary even if only a subset of the dictionary is - actually used by the compressor.) - - deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is - inconsistent (for example if deflate has already been called for this stream - or if the compression method is bsort). deflateSetDictionary does not - perform any compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, - z_streamp source)); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when several compression strategies will be - tried, for example when there are several ways of pre-processing the input - data with a filter. The streams that will be discarded should then be freed - by calling deflateEnd. Note that deflateCopy duplicates the internal - compression state which can be quite large, so this strategy is slow and - can consume lots of memory. - - deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); -/* - This function is equivalent to deflateEnd followed by deflateInit, - but does not free and reallocate all the internal compression state. - The stream will keep the same compression level and any other attributes - that may have been set by deflateInit2. - - deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). -*/ - -ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, - int level, - int strategy)); -/* - Dynamically update the compression level and compression strategy. The - interpretation of level and strategy is as in deflateInit2. This can be - used to switch between compression and straight copy of the input data, or - to switch to a different kind of input data requiring a different - strategy. If the compression level is changed, the input available so far - is compressed with the old level (and may be flushed); the new level will - take effect only at the next call of deflate(). - - Before the call of deflateParams, the stream state must be set as for - a call of deflate(), since the currently available input may have to - be compressed and flushed. In particular, strm->avail_out must be non-zero. - - deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source - stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR - if strm->avail_out was zero. -*/ - -/* -ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, - int windowBits)); - - This is another version of inflateInit with an extra parameter. The - fields next_in, avail_in, zalloc, zfree and opaque must be initialized - before by the caller. - - The windowBits parameter is the base two logarithm of the maximum window - size (the size of the history buffer). It should be in the range 8..15 for - this version of the library. The default value is 15 if inflateInit is used - instead. If a compressed stream with a larger window size is given as - input, inflate() will return with the error code Z_DATA_ERROR instead of - trying to allocate a larger window. - - inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative - memLevel). msg is set to null if there is no error message. inflateInit2 - does not perform any decompression apart from reading the zlib header if - present: this will be done by inflate(). (So next_in and avail_in may be - modified, but next_out and avail_out are unchanged.) -*/ - -ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, - Bytef const *dictionary, - uInt dictLength)); -/* - Initializes the decompression dictionary from the given uncompressed byte - sequence. This function must be called immediately after a call of inflate - if this call returned Z_NEED_DICT. The dictionary chosen by the compressor - can be determined from the Adler32 value returned by this call of - inflate. The compressor and decompressor must use exactly the same - dictionary (see deflateSetDictionary). - - inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is - inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the - expected one (incorrect Adler32 value). inflateSetDictionary does not - perform any decompression: this will be done by subsequent calls of - inflate(). -*/ - -ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); -/* - Skips invalid compressed data until a full flush point (see above the - description of deflate with Z_FULL_FLUSH) can be found, or until all - available input is skipped. No output is provided. - - inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR - if no more input was provided, Z_DATA_ERROR if no flush point has been found, - or Z_STREAM_ERROR if the stream structure was inconsistent. In the success - case, the application may save the current current value of total_in which - indicates where valid compressed data was found. In the error case, the - application may repeatedly call inflateSync, providing more input each time, - until success or end of the input data. -*/ - -ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); -/* - This function is equivalent to inflateEnd followed by inflateInit, - but does not free and reallocate all the internal decompression state. - The stream will keep attributes that may have been set by inflateInit2. - - inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). -*/ - - - /* utility functions */ - -/* - The following utility functions are implemented on top of the - basic stream-oriented functions. To simplify the interface, some - default options are assumed (compression level and memory usage, - standard memory allocation functions). The source code of these - utility functions can easily be modified if you need special options. -*/ - -ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, - Bytef const *source, uLong sourceLen)); -/* - Compresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be at least 0.1% larger than - sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the - compressed buffer. - This function can be used to compress a whole file at once if the - input file is mmap'ed. - compress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer. -*/ - -ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, - Bytef const *source, uLong sourceLen, - int level)); -/* - Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least 0.1% larger than sourceLen plus - 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. - - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -*/ - -ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, - Bytef const *source, uLong sourceLen)); -/* - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be large enough to hold the - entire uncompressed data. (The size of the uncompressed data must have - been saved previously by the compressor and transmitted to the decompressor - by some mechanism outside the scope of this compression library.) - Upon exit, destLen is the actual size of the compressed buffer. - This function can be used to decompress a whole file at once if the - input file is mmap'ed. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted. -*/ - - -typedef voidp gzFile; - -ZEXTERN gzFile ZEXPORT gzopen OF((char const *path, char const *mode)); -/* - Opens a gzip (.gz) file for reading or writing. The mode parameter - is as in fopen ("rb" or "wb") but can also include a compression level - ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for - Huffman only compression as in "wb1h". (See the description - of deflateInit2 for more information about the strategy parameter.) - - gzopen can be used to read a file which is not in gzip format; in this - case gzread will directly read from the file without decompression. - - gzopen returns NULL if the file could not be opened or if there was - insufficient memory to allocate the (de)compression state; errno - can be checked to distinguish the two cases (if errno is zero, the - zlib error is Z_MEM_ERROR). */ - -ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, char const *mode)); -/* - gzdopen() associates a gzFile with the file descriptor fd. File - descriptors are obtained from calls like open, dup, creat, pipe or - fileno (in the file has been previously opened with fopen). - The mode parameter is as in gzopen. - The next call of gzclose on the returned gzFile will also close the - file descriptor fd, just like fclose(fdopen(fd), mode) closes the file - descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). - gzdopen returns NULL if there was insufficient memory to allocate - the (de)compression state. -*/ - -ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); -/* - Dynamically update the compression level or strategy. See the description - of deflateInit2 for the meaning of these parameters. - gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not - opened for writing. -*/ - -ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); -/* - Reads the given number of uncompressed bytes from the compressed file. - If the input file was not in gzip format, gzread copies the given number - of bytes into the buffer. - gzread returns the number of uncompressed bytes actually read (0 for - end of file, -1 for error). */ - -ZEXTERN int ZEXPORT gzwrite OF((gzFile file, - voidp const buf, unsigned len)); -/* - Writes the given number of uncompressed bytes into the compressed file. - gzwrite returns the number of uncompressed bytes actually written - (0 in case of error). -*/ - -ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, char const *format, ...)); -/* - Converts, formats, and writes the args to the compressed file under - control of the format string, as in fprintf. gzprintf returns the number of - uncompressed bytes actually written (0 in case of error). -*/ - -ZEXTERN int ZEXPORT gzputs OF((gzFile file, char const *s)); -/* - Writes the given null-terminated string to the compressed file, excluding - the terminating null character. - gzputs returns the number of characters written, or -1 in case of error. -*/ - -ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); -/* - Reads bytes from the compressed file until len-1 characters are read, or - a newline character is read and transferred to buf, or an end-of-file - condition is encountered. The string is then terminated with a null - character. - gzgets returns buf, or Z_NULL in case of error. -*/ - -ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); -/* - Writes c, converted to an unsigned char, into the compressed file. - gzputc returns the value that was written, or -1 in case of error. -*/ - -ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); -/* - Reads one byte from the compressed file. gzgetc returns this byte - or -1 in case of end of file or error. -*/ - -ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); -/* - Flushes all pending output into the compressed file. The parameter - flush is as in the deflate() function. The return value is the zlib - error number (see function gzerror below). gzflush returns Z_OK if - the flush parameter is Z_FINISH and all output could be flushed. - gzflush should be called only when strictly necessary because it can - degrade compression. -*/ - -ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, - z_off_t offset, int whence)); -/* - Sets the starting position for the next gzread or gzwrite on the - given compressed file. The offset represents a number of bytes in the - uncompressed data stream. The whence parameter is defined as in lseek(2); - the value SEEK_END is not supported. - If the file is opened for reading, this function is emulated but can be - extremely slow. If the file is opened for writing, only forward seeks are - supported; gzseek then compresses a sequence of zeroes up to the new - starting position. - - gzseek returns the resulting offset location as measured in bytes from - the beginning of the uncompressed stream, or -1 in case of error, in - particular if the file is opened for writing and the new starting position - would be before the current position. -*/ - -ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); -/* - Rewinds the given file. This function is supported only for reading. - - gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) -*/ - -ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); -/* - Returns the starting position for the next gzread or gzwrite on the - given compressed file. This position represents a number of bytes in the - uncompressed data stream. - - gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) -*/ - -ZEXTERN int ZEXPORT gzeof OF((gzFile file)); -/* - Returns 1 when EOF has previously been detected reading the given - input stream, otherwise zero. -*/ - -ZEXTERN int ZEXPORT gzclose OF((gzFile file)); -/* - Flushes all pending output if necessary, closes the compressed file - and deallocates all the (de)compression state. The return value is the zlib - error number (see function gzerror below). -*/ - -ZEXTERN char const *ZEXPORT gzerror OF((gzFile file, int *errnum)); -/* - Returns the error message for the last error which occurred on the - given compressed file. errnum is set to zlib error number. If an - error occurred in the file system and not in the compression library, - errnum is set to Z_ERRNO and the application may consult errno - to get the exact error code. -*/ - - /* checksum functions */ - -/* - These functions are not related to compression but are exported - anyway because they might be useful in applications using the - compression library. -*/ - -ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, Bytef const *buf, uInt len)); - -/* - Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is NULL, this function returns - the required initial value for the checksum. - An Adler-32 checksum is almost as reliable as a CRC32 but can be computed - much faster. Usage example: - - uLong adler = adler32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - adler = adler32(adler, buffer, length); - } - if (adler != original_adler) error(); -*/ - -ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, Bytef const *buf, uInt len)); -/* - Update a running crc with the bytes buf[0..len-1] and return the updated - crc. If buf is NULL, this function returns the required initial value - for the crc. Pre- and post-conditioning (one's complement) is performed - within this function so it shouldn't be done by the application. - Usage example: - - uLong crc = crc32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - crc = crc32(crc, buffer, length); - } - if (crc != original_crc) error(); -*/ - - - /* various hacks, don't look :) */ - -/* deflateInit and inflateInit are macros to allow checking the zlib version - * and the compiler's view of z_stream: - */ -ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, - char const *version, int stream_size)); -ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, - char const *version, int stream_size)); -ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, - int windowBits, int memLevel, - int strategy, char const *version, - int stream_size)); -ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, - char const *version, int stream_size)); -#define deflateInit(strm, level) \ - deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) -#define inflateInit(strm) \ - inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) -#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ - deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ - (strategy), ZLIB_VERSION, sizeof(z_stream)) -#define inflateInit2(strm, windowBits) \ - inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) - - -#if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL) - struct internal_state {int dummy;}; /* hack for buggy compilers */ -#endif - -ZEXTERN char const *ZEXPORT zError OF((int err)); -ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); -ZEXTERN uLongf const *ZEXPORT get_crc_table OF((void)); - -#ifdef __cplusplus -} -#endif - -#endif /* _ZLIB_H */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/lib/.cvsignore b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/lib/.cvsignore deleted file mode 100644 index aa6c7eb936..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/lib/.cvsignore +++ /dev/null @@ -1,36 +0,0 @@ -*.pro -*~ -Makefile.cartesian -Makefile.cfev -Makefile.cfevtest -Makefile.collapser -Makefile.common -Makefile.compatibility -Makefile.convex_decomp -Makefile.core -Makefile.corealg -Makefile.coreio -Makefile.geometry -Makefile.interf -Makefile.license -Makefile.linalg -Makefile.meshercommon -Makefile.mkprogen -Makefile.mkprospec -Makefile.newsurface -Makefile.newvolume -Makefile.octree -Makefile.pipeline -Makefile.resurfacer -Makefile.robustgeometry -Makefile.surface -Makefile.surfacerepair -Makefile.surfacewrapper -Makefile.test -Makefile.viewcommon -Makefile.voxelmesher -make.*.list* -qmake.vars -test.general.log -test.specific.log -zzzz* diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/lib/glib-2.0.lib b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/lib/glib-2.0.lib deleted file mode 100644 index a191cdc644..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/lib/glib-2.0.lib and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/lib/oncrpc.dll b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/lib/oncrpc.dll deleted file mode 100644 index c0667639b0..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/lib/oncrpc.dll and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/lib/oncrpc.lib b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/lib/oncrpc.lib deleted file mode 100644 index 18bcf6526e..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/lib/oncrpc.lib and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/qmake.conf b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/qmake.conf deleted file mode 100644 index 1d9aa15474..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/qmake.conf +++ /dev/null @@ -1,114 +0,0 @@ -# -# $Id: qmake.conf,v 1.3 2004/11/11 15:27:39 wayne Exp $ -# -# qmake configuration for win32-msvc.net -# -# Written for Microsoft C++.NET. -# - -MAKEFILE_GENERATOR = MSVC.NET -TEMPLATE = app -CONFIG += qt warn_on release incremental flat link_prl precompile_header -#DEFINES += UNICODE WIN32 -DEFINES += WIN32 _WIN32 - -exists( $(QTDIR)\.qtwinconfig ) { - include( $(QTDIR)\.qtwinconfig ) -} - -QMAKE_CC = cl -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = byacc -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -nologo -Zm200 -QMAKE_CFLAGS_WARN_ON = -W3 -QMAKE_CFLAGS_WARN_OFF = -W0 -QMAKE_CFLAGS_RELEASE = -O1 -QMAKE_CFLAGS_DEBUG = -Zi -Gm -QMAKE_CFLAGS_MT = -MD -QMAKE_CFLAGS_MT_DBG = -MDd -QMAKE_CFLAGS_MT_DLL = -MD -QMAKE_CFLAGS_MT_DLLDBG = -MDd -QMAKE_CFLAGS_YACC = -QMAKE_CFLAGS_STL_ON = -GX -QMAKE_CFLAGS_STL_OFF = -QMAKE_CFLAGS_RTTI_ON = -QMAKE_CFLAGS_RTTI_OFF = -QMAKE_CFLAGS_EXCEPTIONS_ON = -GX -QMAKE_CFLAGS_EXCEPTIONS_OFF = - -QMAKE_CXX = $$QMAKE_CC -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -GR -EHsc -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -w44100 -w44189 -w44290 -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_MT = $$QMAKE_CFLAGS_MT -QMAKE_CXXFLAGS_MT_DBG = $$QMAKE_CFLAGS_MT_DBG -QMAKE_CXXFLAGS_MT_DLL = $$QMAKE_CFLAGS_MT_DLL -QMAKE_CXXFLAGS_MT_DLLDBG= $$QMAKE_CFLAGS_MT_DLLDBG -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_STL_ON = $$QMAKE_CFLAGS_STL_ON -QMAKE_CXXFLAGS_STL_OFF = $$QMAKE_CFLAGS_STL_OFF -QMAKE_CXXFLAGS_RTTI_ON = $$QMAKE_CFLAGS_RTTI_ON -QMAKE_CXXFLAGS_RTTI_OFF = $$QMAKE_CFLAGS_RTTI_OFF -QMAKE_CXXFLAGS_EXCEPTIONS_ON = $$QMAKE_CFLAGS_EXCEPTIONS_ON -QMAKE_CXXFLAGS_EXCEPTIONS_OFF = $$QMAKE_CFLAGS_EXCEPTIONS_OFF - -QMAKE_INCDIR = -QMAKE_INCDIR_QT = $(QTDIR)\include -QMAKE_LIBDIR_QT = $(QTDIR)\lib - -QMAKE_RUN_CC = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$obj $src -QMAKE_RUN_CC_IMP = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ $< -QMAKE_RUN_CC_IMP_BATCH = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ @<< -QMAKE_RUN_CXX = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$obj $src -QMAKE_RUN_CXX_IMP = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ $< -QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ @<< - -QMAKE_LINK = link -QMAKE_LFLAGS = /NOLOGO -QMAKE_LFLAGS_RELEASE = /NODEFAULTLIB:LIBCMT /DELAYLOAD:comdlg32.dll /DELAYLOAD:oleaut32.dll /DELAYLOAD:winmm.dll /DELAYLOAD:wsock32.dll /DELAYLOAD:winspool.dll -QMAKE_LFLAGS_DEBUG = /DEBUG -QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE -QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS -QMAKE_LFLAGS_CONSOLE_DLL= /SUBSYSTEM:CONSOLE /DLL -QMAKE_LFLAGS_WINDOWS_DLL= /SUBSYSTEM:WINDOWS /DLL -QMAKE_LFLAGS_QT_DLL = /BASE:0x39D00000 - -QMAKE_LIBS = -QMAKE_LIBS_CONSOLE = -QMAKE_LIBS_WINDOWS = kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib imm32.lib winmm.lib wsock32.lib winspool.lib delayimp.lib -QMAKE_LIBS_QT = qt.lib -QMAKE_LIBS_QT_THREAD = qt-mt.lib -QMAKE_LIBS_QT_ENTRY = qtmain.lib - -QMAKE_LIBS_OPENGL = opengl32.lib glu32.lib -QMAKE_LFLAGS_OPENGL = /DELAYLOAD:opengl32.dll - -QMAKE_MOC = $(QTDIR)\bin\moc.exe -QMAKE_UIC = $(QTDIR)\bin\uic.exe -QMAKE_IDC = $(QTDIR)\bin\idc.exe - -QMAKE_IDL = midl -QMAKE_LIB = lib /NOLOGO -QMAKE_RC = rc - -QMAKE_ZIP = zip -r -9 - -QMAKE_COPY = copy -QMAKE_MOVE = move -QMAKE_DEL_FILE = del -QMAKE_DEL_DIR = rmdir -QMAKE_CHK_DIR_EXISTS = if not exist -QMAKE_MKDIR = mkdir - -VCPROJ_EXTENSION = .vcproj -VCSOLUTION_EXTENSION = .sln - -# added options for MeshKernel: -DEFINES += WINDOWS_X86 -MK_BUILDNAME = windows-x86 -MK_LIBS_STLPORT = -lstlport_vc71_static -MK_LIBS_STLPORT_DEBUG = -lstlport_vc71_stldebug_static diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/qmake.exe b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/qmake.exe deleted file mode 100644 index 28b9016bd9..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/qmake.exe and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/qplatformdefs.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/qplatformdefs.h deleted file mode 100644 index d828db88e9..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/config/windows-x86/qplatformdefs.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H - -#ifdef UNICODE -#ifndef _UNICODE -#define _UNICODE -#endif -#endif - -// Get Qt defines/settings - -#include "qglobal.h" - -#define _POSIX_ -#include -#undef _POSIX_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define Q_FS_FAT -#ifdef QT_LARGEFILE_SUPPORT -#define QT_STATBUF struct _stati64 // non-ANSI defs -#define QT_STATBUF4TSTAT struct _stati64 // non-ANSI defs -#define QT_STAT ::_stati64 -#define QT_FSTAT ::_fstati64 -#else -#define QT_STATBUF struct _stat // non-ANSI defs -#define QT_STATBUF4TSTAT struct _stat // non-ANSI defs -#define QT_STAT ::_stat -#define QT_FSTAT ::_fstat -#endif -#define QT_STAT_REG _S_IFREG -#define QT_STAT_DIR _S_IFDIR -#define QT_STAT_MASK _S_IFMT -#if defined(_S_IFLNK) -# define QT_STAT_LNK _S_IFLNK -#endif -#define QT_FILENO _fileno -#define QT_OPEN ::_open -#define QT_CLOSE ::_close -#ifdef QT_LARGEFILE_SUPPORT -#define QT_LSEEK ::_lseeki64 -#define QT_TSTAT ::_tstati64 -#else -#define QT_LSEEK ::_lseek -#define QT_TSTAT ::_tstat -#endif -#define QT_READ ::_read -#define QT_WRITE ::_write -#define QT_ACCESS ::_access -#define QT_GETCWD ::_getcwd -#define QT_CHDIR ::_chdir -#define QT_MKDIR ::_mkdir -#define QT_RMDIR ::_rmdir -#define QT_OPEN_RDONLY _O_RDONLY -#define QT_OPEN_WRONLY _O_WRONLY -#define QT_OPEN_RDWR _O_RDWR -#define QT_OPEN_CREAT _O_CREAT -#define QT_OPEN_TRUNC _O_TRUNC -#define QT_OPEN_APPEND _O_APPEND -#if defined(O_TEXT) -# define QT_OPEN_TEXT _O_TEXT -# define QT_OPEN_BINARY _O_BINARY -#endif - -#define QT_SIGNAL_ARGS int - -#define QT_VSNPRINTF ::_vsnprintf -#define QT_SNPRINTF ::_snprintf - -# define F_OK 0 -# define X_OK 1 -# define W_OK 2 -# define R_OK 4 - -typedef int mode_t; - - -#endif // QPLATFORMDEFS_H diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/data/box.2.6.0.ccm b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/data/box.2.6.0.ccm deleted file mode 100644 index 36c6b1363d..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/data/box.2.6.0.ccm and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/data/elbow.2.3.0.ccm b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/data/elbow.2.3.0.ccm deleted file mode 100644 index ad28f93247..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/data/elbow.2.3.0.ccm and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/data/heater.2.4.0.ccm b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/data/heater.2.4.0.ccm deleted file mode 100644 index d2d2d7af9f..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/data/heater.2.4.0.ccm and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/data/mrf.sff b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/data/mrf.sff deleted file mode 100644 index 5e3032e943..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/data/mrf.sff and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/data/multiphase.ccm b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/data/multiphase.ccm deleted file mode 100644 index 5f6a65c171..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/data/multiphase.ccm and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/CCMFileFormat.pdf b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/CCMFileFormat.pdf deleted file mode 100644 index b1eb5d639d..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/CCMFileFormat.pdf and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/Makefile b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/Makefile deleted file mode 100644 index d843554bf0..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -all: \ - ../libccmio/Makefile \ - ../libccmio/ccmio.c \ - ../libccmio/ccmio.h \ - ../libccmio/ccmio.pro \ - ../libccmio/ccmiocore.c \ - ../libccmio/ccmiocore.h \ - ../libccmio/ccmioprivate.c \ - ../libccmio/ccmioprivate.h \ - ../libccmio/ccmioread.c \ - ../libccmio/ccmiotypes.h \ - ../libccmio/ccmioutility.c \ - ../libccmio/ccmioutility.h \ - ../libccmio/ccmioverifymesh.c \ - ../libccmio/ccmioverifymesh.h \ - ../libccmio/ccmioversion.c \ - ../libccmio/ccmioversion.h \ - ../libccmio/vector.c \ - ../libccmio/vector.h \ - compatibility.dox \ - examples.dox \ - hierarchy.dox \ - mainpage.dox \ - errors.dox \ - groups.dox \ - intropage.dox - doxygen doxygen.conf - cp hierarchy.png html - touch all - -copy clean qmake test: force - -force: - -# -# Automatic setting of emacs local variables. -# Local Variables: -# tab-width: 2 -# End: diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/all b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/all deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/compatibility.dox b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/compatibility.dox deleted file mode 100644 index a908f50d74..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/compatibility.dox +++ /dev/null @@ -1,65 +0,0 @@ -/** \page compatpage Backwards Compatibility -As with all file formats, the CCM specification has undergone some -changes in its history.  Where possible, backwards compatibility -has been included within the library itself.  However, there have -been a few hierarchical changes which the library cannot hide from the -client.  If backwards compatibility with these files is desired, -the client will need to handle the case appropriately.  These -cases have been recorded below, along with sample code to handle -it.  The \ref readexample.cpp read example included contains -appropriate handling for all cases.
-
-

Addition of Phase Node (2.2.0)

-In version 2.2.0 it became necessary to -support different material phases, each with their own sets of -(possibly different) fields.  The Phase entity was inserted -between the FieldSet and the Field, so clients must be aware that there -may be no Phase entity under FieldSet in older files.
-
-Code:
-
-    ...
-    bool oldFile = (CCMIONextEntity(NULL, solution, kCCMIOFieldPhase, &i, &phase) != kCCMIONoErr);
-    i = 0;
-    while (oldFile ||
-           CCMIONextEntity(NULL, solution, kCCMIOFieldPhase, &i, &phase)== kCCMIONoErr)
-    {
-        if (oldFile)
-            phase = solution;
-        ... read data ... -
        oldFile = false;
-    }
-    ...
-
-

Multidimensional data stored as scalar components (2.4.0)
-

-Some clients noted that often -multidimensional data (i.e. vector data) was needed one component at a -time.  Since this can reduce the memory needed to compute -secondary quantities, an important consideration for large data, the -file format was changed to store multidimensional data as -components.  Previously all field data was read using -CCMIOReadFieldData*().  With this change only scalar data can be -read with CCMIOReadFieldData*() and all multidimensional data must be -read with CCMIOReadMultiDimensionalFieldData*().  (The extra -function was added to be consistent with prefering extra functions to -extra parameters)  However, CCMIOReadFieldData*() is still -required to read older data.
-
-Code:
-
-    ...
-    CCMIOReadField(&err, field, name, shortName, &dims, &datatype);
-    CCMIOEntitySize(&err, fieldData, &n, &max);
-    CCMIOReadMultiDimensionalFieldData(&err, field, kCCMIOVectorX, scalarID);
-    if (err == kCCMIOVersionErr)
-        data.size(n * dims);
-    else
-        data.size(n);
-    ...
-    while (CCMIONextEntity(NULL, field, kCCMIOFieldData, &j, &fieldData) == kCCMIONoErr)
-        ...
-        CCMIOReadFieldDataf(...);
-    ...
-
-*/ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/doxygen.conf b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/doxygen.conf deleted file mode 100644 index d7086f7881..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/doxygen.conf +++ /dev/null @@ -1,163 +0,0 @@ -# Doxyfile 0.1 - -#--------------------------------------------------------------------------- -# General configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = libccmio -PROJECT_NUMBER = -OUTPUT_DIRECTORY = -OUTPUT_LANGUAGE = English -EXTRACT_ALL = YES -EXTRACT_PRIVATE = NO -EXTRACT_STATIC = YES -HIDE_UNDOC_MEMBERS = YES -HIDE_UNDOC_CLASSES = YES -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ALWAYS_DETAILED_SEC = YES -FULL_PATH_NAMES = YES -STRIP_FROM_PATH = -INTERNAL_DOCS = YES -CLASS_DIAGRAMS = YES -SOURCE_BROWSER = YES -INLINE_SOURCES = NO -STRIP_CODE_COMMENTS = YES -CASE_SENSE_NAMES = YES -SHORT_NAMES = YES -HIDE_SCOPE_NAMES = YES -VERBATIM_HEADERS = YES -SHOW_INCLUDE_FILES = YES -JAVADOC_AUTOBRIEF = YES -INHERIT_DOCS = YES -INLINE_INFO = YES -SORT_MEMBER_DOCS = YES -DISTRIBUTE_GROUP_DOC = YES -TAB_SIZE = 8 -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -ALIASES = -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -OPTIMIZE_OUTPUT_FOR_C = YES -SHOW_USED_FILES = YES -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = . ../libccmio -FILE_PATTERNS = *.h *.dox -RECURSIVE = YES -EXCLUDE = -EXCLUDE_PATTERNS = -EXAMPLE_PATH = examples -EXAMPLE_PATTERNS = *.cpp -IMAGE_PATH = . -INPUT_FILTER = -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = NO -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = html -HTML_HEADER = header.html -HTML_FOOTER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = NO -GENERATE_CHI = NO -BINARY_TOC = NO -TOC_EXPAND = YES -DISABLE_INDEX = YES -ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = NO -TREEVIEW_WIDTH = 250 -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = latex -COMPACT_LATEX = NO -PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = -PDF_HYPERLINKS = NO -USE_PDFLATEX = NO -LATEX_BATCHMODE = NO -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = NO -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = NO -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to external references -#--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = -ALLEXTERNALS = NO -PERL_PATH = /usr/bin/perl -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -HAVE_DOT = NO -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -TEMPLATE_RELATIONS = YES -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -GRAPHICAL_HIERARCHY = YES -DOT_PATH = -DOTFILE_DIRS = -MAX_DOT_GRAPH_WIDTH = 1024 -MAX_DOT_GRAPH_HEIGHT = 1024 -GENERATE_LEGEND = YES -DOT_CLEANUP = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = NO -CGI_NAME = search.cgi -CGI_URL = -DOC_URL = -DOC_ABSPATH = -BIN_ABSPATH = /usr/local/bin/ -EXT_DOC_PATHS = diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/errors.dox b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/errors.dox deleted file mode 100644 index 4ecaa3c425..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/errors.dox +++ /dev/null @@ -1,62 +0,0 @@ -/** \page errorpage CCMIO Error Handling - -

-Error handling in C APIs is fairly cumbersome if you need to check for errors -frequently, as you either need to check return values (or parameters) or a -global error after each function call to ensure that the next one does not go -bad. However, most of the time you would like to call API routines if there has -been no error, otherwise skip until the end. libccmio has appropriated error -handling ideas from dataflow programming in an attempt to make error handling -less cumbersome for the API user. All functions return an error, in case it -is convenient, but most functions also take an error pointer, the value of which -will be set to the error returned. Should the value of this pointer be an -error upon entrance to the function, the function will do nothing. Occasionally -you will want to test whether an function call will succeed. In this case, -NULL, which is always interpreted as kCCMIONoErr, should be -passed to the function and the return value checked for success, otherwise an -anticipated failure would cause succeeding functions to do nothing. - -

-Dataflow error handling allows the API user to write code that opens a file, -does some reading or writing, and then closes it, without checking for errors -until the end. The API guarantees that any return parameters of the function -will be usable (i.e not cause a crash when used), unless otherwise documented, -and that, should an error occur early on, all memory allocated internally will -be properly deallocated. For instance: -

- - -    err = CCMIOOpenFile(NULL, argv[1], kCCMIORead, &root);
-    CCMIOGetState(&err, root, kDefaultState, &problem, &state);
-        ... read stuff
-    CCMIOCloseFile(&err, root);
-    if (err != kCCMIONoErr)
-        alert user of error
-
- - -

-There are several things to keep in mind when using errors: -

    -
  • Because this is a C, not C++ API, it is of paramount importance to initialize the error when it is created. Thus, an error should always be declared:
    -
                    CCMIOError err = kCCMIONoErr;
    -unless it is being assigned as a result of an API call -(e.g. CCMIOOpenFile).
  • -
  • Although kCCMIONoErr should always have a value of 0 (zero), - it is preferable to compare errors to kCCMIONoErr to avoid - confusion, since while !err is a correct test for an - error, !CCMIOOpenFile reads like it checks for the failure of - the function, but in reality returns true only if there was not an - error. Thus
    -
                    if (CCMIOOpenFile(...) != kCCMIONoErr)
    - should be the canonical test.
  • -
  • Either pass NULL for the error when looping through nodes or reset - the error afterwards, because the terminal condition is the - kCCMIONoNodeErr error:

    - -      i = 0;
    -      while (CCMIONextEntity(NULL, parentID, kCCMIOField, &i, &child) == kCCMIONoErr)
    -           ... do stuff ...
    -
  • -
-*/ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/examples.dox b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/examples.dox deleted file mode 100644 index b2e42708ac..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/examples.dox +++ /dev/null @@ -1,14 +0,0 @@ -/** \example readexample.cpp - A self-contained example that reads the mesh and post data. */ -/** \example writeexample.cpp - A self-contained example that writes a mesh and post data. */ -/** \example rewriteexample.cpp - A self-contained example that writes or overwrites a mesh and post - data. Since calling CCMIOClearProcessor() causes the low-level ADF - library on which libccmio is based to lose a certain amount of disk - space, this example shows how to overwrite a .ccm file without losing - disk space. However, the structure of the new file must exactly match - the old file: no new or deleted nodes, and the data for the nodes is - the same size. If the structure differs then the old structure will - still remain in the file, causing readers to misread the file. If the - nodes are not the same size, so disk space may still be lost. */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/examples/Make/files b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/examples/Make/files deleted file mode 100644 index 1939f02d12..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/examples/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -readexample.cpp - -EXE = $(FOAM_APPBIN)/readexample diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/examples/Make/options b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/examples/Make/options deleted file mode 100644 index 777dd995b7..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/examples/Make/options +++ /dev/null @@ -1,12 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I../../libadf \ - -I../../libccmio \ - -I../.. - -EXE_LIBS = \ - -lfiniteVolume \ - -lmeshTools \ - -ladf \ - -lccmio diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/examples/readexample.cpp b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/examples/readexample.cpp deleted file mode 100644 index a68b43ea72..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/examples/readexample.cpp +++ /dev/null @@ -1,673 +0,0 @@ -#include // For exit() -#include -#include -#include -#include - -typedef std::vector< unsigned int > UIntArray; -typedef std::map< int, std::vector< int > > FaceMap; - -// If you are unfamiliar with the Standard Template Library (STL), please read. -// vector: A dynamic array. vector is an array of ints. Suppose -// we have vector iarr; -// iarr.push_back( ... ); adds an item to the end of the -// array, resizing if necessary. -// iarr.size(); Returns the number of items. -// iarr[10]; The 11th item in the array. -// No bounds checking is performed. -// iarr.resize(10); Makes the array 10 items long. -// map: An associative container. map< int, float > is an sorted -// based on an integer key and contains a value float. -// Suppose we have map m; -// m[18] = 3.141592; Associates Pi with the key 18. -// Technically m[18] returns a reference -// to the value associated with 18, -// which is then assigned to. -// (A reference is like a pointer that -// cannot change where it is pointed to -// and is treated syntactically like a -// normal variable). -// iterators: The way to increment through the container. -// container.begin() Returns an iterator to the first item -// container.end() Returns an iterator just past the end -// *iter The item being iterated to. - -enum DataType { kScalar, kVector, kVertex, kCell, kInternalFace, kBoundaryFace, - kBoundaryData, kBoundaryFaceData, kCellType }; - -using namespace std; - -static int const kNValues = 10; // Number of values of each element to print -static char const kDefaultState[] = "default"; -static char const kUnitsName[] = "Units"; -static int const kVertOffset = 2; -static int const kCellInc = 4; - -static void ReadMesh( CCMIOError &err, CCMIOID &vertices, CCMIOID &topology ); -static void ReadVertices( CCMIOError &err, CCMIOID &vertices, - char const *counter, int offset = 0 ); -static void ReadSolverInfo( CCMIOError &err, CCMIOID &solution); -static void ReadPost( CCMIOError &err, CCMIOID &solution ); -static void ReadScalar( CCMIOError &err, CCMIOID field, vector &mapData, - vector &data, bool readingVector = false ); -static void ReadSets( CCMIOError &err, CCMIOID &problem ); -static void CheckError( CCMIOError const &err, char const *str ); -static void PrintData( int n, int id, DataType type, void *data, - void *data2 = NULL ); - -int main( int argc, char *argv[]) -{ - bool hasSolution = true; - int i = 0; - CCMIOID root, state, processor, vertices, topology, solution, problem, next; - CCMIOError err; - - // Open the file. Because we did not initialize 'err' we need to pass - // in NULL (which always means kCCMIONoErr) and then assign the return - // value to 'err'.). - err = CCMIOOpenFile(NULL, argv[1], kCCMIORead, &root); - - // We are going to assume that we have a state with a known name. - // We could instead use CCMIONextEntity() to walk through all the states in - // the file and present the list to the user for selection. - CCMIOGetState(&err, root, kDefaultState, &problem, &state); - if (err != kCCMIONoErr) - { - cout << "No state named '" << kDefaultState << "'" << endl; - return(0); - } - - unsigned int size; - CCMIOEntityDescription(&err, state, &size, NULL); - char *desc = new char[size + 1]; - CCMIOEntityDescription(&err, state, NULL, desc); - cout << "Reading state '" << kDefaultState << "' (" << desc << ")" << endl; - delete [] desc; - - // Find the first processor (i has previously been initialized to 0) and - // read the mesh and solution information. - CCMIONextEntity(&err, state, kCCMIOProcessor, &i, &processor); - CCMIOReadProcessor(&err, processor, &vertices, &topology, NULL, &solution); - - if (err != kCCMIONoErr) - { - // Maybe no solution; try again - err = kCCMIONoErr; - CCMIOReadProcessor(&err, processor, &vertices, &topology, NULL, NULL); - if (err != kCCMIONoErr) - { - cout << "Could not read the file." << endl; - return(0); - } - hasSolution = false; - } - - // Print out the problem description (just cell types, and model constants) - i = 0; - if (CCMIOIsValidEntity(problem)) // if we have a problem description... - { - // ... walk through each cell type and print it... - while (CCMIONextEntity(NULL, problem, kCCMIOCellType, &i, &next) - == kCCMIONoErr) - { - char *name; - int size, cellType; - - // ... if it has a material type. (Note that we do not pass in - // an array to get the name because we do not know how long the - // string is yet. Many parameters to CCMIO functions that return - // data can be NULL if that data is not needed.) - if (CCMIOReadOptstr(NULL, next, "MaterialType", &size, NULL) - == kCCMIONoErr) - { - name = new char[size + 1]; - CCMIOReadOptstr(&err, next, "MaterialType", &size, name); - CCMIOGetEntityIndex(&err, next, &cellType); - PrintData(i, cellType, kCellType, name); - delete [] name; - } - } - - float value; - CCMIOID constants; - - // Read some constants of particular interest, fall back to defaults - // if they don't exist (or at least, that is what we would do if we - // actually used them). If you want to iterate over all the constants - // instead, you will need to use CCMIOGetEntityNode() and use - // CCMIOGetNextChild(), and CCMIOReadData() in the Core API. - if (CCMIOGetEntity(NULL, problem, kCCMIOModelConstants, 0, &constants) - == kCCMIONoErr) - { - if (CCMIOReadOptf(NULL, constants, "Gravity", &value) == kCCMIONoErr) - cout << "Gravity is " << value << " m/s^2" << endl; - else - cout << "Gravity is unspecified" << endl; - - if (CCMIOReadOptf(NULL, constants, "Hubble constant", &value) == kCCMIONoErr) - cout << "Hubble constant is " << value << endl; - else - cout << "Hubble constant is unspecified" << endl; - } - - // Read in the prostar sets. (This is probably not necessary for - // most applications, but included to show proper parsing.) - ReadSets(err, problem); - } - ReadMesh(err, vertices, topology); - if (hasSolution) - { - ReadSolverInfo(err, solution); - ReadPost(err, solution); - } - else - cout << "No post data." << endl; - - // Read Lagrangian data - vector ids; - CCMIOID lagrangian; - i = 0; - while (CCMIONextEntity(&err, processor, kCCMIOLagrangianData, &i, - &lagrangian) == kCCMIONoErr) - { - CCMIOID solutionID, positionsID; - CCMIOReadLagrangianData(&err, lagrangian, &positionsID, &solutionID); - - CCMIOEntityDescription(&err, lagrangian, &size, NULL); - char *label = new char[size + 1]; - CCMIOEntityDescription(&err, lagrangian, NULL, label); - cout << "Lagrangian data '" << label << "'" << endl; - delete [] label; - - ReadVertices(err, positionsID, "positions"); - ReadPost(err, solutionID); - ids.push_back(positionsID); - ids.push_back(solutionID); - } - - for (vector::iterator it = ids.begin(); it != ids.end(); ++it) - CCMIOCloseFile(&err, *it); - - CCMIOCloseFile(&err, vertices); - CCMIOCloseFile(&err, topology); - CCMIOCloseFile(&err, solution); - CCMIOCloseFile(&err, root); -} - -void ReadMesh( CCMIOError &err, CCMIOID &vertices, CCMIOID &topology ) -{ - unsigned int i, j, nCells, nFaces, size; - CCMIOID mapID, id; - vector mapData, faces, cells, faceCells; - vector verts; - - ReadVertices(err, vertices, "vertices", kVertOffset); - - // Read the cells. Store cell IDs so that we know what cells are in - // this post data. - CCMIOGetEntity(&err, topology, kCCMIOCells, 0, &id); - CCMIOEntitySize(&err, id, &nCells, NULL); - cells.resize(nCells); - mapData.resize(nCells); - for (unsigned int k = 0; k < nCells; k += kCellInc) - { - CCMIOReadCells(&err, id, &mapID, &cells[k], k, k + kCellInc); - CCMIOReadMap(&err, mapID, &mapData[k], k, k + kCellInc); - } - - cout << "\t" << nCells << " cells" << endl; - for (i = 0; i < nCells && err == kCCMIONoErr; ++i) - PrintData(i, mapData[i], kCell, &cells[i]); - CheckError(err, "Error reading cells"); - - // Read the internal faces. - CCMIOGetEntity(&err, topology, kCCMIOInternalFaces, 0, &id); - CCMIOEntitySize(&err, id, &nFaces, NULL); - mapData.resize(nFaces); - faceCells.resize(2 * nFaces); - CCMIOReadFaces(&err, id, kCCMIOInternalFaces, NULL, &size, NULL, - kCCMIOStart, kCCMIOEnd); - faces.resize(size); - CCMIOReadFaces(&err, id, kCCMIOInternalFaces, &mapID, NULL, &faces[0], - kCCMIOStart, kCCMIOEnd); - CCMIOReadFaceCells(&err, id, kCCMIOInternalFaces, &faceCells[0], - kCCMIOStart, kCCMIOEnd); - CCMIOReadMap(&err, mapID, &mapData[0], kCCMIOStart, kCCMIOEnd); - - cout << "\t" << nFaces << " faces" << endl; - unsigned int pos = 0; - i = 0; - while (pos < faces.size()) - { - PrintData(i, mapData[i], kInternalFace, &faces[pos], &faceCells[2 * i]); - pos += faces[pos] + 1; - i++; - } - CheckError(err, "Error reading internal faces"); - - // Read the boundary faces. - int index = 0; - while (CCMIONextEntity(NULL, topology, kCCMIOBoundaryFaces, &index, &id) - == kCCMIONoErr) - { - int boundaryVal; - vector prostarIDs; - - CCMIOEntitySize(&err, id, &nFaces, NULL); - mapData.resize(nFaces); - faceCells.resize(nFaces); - CCMIOReadFaces(&err, id, kCCMIOBoundaryFaces, NULL, &size, NULL, - kCCMIOStart, kCCMIOEnd); - faces.resize(size); - CCMIOReadFaces(&err, id, kCCMIOBoundaryFaces, &mapID, NULL, &faces[0], - kCCMIOStart, kCCMIOEnd); - CCMIOReadFaceCells(&err, id, kCCMIOBoundaryFaces, &faceCells[0], - kCCMIOStart, kCCMIOEnd); - CCMIOReadMap(&err, mapID, &mapData[0], kCCMIOStart, kCCMIOEnd); - - // If the optional ProstarFaceId is there, read it - if (CCMIOReadOpt1i(NULL, id, "ProstarFaceId", NULL, - kCCMIOStart, kCCMIOEnd) == kCCMIONoErr) - { - prostarIDs.resize(nFaces); - CCMIOReadOpt1i(NULL, id, "ProstarFaceId", &prostarIDs[0], - kCCMIOStart, kCCMIOEnd); - } - - CCMIOGetEntityIndex(&err, id, &boundaryVal); - cout << "\t" << nFaces << " boundary faces (boundary " << boundaryVal - << ")" << endl; - unsigned int pos = 0; - j = 0; - while (pos < faces.size()) - { - PrintData(j, mapData[j], kBoundaryFace, &faces[pos], - &faceCells[j]); - j++; - pos += faces[pos] + 1; - } - CheckError(err, "Error reading boundary faces"); - } -} - -void ReadVertices( CCMIOError &err, CCMIOID &vertices, char const *counter, - int offset ) -{ - int dims = 1; - unsigned int i, nVertices, size; - float scale; - int mapData[kNValues] = { 0 }; - float verts[3 * kNValues] = { 0 }; - CCMIOID mapID; - - // Read the vertices. This involves reading both the vertex data and - // the map, which maps the index into the data array with the ID number. - // As we process the vertices we need to be sure to scale them by the - // appropriate scaling factor. The offset is just to show you can read - // any chunk. Normally this would be in a for loop. - CCMIOEntitySize(&err, vertices, &nVertices, NULL); - CCMIOReadVerticesf(&err, vertices, &dims, &scale, &mapID, verts, - offset, offset + kNValues); - CCMIOReadMap(&err, mapID, mapData, offset, offset + kNValues); - - CCMIOEntityDescription(&err, vertices, &size, NULL); - char *label = new char[size + 1]; - CCMIOEntityDescription(&err, vertices, NULL, label); - cout << "label: '" << label << "'" << endl; - delete [] label; - - cout << "\t" << nVertices << " " << counter << endl; - if (nVertices > (unsigned int)kNValues) - nVertices = kNValues; - for (i = 0; i < nVertices && err == kCCMIONoErr; ++i) - { - verts[dims * i ] *= scale; - verts[dims * i + 1] *= scale; - verts[dims * i + 2] *= scale; // This example assumes three - // dimensional vertices. - PrintData(i, mapData[i], kVertex, &verts[dims * i]); - } - cout << "\t\t..." << endl; - CheckError(err, "Error reading vertices"); -} - -void ReadSolverInfo( CCMIOError &err, CCMIOID &solution) -{ - char solver[kCCMIOMaxStringLength+1], timeUnits[kCCMIOMaxStringLength+1]; - int iterations; - float time, angle; - CCMIOID restart; - - if (CCMIOGetEntity(NULL, solution, kCCMIORestart, 0, &restart)!=kCCMIONoErr) - { - cout << "(No solver information)" << endl; - return; - } - - CCMIOReadRestartInfo(&err, restart, solver, &iterations, &time, timeUnits, - &angle); - cout << "The following post data is the result of iteration " - << iterations << " (time: " << time << " " << timeUnits - << ")" << endl; - cout << "of solver '" << solver << "':" << endl; - - // You might want to read more solver data here, in which case, do - // CCMIOGetEntity(&err, restart, kCCMIORestartData, 0, &restartData); - // and proceed to read the information. Do likewise if you want to read - // the reference data. -} - -void ReadPost( CCMIOError &err, CCMIOID &solution ) -{ - bool oldFile = false; - char name[kCCMIOMaxStringLength + 1]; - int h = 0, i = 0, dimSizes[] = { 0, 1, 3, 9 }; - CCMIOID field, phase; - CCMIODimensionality dims; - vector mapData; - vector data; - - oldFile = (CCMIONextEntity(NULL, solution, kCCMIOFieldPhase, &h, &phase) - != kCCMIONoErr); - h = 0; - while (oldFile || - CCMIONextEntity(NULL, solution, kCCMIOFieldPhase, &h, &phase) - == kCCMIONoErr) - { - if (oldFile) - phase = solution; - else - { - int phaseNum = 0; - CCMIOGetEntityIndex(NULL, phase, &phaseNum); - cout << "Phase " << phaseNum << endl; - } - // Walk through each field in this field set (i.e. the post data) - // and print out each one. - while (CCMIONextEntity(NULL, phase, kCCMIOField, &i, &field) - == kCCMIONoErr) - { - // Read the information about the field so that we know how to - // process this field. - char shortName[kCCMIOProstarShortNameLength+1], *units = NULL; - int usize; - CCMIODataType datatype; - CCMIOReadField(&err, field, name, shortName, &dims, &datatype); - if (CCMIOReadOptstr(NULL, field, kUnitsName, &usize, NULL) - == kCCMIONoErr) - { - units = new char[usize + 1]; - CCMIOReadOptstr(&err, field, kUnitsName, NULL, units); - } - cout << "\tPost field '" << name << "' (" << shortName << "):\t("; - if (dims == 1) // datatype is not meaningful for vectors/tensors - { - if (datatype == kCCMIOFloat32) - cout << "Float32"; - else if (datatype == kCCMIOFloat64) - cout << "Float64"; - else if (datatype == kCCMIOInt32) - cout << "Int32"; - else - cout << "Invalid datatype"; - } - cout << ")\tUnits: " << ((units) ? units : "") << endl; - delete [] units; - - switch (dims) - { - case kCCMIOScalar: - { - ReadScalar(err, field, mapData, data); - for (unsigned int k = 0; k < data.size(); ++k) - PrintData(k, mapData[i], kScalar, &data[k]); - } - break; - case kCCMIOVector: - { - vector u, v, w; - CCMIOID scalar; - CCMIOReadMultiDimensionalFieldData(&err, field, - kCCMIOVectorX, &scalar); - if (err == kCCMIOVersionErr) - { - // If we are reading an older version of the file, - // where vectors are stored as vectors, not components, - // we need to call CCMIOReadFieldData*(), which is - // all that ReadScalar() does. - err = kCCMIONoErr; - ReadScalar(err, field, mapData, data, true); - unsigned int const size = data.size() / dimSizes[dims]; - for (unsigned int k = 0; k < size; ++k) - PrintData(k, mapData[i], kVector, - &data[dimSizes[dims] * k]); - } - else - { - ReadScalar(err, scalar, mapData, u); - CCMIOReadMultiDimensionalFieldData(&err, field, - kCCMIOVectorY, - &scalar); - ReadScalar(err, scalar, mapData, v); - CCMIOReadMultiDimensionalFieldData(&err, field, - kCCMIOVectorZ, - &scalar); - ReadScalar(err, scalar, mapData, w); - data.resize(3 * u.size()); - for (unsigned int k = 0; k < u.size(); ++k) - { - data[3 * k ] = u[k]; - data[3 * k + 1] = v[k]; - data[3 * k + 2] = w[k]; - } - for (unsigned int k = 0; k < u.size(); ++k) - PrintData(k, mapData[i], kVector, - &data[dimSizes[dims] * k]); - } - } - break; - case kCCMIOTensor: - cout << "Tensor data not supported. Ignoring field " - << name << "." << endl; - continue; - } - CheckError(err, "Error reading post data"); - } - oldFile = false; - } -} - -void ReadScalar( CCMIOError &err, CCMIOID field, - vector &mapData, vector &data, - bool readingVector /* = false */) -{ - CCMIOSize n; - CCMIOIndex max; - int j = 0; - CCMIOID fieldData, mapID; - CCMIODataLocation type; - - // Read each piece of field data - while (CCMIONextEntity(NULL, field, kCCMIOFieldData, &j, &fieldData) - == kCCMIONoErr) - { - // Figure out how big this data is so we can read it. If we were - // storing this information permanently we might use a sparse - // array, in which case we would need to find the maximum ID and - // make the array that size. - CCMIOEntitySize(&err, fieldData, &n, &max); - mapData.resize(n); - CCMIOReadFieldDataf(&err, fieldData, &mapID, &type, NULL, - kCCMIOStart, kCCMIOEnd); - CCMIOReadMap(&err, mapID, &mapData[0], kCCMIOStart, kCCMIOEnd); - - // We are only going to process cell data. Vertex data would - // be processed similarly. If your appliation has only one value - // for boundary data, you would separate the face data into - // each boundary and combine it together. If your application - // stores boundary data on each face you could read it in using - // similar procedures for the cell and vertex data. Note that - // the file may not contain all types of data. - if (type == kCCMIOCell) - { - if (readingVector) - data.resize(3 * n); - else - data.resize(n); - // If we want double precision we should use - // CCMIOReadFieldDatad(). - CCMIOReadFieldDataf(&err, fieldData, &mapID, NULL, - &data[0], kCCMIOStart, kCCMIOEnd); - } - - CheckError(err, "Error reading post data"); - } -} - -void ReadSets( CCMIOError &err, CCMIOID &problem ) -{ - int nChars; - - if (CCMIOReadOptstr(NULL, problem, "MonitoringSets", &nChars, NULL) == kCCMIONoErr) - { - char *setStr = new char[nChars + 1]; - char setNames[][16] = { "CellSet", "VertexSet", "BoundarySet", - "BlockSet", "SplineSet", "CoupleSet" }; - int i = 0, j, len, size; - unsigned int flags; - string name; - CCMIOID setID; - - cout << "Monitoring prostar sets:" << endl; - - // See the CCM specification for official documentation of this node. - // The format is " string string ..." - // The size of the string is one (binary) character. - CCMIOReadOptstr(&err, problem, "MonitoringSets", NULL, setStr); - while (i < nChars) - { - j = 0; - len = setStr[i++]; // First character is the length - name.clear(); - for (j = 0; j < len; ++j) // Then the string (no C-style \0) - name.push_back(setStr[i++]); - CCMIOGetProstarSet(&err, problem, name.c_str(), &size, NULL, - NULL, NULL); - char *longName = new char[size + 1]; - CCMIOGetProstarSet(&err, problem, name.c_str(), NULL, longName, - &flags, &setID); - cout << "\t" << name << " (" << longName << "):" << endl; - delete [] longName; - - // Read each set that is available and print it out. - // There is no need to loop through the nodes if you know which - // set you want; just check 'flags' to see if the node is there - // (or just access the node and check for an error). - int n = 0; - for (unsigned int s = 1; s <= kCCMIOCoupleSet; s = s << 1) - { - if (flags & s) - { - int *theSet; - unsigned int size; - CCMIOGetOptInfo(&err, setID, setNames[n], NULL, - &size, NULL, NULL); - theSet = new int[size]; - CCMIOReadOpt1i(&err, setID, setNames[n], theSet, - kCCMIOStart, kCCMIOEnd); - - // Print out the set - cout << "\t\t" << setNames[n] << ": "; - for (unsigned int idx = 0; idx < size; ++idx) - cout << theSet[idx] << " "; - cout << endl; - delete [] theSet; - } - n++; - } - } - - delete [] setStr; - } - else - cout << "No prostar sets selected for monitoring" << endl; - CheckError(err, "Error reading prostar sets"); -} -//--------------------------- Helper functions -------------------------------- -void CheckError( CCMIOError const &err, char const *str ) -{ - if (err == kCCMIONoErr) - return; - - cout << str << " (error " << err << ")" << endl; - exit(1); -} - -void PrintData( int n, int id, DataType type, void *data, void *data2 /*=NULL*/ ) -{ - if (n > kNValues) - return; - if (n == kNValues) - { - cout << "\t\t..." << endl; - return; - } - - switch (type) - { - case kScalar: - cout << "\t\t" << *(float *)data << endl; - break; - case kVector: - cout << "\t\t(" << ((float *)data)[0] << ", " - << ((float *)data)[1] << ", " << ((float *)data)[2] << ")" - << endl; - break; - case kVertex: - cout << "\t\t" << "Vertex " << id << ": (" - << ((float *)data)[0] << ", " - << ((float *)data)[1] << ", " - << ((float *)data)[2] << ")" << endl; - break; - case kCell: - cout << "\t\t" << "Cell " << id << ": type " << *(int *)data - << endl; - break; - case kInternalFace: - { - int nVerts = *(int *)data; - cout << "\t\t" << "Face " << id << ": \tCells: " - << ((int *)data2)[0] << ", " << ((int *)data2)[1] - << "\tVertices: "; - for (int i = 0; i < nVerts; ++i) - cout << *(((int *)data) + 1 + i) << " "; - cout << endl; - } - break; - case kBoundaryFace: - { - int nVerts = *(int *)data; - cout << "\t\t" << "Face " << id << ": \tCell: " - << *(int *)data2 << "\tVertices: "; - for (int i = 0; i < nVerts; ++i) - cout << *(((int *)data) + 1 + i) << " "; - cout << endl; - } - break; - case kBoundaryData: - cout << "\t\tBoundary " << *(int *)data << " priority " - << *(int *)data2 << endl; - break; - case kBoundaryFaceData: - { - cout << "\t\tBoundary data [ "; - for (int i = 0; i < *(int *)data2; ++i) - cout << ((float *)data)[i] << " "; - cout << "]" << endl; - } - break; - case kCellType: - cout << "Cell type " << id << ": " << (char *)data << endl; - break; - } -} diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/examples/rewriteexample.cpp b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/examples/rewriteexample.cpp deleted file mode 100644 index eb31329126..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/examples/rewriteexample.cpp +++ /dev/null @@ -1,564 +0,0 @@ -#include "ccmio.h" -#include "ccmioutility.h" -#include -#include -#include // for min() - -// If you are unfamiliar with the Standard Template Library (STL), please read. -// vector: A dynamic array. vector is an array of ints. Suppose -// we have vector iarr; -// iarr.push_back( ... ); adds an item to the end of the -// array, resizing if necessary. -// iarr.size(); Returns the number of items. -// iarr[10]; The 11th item in the array. -// No bounds checking is performed. -// iarr.resize(10); Makes the array 10 items long. - -using namespace std; - -struct Face { - int nVerts; - int vertices[4]; - int cells[2]; -}; -static int const nCells = 8; -int cells[] = { 1, 1, 1, 2, 1, 1, 1, 1 }; -static int const nInternalFaces = 12; -Face internalFaces[] = { { 4, {2, 5, 14, 11}, {2, 1} }, - { 4, {4, 5, 14, 13}, {1, 3} }, - { 4, {5, 6, 15, 14}, {2, 4} }, - { 4, {5, 8, 17, 14}, {4, 3} }, - { 4, {10, 11, 14, 13}, {5, 1} }, - { 4, {11, 12, 15, 14}, {6, 2} }, - { 4, {11, 14, 23, 20}, {6, 5} }, - { 4, {13, 14, 17, 16}, {7, 3} }, - { 4, {13, 14, 23, 22}, {5, 7} }, - { 4, {14, 15, 18, 17}, {8, 4} }, - { 4, {14, 15, 24, 23}, {6, 8} }, - { 4, {14, 17, 26, 23}, {8, 7} } }; - -static int const nBoundaryFaces = 24; -Face boundaryFaces[] = { { 4, {1, 2, 5, 4}, {1, 0} }, - { 4, {1, 10, 11, 2}, {1, 0} }, - { 4, {1, 4, 13, 10}, {1, 0} }, - { 4, {2, 3, 6, 5}, {2, 0} }, - { 4, {2, 11, 12, 3}, {2, 0} }, - { 4, {3, 12, 15, 6}, {2, 0} }, - { 4, {4, 5, 8, 7}, {3, 0} }, - { 4, {4, 7, 16, 13}, {3, 0} }, - { 4, {5, 6, 9, 8}, {4, 0} }, - { 4, {6, 15, 18, 9}, {4, 0} }, - { 4, {7, 8, 17, 16}, {3, 0} }, - { 4, {8, 9, 18, 17}, {4, 0} }, - { 4, {10, 19, 20, 11}, {5, 0} }, - { 4, {10, 13, 22, 19}, {5, 0} }, - { 4, {11, 20, 21, 12}, {6, 0} }, - { 4, {12, 21, 24, 15}, {6, 0} }, - { 4, {13, 16, 25, 22}, {7, 0} }, - { 4, {15, 24, 27, 18}, {8, 0} }, - { 4, {16, 17, 26, 25}, {7, 0} }, - { 4, {17, 18, 27, 26}, {8, 0} }, - { 4, {19, 22, 23, 20}, {5, 0} }, - { 4, {20, 23, 24, 21}, {6, 0} }, - { 4, {22, 25, 26, 23}, {7, 0} }, - { 4, {23, 26, 27, 24}, {8, 0} } }; -int nVertices = 27; -float vertices[] = { 0, 0, 0, 0, 0.5, 0, 0, 1, 0, 0.5, 0, 0, 0.5, 0.5, 0, 0.5, 1, 0, 1, 0, 0, 1, 0.5, 0, 1, 1, 0, 0, 0, 0.5, 0, 0.5, 0.5, 0, 1, 0.5, 0.5, 0, 0.5, 0.5, 0.5, 0.5, 0.5, 1, 0.5, 1, 0, 0.5, 1, 0.5, 0.5, 1, 1, 0.5, 0, 0, 1, 0, 0.5, 1, 0, 1, 1, 0.5, 0, 1, 0.5, 0.5, 1, 0.5, 1, 1, 1, 0, 1, 1, 0.5, 1, 1, 1, 1 }; -int mapData[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 }; - -float postData[] = { 100.0, 100.0, 100.0, 200.0, 100.0, 100.0, 100.0, 100.0 }; - -static int nDroplets = 8; -float positions[] = { 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, - 1, 1, 0, 1, 1, 1 }; -int types[] = { 1, 1, 2, 1, 2, 1, 2, 2 }; - -static char const kStateName[] = "default"; -static char const kDataName[] = "Temperature"; -static char const kShortDataName[] = "Temp"; -static char const kUnitsName[] = "Units"; -static int const kInc = 10; - -bool HasSameDescription(CCMIOID entity, const char *desc); -CCMIOError GetOrCreateEntity(CCMIOError *err, CCMIOID parent, CCMIOEntity which, - const char *description, CCMIOID *id); -CCMIOError GetOrCreateIndexedEntity(CCMIOError *err, CCMIOID parent, - CCMIOEntity which, int idx, - const char *description, CCMIOID *id); -CCMIOError GetOrCreateField(CCMIOError *err, CCMIOID phase, const char *name, - const char *description, - CCMIODimensionality dim, CCMIOID *field); -CCMIOError WriteMonolithicFieldData(CCMIOError *err, CCMIOID field, - CCMIOID mapID, CCMIODataType type, - void *postData, void *constData); -CCMIOError WriteLagrangianPositions(CCMIOError *err, CCMIOID processorID, - CCMIOID *lagrangian, - CCMIOID *verticesID, CCMIOID *solutionID); - -int main( int argc, char *argv[] ) -{ - int i; - CCMIOID stateID, processorID, rootID, verticesID, topologyID, solutionID; - CCMIOID mapID, problem; - CCMIOID id, cellMapID; - CCMIOError error = kCCMIONoErr, *err = &error; - - if (argc < 2) - { - cout << "Usage: " << argv[0] << " outputFile" << endl; - return(0); - } - - CCMIOOpenFile(err, argv[1], kCCMIOWrite, &rootID); - - // Create a new state (or re-use an existing one). - if (CCMIOGetState(err, rootID, kStateName, &problem, &stateID) == kCCMIONoNodeErr) - { - *err = kCCMIONoErr; - CCMIONewState(err, rootID, kStateName, NULL, NULL, &stateID); - } - - // Attempt to find the first processor. If we find it, re-use it, otherwise - // create one. Multiprocessor meshes will obviously need to do this - // multiple times... - // Note that we pass NULL for the error because it is not an error for - // us if there is not a processor; it just means that we need to create - // one. If we pass in 'err' then all the rest of the functions will - // needlessly fail because we encountered an expected error. - i = 0; - while (CCMIONextEntity(NULL, stateID, kCCMIOProcessor, &i, &processorID) - == kCCMIONoErr) - if (HasSameDescription(processorID, "CPU 1")) - break; - - if (CCMIOIsValidEntity(processorID)) // Won't be if we didn't find one - CCMIOReadProcessor(err, processorID, &verticesID, &topologyID, NULL, - &solutionID); - else - { - CCMIONewEntity(err, stateID, kCCMIOProcessor, "CPU 1", &processorID); - // Initialize the processor's sub-nodes to be invalid; if they - // are unitialized, checks below may fail. - CCMIOInvalidateEntity(&topologyID); - CCMIOInvalidateEntity(&verticesID); - CCMIOInvalidateEntity(&solutionID); - - CCMIONewEntity(err, rootID, kCCMIOTopology, "Topology", &topologyID); - } - - // Write the vertices. First we will need to get (or create) the mapping - // from the index in the data array to the vertex ID. Then we can write - // the actual data. - if (CCMIOIsValidEntity(verticesID)) - CCMIOReadVerticesf(err, verticesID, NULL, NULL, &mapID, NULL, 0, 0); - else - { - CCMIONewEntity(err, rootID, kCCMIOMap, "Vertex map", &mapID); - CCMIONewEntity(err, rootID, kCCMIOVertices, "Vertices", &verticesID); - } - - CCMIOWriteMap(err, mapID, nVertices, mapData[nVertices], mapData, - kCCMIOStart, kCCMIOEnd); - // Write the vertices piecemeal by way of illustration - for (i = 0; i < nVertices; i += kInc) - CCMIOWriteVerticesf(err, verticesID, 3, 1.0, mapID, vertices + 3 * i, - i, i + kInc); - - // Write the cells - if (CCMIOGetEntity(err, topologyID, kCCMIOCells, 0, &id) == kCCMIONoNodeErr) - { - *err = kCCMIONoErr; - CCMIONewEntity(err, topologyID, kCCMIOCells, "Cells", &id); - CCMIONewEntity(err, rootID, kCCMIOMap, "Cell map", &cellMapID); - } - else - CCMIOReadCells(err, id, &cellMapID, NULL, 0, 0); - - CCMIOWriteMap(err, cellMapID, nCells, mapData[nVertices], mapData, - kCCMIOStart, kCCMIOEnd); - for (i = 0; i < nCells; i += 3) - CCMIOWriteCells(err, id, cellMapID, cells + i, i, i + 3); - - // Write the faces. There are two kinds of faces, internal faces and - // boundary faces. The procedure is the same for each except that - // internal faces' cell array is a two dimensional array because internal - // faces have a cell on both sides. Boundary faces, obviously, only - // have one cell. - vector v, c; - - if (CCMIOGetEntity(err, topologyID, kCCMIOInternalFaces, 0, &id) == kCCMIONoNodeErr) - { - *err = kCCMIONoErr; - CCMIONewEntity(err, rootID, kCCMIOMap, NULL, &mapID); - CCMIONewEntity(err, topologyID, kCCMIOInternalFaces, "Internal faces", - &id); - } - else - CCMIOReadFaces(err, id, kCCMIOInternalFaces, &mapID, NULL, NULL, 0, 0); - - CCMIOWriteMap(err, mapID, nInternalFaces, - mapData[nBoundaryFaces + nInternalFaces], - &mapData[nBoundaryFaces], kCCMIOStart, kCCMIOEnd); - for (int f = 0; f < nInternalFaces; ++f) - { - v.push_back(internalFaces[f].nVerts); - for (int i = 0; i < internalFaces[f].nVerts; ++i) - v.push_back(internalFaces[f].vertices[i]); - c.push_back(internalFaces[f].cells[0]); - c.push_back(internalFaces[f].cells[1]); // Our other cell - } - CCMIOWriteFaces(err, id, kCCMIOInternalFaces, mapID, v.size(), &v[0], - kCCMIOStart, kCCMIOEnd); - CCMIOWriteFaceCells(err, id, kCCMIOInternalFaces, mapID, &c[0], kCCMIOStart, - kCCMIOEnd); - - // Write the boundary faces - if (CCMIOGetEntity(err, topologyID, kCCMIOBoundaryFaces, 0, &id) == kCCMIONoNodeErr) - { - *err = kCCMIONoErr; - CCMIONewEntity(err, rootID, kCCMIOMap, NULL, &mapID); - CCMIONewIndexedEntity(err, topologyID, kCCMIOBoundaryFaces, 0, - "Boundary faces", &id); - } - else - CCMIOReadFaces(err, id, kCCMIOBoundaryFaces, &mapID, NULL, NULL, 0, 0); - - v.clear(); - c.clear(); - CCMIOWriteMap(err, mapID, nBoundaryFaces, mapData[nBoundaryFaces], mapData, - kCCMIOStart, kCCMIOEnd); - for (int f = 0; f < nBoundaryFaces; ++f) - { - v.push_back(boundaryFaces[f].nVerts); - for (int i = 0; i < boundaryFaces[f].nVerts; ++i) - v.push_back(boundaryFaces[f].vertices[i]); - c.push_back(boundaryFaces[f].cells[0]); - // Boundary faces only have one cell, so cells[1] is unused. - } - CCMIOWriteFaces(err, id, kCCMIOBoundaryFaces, mapID, v.size(), &v[0], - kCCMIOStart, kCCMIOEnd); - CCMIOWriteFaceCells(err, id, kCCMIOBoundaryFaces, mapID, &c[0], kCCMIOStart, - kCCMIOEnd); - - // Write any prostar sets that we are using (this is optional) - int set1[] = { 1, 2, 3, 4 }, set2[] = {2, 4, 6, 8}; - int vset[] = { 2, 3, 5, 7, 11, 13,15, 17, 19, 23}; - char shortName[] = "half"; - char longName[] = "Supercalifragilisticexpialidocious"; - char truncatedName[] = "SetWithAReallyLongNameThatWillGetTruncated"; - vector setNames; - CCMIOID setID; - if (CCMIOGetProstarSet(err, id, shortName, NULL, NULL, NULL, &setID) == kCCMIONoNodeErr) - { - *err = kCCMIONoErr; - CCMIONewProstarSet(err, id, shortName, shortName, &setID); - } - CCMIOWriteOpt1i(err, setID, "CellSet", 4, set1, kCCMIOStart, kCCMIOEnd); - CCMIOWriteOpt1i(err, setID, "VertexSet", 10, vset, kCCMIOStart, kCCMIOEnd); - setNames.push_back(shortName); - // The name of the next set is more than 32 characters long. - if (CCMIOGetProstarSet(err, id, longName, NULL, NULL, NULL, &setID) == kCCMIONoNodeErr) - { - *err = kCCMIONoErr; - CCMIONewProstarSet(err, id, longName, longName, &setID); - } - CCMIOWriteOpt1i(err, setID, "SplineSet", 4, set2, kCCMIOStart, kCCMIOEnd); - setNames.push_back(longName); - // But we don't need to specify a long name if we don't want to. - if (CCMIOGetProstarSet(err, id, truncatedName, NULL, NULL, NULL, &setID) == kCCMIONoNodeErr) - { - *err = kCCMIONoErr; - CCMIONewProstarSet(err, id, truncatedName, NULL, &setID); - } - CCMIOWriteOpt1i(err, setID, "BoundarySet", 4, set2, kCCMIOStart, kCCMIOEnd); - setNames.push_back(truncatedName); - - // Now make a string for the monitoring set node later on - vector setStr; - vector::iterator sit; - for (sit = setNames.begin(); sit != setNames.end(); ++sit) - { - int i = 0, size = sit->size(); - if (size == 0) // A size of zero will be a premature end-of-string - continue; - - setStr.push_back(min(kCCMIOMaxStringLength, size)); - while (i < size && i < kCCMIOMaxStringLength) - setStr.push_back((*sit)[i++]); - } - setStr.push_back('\0'); // End the C string - - // Write out a dummy problem description. If we happen to know that - // there already is a problem description previously recorded that - // is valid we could skip this step. - CCMIOID constants; - - if (!CCMIOIsValidEntity(problem)) - { - *err = kCCMIONoErr; - CCMIONewEntity(err, rootID, kCCMIOProblemDescription, - "Dummy description", &problem); - } - GetOrCreateEntity(err, problem, kCCMIOModelConstants, "Constant values", - &constants); - GetOrCreateIndexedEntity(err, problem, kCCMIOCellType, 1, "Dummy celltypes", - &id); - CCMIOWriteOptstr(err, id, "MaterialType", "solid"); - GetOrCreateIndexedEntity(err, problem, kCCMIOCellType, 2, "Dummy celltypes", - &id); - CCMIOWriteOptstr(err, id, "MaterialType", "solid"); - - CCMIOWriteOptf(err, constants, "Gravity", 9.82); - CCMIOWriteOptf(err, constants, "B.P. of water", 373); - CCMIOWriteOptstr(err, problem, "MonitoringSets", &setStr[0]); - - // We have a problem description recorded but our state does not know - // about it. So tell the state that it has a problem description. - CCMIOWriteState(err, stateID, problem, "Example state"); - - // Write out some simple solution data - float zero = 0.0, one = 1.0, half = 0.5; - CCMIOID phase, field; - CCMIODimensionality dim; - if (!CCMIOIsValidEntity(solutionID)) - CCMIONewEntity(err, rootID, kCCMIOFieldSet, "Dummy post data", - &solutionID); - GetOrCreateIndexedEntity(err, solutionID, kCCMIOFieldPhase, 0, NULL,&phase); - if (CCMIOGetField(err, phase, kDataName, &dim, &field) == kCCMIONoNodeErr) - { - *err = kCCMIONoErr; - CCMIONewField(err, phase, kDataName, kShortDataName, kCCMIOScalar, &field); - } - CCMIOWriteOptstr(err, field, kUnitsName, "°F"); - WriteMonolithicFieldData(err, field, cellMapID, kCCMIOFloat32, - (void *)postData, NULL); - - // Write out a piece of vector data (which also illustrates constant data) - CCMIOID vectorField; - GetOrCreateField(err, phase, "Velocity", "VELO", kCCMIOVector, &vectorField); - - GetOrCreateField(err, phase, "Velocity (U)", "U", kCCMIOScalar, &field); - CCMIOWriteOptstr(err, field, kUnitsName, "m/s"); - WriteMonolithicFieldData(err, field, cellMapID, kCCMIOFloat32, - NULL, (void *)&zero); - CCMIOWriteMultiDimensionalFieldData(err, vectorField, kCCMIOVectorX, field); - - GetOrCreateField(err, phase, "Velocity (V)", "V", kCCMIOScalar, &field); - CCMIOWriteOptstr(err, field, kUnitsName, "m/s"); - WriteMonolithicFieldData(err, field, cellMapID, kCCMIOFloat32, - NULL, (void *)&one); - CCMIOWriteMultiDimensionalFieldData(err, vectorField, kCCMIOVectorY, field); - - GetOrCreateField(err, phase, "Velocity (W)", "W", kCCMIOScalar, &field); - CCMIOWriteOptstr(err, field, kUnitsName, "m/s"); - WriteMonolithicFieldData(err, field, cellMapID, kCCMIOFloat32, - NULL, (void *)&half); - CCMIOWriteMultiDimensionalFieldData(err, vectorField, kCCMIOVectorZ, field); - - // Add in some sample restart info - int iteration = 0; - float time = 0.0, startAngle = 0.0; - CCMIOID restart, restartData; - GetOrCreateEntity(err, solutionID, kCCMIORestart, NULL, &restart); - CCMIOWriteRestartInfo(err, restart, "writeexample", iteration, time, NULL, - startAngle); - // The solver part can have anything the solver wants - GetOrCreateEntity(err, restart, kCCMIORestartData, NULL, &restartData); - CCMIOWriteOptf(err, restartData, "Convergence", 100); - - // Now we have the mesh (vertices and topology) and the post data written. - // Since we now have their IDs, we can write out the processor information. - CCMIOWriteProcessor(err, processorID, NULL, &verticesID, NULL, &topologyID, - NULL, NULL, NULL, &solutionID); - - // Write out some simple Lagrangian data - int nLagrangians = 0; - CCMIOID tmp, lagrangian; - i = 0; - while (CCMIONextEntity(NULL, processorID, kCCMIOLagrangianData, &i, &tmp) == kCCMIONoErr) - { - if (nLagrangians > 0) - printf("Too many Langrangians in this file; only expecting one.\n"); - else - { - lagrangian = tmp; - WriteLagrangianPositions(err, processorID, &lagrangian, - &verticesID, &solutionID); - } - nLagrangians++; - } - if (nLagrangians == 0) - { - lagrangian = tmp; // tmp was set to invalid by CCMIONextEntity - WriteLagrangianPositions(err, processorID, &lagrangian, - &verticesID, &solutionID); - } - - GetOrCreateIndexedEntity(err, solutionID, kCCMIOFieldPhase, 0, NULL,&phase); - GetOrCreateField(err, phase, "Droplet type", "droplet", kCCMIOScalar, - &field); - CCMIOWriteOptstr(err, field, kUnitsName, "none"); - WriteMonolithicFieldData(err, field, cellMapID, kCCMIOInt32, - (void *)types, NULL); - - CCMIOWriteLagrangianData(err, lagrangian, NULL, &verticesID, - NULL, &solutionID); - - // We're done! - CCMIOCloseFile(err, rootID); - - if (*err != kCCMIONoErr) - { - cout << "Error " << *err << " writing mesh" << endl; - return(0); - } - - return(1); -} - -bool HasSameDescription(CCMIOID entity, const char *desc) -{ - unsigned int size; - if (CCMIOEntityDescription(NULL, entity, &size, NULL) != kCCMIONoErr || - size <= 0) - return(false); - - bool eq = false; - char *str = new char[size + 1]; - if (CCMIOEntityDescription(NULL, entity, &size, str) == kCCMIONoErr && - strcmp(desc, str) == 0) - eq = true; - - delete [] str; - - return(eq); -} - -CCMIOError GetOrCreateEntity(CCMIOError *err, CCMIOID parent, CCMIOEntity which, - const char *description, CCMIOID *id) -{ - if (CCMIOGetEntity(err, parent, which, 0, id) == kCCMIONoNodeErr) - { - *err = kCCMIONoErr; - CCMIONewEntity(err, parent, which, description, id); - } - return(*err); -} - -CCMIOError GetOrCreateIndexedEntity(CCMIOError *err, CCMIOID parent, - CCMIOEntity which, int idx, - const char *description, CCMIOID *id) -{ - if (CCMIOGetEntity(err, parent, which, idx, id) == kCCMIONoNodeErr) - { - *err = kCCMIONoErr; - CCMIONewIndexedEntity(err, parent, which, idx, description, id); - } - return(*err); -} - -CCMIOError GetOrCreateField(CCMIOError *err, CCMIOID phase, const char *name, - const char *description, - CCMIODimensionality dim, CCMIOID *field) -{ - if (CCMIOGetField(err, phase, name, &dim, field) == kCCMIONoNodeErr) - { - *err = kCCMIONoErr; - CCMIONewField(err, phase, name, description, kCCMIOScalar, - field); - } - return(*err); -} - -CCMIOError WriteMonolithicFieldData(CCMIOError *err, CCMIOID field, - CCMIOID mapID, CCMIODataType type, - void *postData, void *constData) -{ - int n = 0, i = 0; - CCMIOID id, tmp; - - // We need to be very careful here, because field data nodes are numbered, - // but we don't know which number is which. CCMIONextEntity() will traverse - // them in the order that they were created. - if (CCMIONextEntity(NULL, field, kCCMIOFieldData, &i, &id) == kCCMIONoNodeErr) - { - CCMIONewEntity(err, field, kCCMIOFieldData, NULL, &id); - // Since we have a new node, the do-while loop will find it, so - // send it past it. - while (CCMIONextEntity(NULL, field, kCCMIOFieldData, &i, &tmp) == kCCMIONoErr) - ; - } - do - { - if (n == 0) - { - if (postData) - { - if (type == kCCMIOFloat32) - CCMIOWriteFieldDataf(err, id, mapID, kCCMIOCell, - (float *)postData, - kCCMIOStart, kCCMIOEnd); - else if (type == kCCMIOFloat64) - CCMIOWriteFieldDatad(err, id, mapID, kCCMIOCell, - (double *)postData, - kCCMIOStart, kCCMIOEnd); - else if (type == kCCMIOInt32) - CCMIOWriteFieldDatai(err, id, mapID, kCCMIOCell, - (int *)postData, - kCCMIOStart, kCCMIOEnd); - else - cout << "Bad type" << endl; - } - else - { - if (type == kCCMIOFloat32) - CCMIOWriteConstantFieldDataf(err, id, mapID, kCCMIOCell, - *(float *)constData); - else if (type == kCCMIOFloat64) - CCMIOWriteConstantFieldDatad(err, id, mapID, kCCMIOCell, - *(double *)constData); - else if (type == kCCMIOInt32) - CCMIOWriteConstantFieldDatai(err, id, mapID, kCCMIOCell, - *(int *)constData); - else - cout << "Bad type" << endl; - } - } - else - cout << "Too many field entities; only expected one!" << endl; - n++; - } while(CCMIONextEntity(NULL, field, kCCMIOFieldData, &i, &id) - == kCCMIONoErr); - - return(*err); -} - - -CCMIOError WriteLagrangianPositions(CCMIOError *err, CCMIOID processorID, - CCMIOID *lagrangian, - CCMIOID *verticesID, CCMIOID *solutionID) -{ - CCMIOID mapID; - - if (!CCMIOIsValidEntity(*lagrangian)) - GetOrCreateEntity(err, processorID, kCCMIOLagrangianData, NULL, - lagrangian); - CCMIOReadLagrangianData(NULL, *lagrangian, verticesID, solutionID); - if (!CCMIOIsValidEntity(*verticesID)) { - CCMIONewEntity(err, *lagrangian, kCCMIOVertices, "Positions", - verticesID); - CCMIONewEntity(err, *lagrangian, kCCMIOMap, "Positions map", &mapID); - } - else - CCMIOReadVerticesf(err, *verticesID, NULL, NULL, &mapID, NULL, 0, 0); - if (!CCMIOIsValidEntity(*solutionID)) - CCMIONewEntity(err, *lagrangian, kCCMIOFieldSet, - "Dummy Lagrangian post data", solutionID); - - CCMIOWriteMap(err, mapID, nDroplets, mapData[nDroplets], mapData, - kCCMIOStart, kCCMIOEnd); - CCMIOWriteVerticesf(err, *verticesID, 3, 1.0, mapID, positions, - kCCMIOStart, kCCMIOEnd); - - return(*err); -} diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/examples/writeexample.cpp b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/examples/writeexample.cpp deleted file mode 100644 index e6c8e406a3..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/examples/writeexample.cpp +++ /dev/null @@ -1,341 +0,0 @@ -#include "ccmio.h" -#include "ccmioutility.h" -#include -#include -#include // for min() - -// If you are unfamiliar with the Standard Template Library (STL), please read. -// vector: A dynamic array. vector is an array of ints. Suppose -// we have vector iarr; -// iarr.push_back( ... ); adds an item to the end of the -// array, resizing if necessary. -// iarr.size(); Returns the number of items. -// iarr[10]; The 11th item in the array. -// No bounds checking is performed. -// iarr.resize(10); Makes the array 10 items long. - -using namespace std; - -struct Face { - int nVerts; - int vertices[4]; - int cells[2]; -}; -static int const nCells = 8; -int cells[] = { 1, 1, 1, 2, 1, 1, 1, 1 }; -static int const nInternalFaces = 12; -Face internalFaces[] = { { 4, {2, 5, 14, 11}, {2, 1} }, - { 4, {4, 5, 14, 13}, {1, 3} }, - { 4, {5, 6, 15, 14}, {2, 4} }, - { 4, {5, 8, 17, 14}, {4, 3} }, - { 4, {10, 11, 14, 13}, {5, 1} }, - { 4, {11, 12, 15, 14}, {6, 2} }, - { 4, {11, 14, 23, 20}, {6, 5} }, - { 4, {13, 14, 17, 16}, {7, 3} }, - { 4, {13, 14, 23, 22}, {5, 7} }, - { 4, {14, 15, 18, 17}, {8, 4} }, - { 4, {14, 15, 24, 23}, {6, 8} }, - { 4, {14, 17, 26, 23}, {8, 7} } }; - -static int const nBoundaryFaces = 24; -Face boundaryFaces[] = { { 4, {1, 2, 5, 4}, {1, 0} }, - { 4, {1, 10, 11, 2}, {1, 0} }, - { 4, {1, 4, 13, 10}, {1, 0} }, - { 4, {2, 3, 6, 5}, {2, 0} }, - { 4, {2, 11, 12, 3}, {2, 0} }, - { 4, {3, 12, 15, 6}, {2, 0} }, - { 4, {4, 5, 8, 7}, {3, 0} }, - { 4, {4, 7, 16, 13}, {3, 0} }, - { 4, {5, 6, 9, 8}, {4, 0} }, - { 4, {6, 15, 18, 9}, {4, 0} }, - { 4, {7, 8, 17, 16}, {3, 0} }, - { 4, {8, 9, 18, 17}, {4, 0} }, - { 4, {10, 19, 20, 11}, {5, 0} }, - { 4, {10, 13, 22, 19}, {5, 0} }, - { 4, {11, 20, 21, 12}, {6, 0} }, - { 4, {12, 21, 24, 15}, {6, 0} }, - { 4, {13, 16, 25, 22}, {7, 0} }, - { 4, {15, 24, 27, 18}, {8, 0} }, - { 4, {16, 17, 26, 25}, {7, 0} }, - { 4, {17, 18, 27, 26}, {8, 0} }, - { 4, {19, 22, 23, 20}, {5, 0} }, - { 4, {20, 23, 24, 21}, {6, 0} }, - { 4, {22, 25, 26, 23}, {7, 0} }, - { 4, {23, 26, 27, 24}, {8, 0} } }; -int nVertices = 27; -float vertices[] = { 0, 0, 0, 0, 0.5, 0, 0, 1, 0, 0.5, 0, 0, 0.5, 0.5, 0, 0.5, 1, 0, 1, 0, 0, 1, 0.5, 0, 1, 1, 0, 0, 0, 0.5, 0, 0.5, 0.5, 0, 1, 0.5, 0.5, 0, 0.5, 0.5, 0.5, 0.5, 0.5, 1, 0.5, 1, 0, 0.5, 1, 0.5, 0.5, 1, 1, 0.5, 0, 0, 1, 0, 0.5, 1, 0, 1, 1, 0.5, 0, 1, 0.5, 0.5, 1, 0.5, 1, 1, 1, 0, 1, 1, 0.5, 1, 1, 1, 1 }; -int mapData[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 }; - -float postData[] = { 100.0, 100.0, 100.0, 200.0, 100.0, 100.0, 100.0, 100.0 }; - -static int nDroplets = 8; -float positions[] = { 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, - 1, 1, 0, 1, 1, 1 }; -int types[] = { 1, 1, 2, 1, 2, 1, 2, 2 }; - -static char const kStateName[] = "default"; -static char const kDataName[] = "Temperature"; -static char const kShortDataName[] = "Temp"; -static char const kUnitsName[] = "Units"; -static int const kInc = 10; - -int main( int argc, char *argv[] ) -{ - int i = 0; - CCMIOID stateID, processorID, rootID, verticesID, topologyID, solutionID; - CCMIOID mapID; - CCMIOID id, cellMapID; - CCMIOError error = kCCMIONoErr, *err = &error; - - if (argc < 2) - { - cout << "Usage: " << argv[0] << " outputFile" << endl; - return(0); - } - - CCMIOOpenFile(err, argv[1], kCCMIOWrite, &rootID); - - // Create a new state (or re-use an existing one). If you want to - // re-use the problem description, check if there is a state first, - // because CCMIONewState() may destroy it: - // if (CCMIOGetState(NULL, rootID, kStateName, &stateID) != kCCMIONoErr) - // CCMIONewState(err, rootID, kStateName, NULL, &stateID); - CCMIONewState(err, rootID, kStateName, NULL, NULL, &stateID); - - // Attempt to find the first processor (i has already been initialized to 0) - // If this was not a brand-new state, then we should reuse this processor - // (if we just create a processor, we will have more than one processor, - // and one of them will no longer be meaningful). If we were writing - // a multiprocessor mesh we should loop through all the processors, delete - // them, and then create however many processors we need. - // Note that we pass NULL for the error because it is not an error for - // us if there is not a processor; it just means that we need to create - // one. If we pass in 'err' then all the rest of the functions will - // needlessly fail because we encountered an expected error. - if (CCMIONextEntity(NULL, stateID, kCCMIOProcessor, &i, &processorID) != kCCMIONoErr) - CCMIONewEntity(err, stateID, kCCMIOProcessor, NULL, &processorID); - - // Get rid of any data that may be in this processor (if the state was - // not new). - CCMIOClearProcessor(err, stateID, processorID, TRUE, TRUE, TRUE, TRUE, - TRUE); - - // Write the vertices (the vertices are in Fortran order, so we need to - // make sure we specify that). First we will need to create the mapping - // from the index in the data array to the vertex ID. Then we can write - // the actual data. - CCMIONewEntity(err, rootID, kCCMIOMap, "Vertex map", &mapID); - CCMIOWriteMap(err, mapID, nVertices, mapData[nVertices], mapData, - kCCMIOStart, kCCMIOEnd); - CCMIONewEntity(err, rootID, kCCMIOVertices, "Vertices", &verticesID); - // Write the vertices piecemeal by way of illustration - for (i = 0; i < nVertices; i += kInc) - CCMIOWriteVerticesf(err, verticesID, 3, 1.0, mapID, vertices + 3 * i, - i, i + kInc); - - // Write the cells - CCMIONewEntity(err, rootID, kCCMIOMap, "Cell map", &cellMapID); - CCMIOWriteMap(err, cellMapID, nCells, mapData[nVertices], mapData, - kCCMIOStart, kCCMIOEnd); - CCMIONewEntity(err, rootID, kCCMIOTopology, "Topology", &topologyID); - CCMIONewEntity(err, topologyID, kCCMIOCells, "Cells", &id); - for (i = 0; i < nCells; i += 3) - CCMIOWriteCells(err, id, cellMapID, cells + i, i, i + 3); - - // Write the faces. There are two kinds of faces, internal faces and - // boundary faces. The procedure is the same for each except that - // internal faces' cell array is a two dimensional array because internal - // faces have a cell on both sides. Boundary faces, obviously, only - // have one cell. - vector v, c; - - CCMIONewEntity(err, rootID, kCCMIOMap, NULL, &mapID); - CCMIOWriteMap(err, mapID, nInternalFaces, - mapData[nBoundaryFaces + nInternalFaces], - &mapData[nBoundaryFaces], kCCMIOStart, kCCMIOEnd); - CCMIONewEntity(err, topologyID, kCCMIOInternalFaces, "Internal faces", &id); - for (int f = 0; f < nInternalFaces; ++f) - { - v.push_back(internalFaces[f].nVerts); - for (int i = 0; i < internalFaces[f].nVerts; ++i) - v.push_back(internalFaces[f].vertices[i]); - c.push_back(internalFaces[f].cells[0]); - c.push_back(internalFaces[f].cells[1]); // Our other cell - } - CCMIOWriteFaces(err, id, kCCMIOInternalFaces, mapID, v.size(), &v[0], - kCCMIOStart, kCCMIOEnd); - CCMIOWriteFaceCells(err, id, kCCMIOInternalFaces, mapID, &c[0], kCCMIOStart, - kCCMIOEnd); - - v.clear(); - c.clear(); - CCMIONewEntity(err, rootID, kCCMIOMap, NULL, &mapID); - CCMIOWriteMap(err, mapID, nBoundaryFaces, mapData[nBoundaryFaces], mapData, - kCCMIOStart, kCCMIOEnd); - CCMIONewIndexedEntity(err, topologyID, kCCMIOBoundaryFaces, 0, - "Boundary faces", &id); - for (int f = 0; f < nBoundaryFaces; ++f) - { - v.push_back(boundaryFaces[f].nVerts); - for (int i = 0; i < boundaryFaces[f].nVerts; ++i) - v.push_back(boundaryFaces[f].vertices[i]); - c.push_back(boundaryFaces[f].cells[0]); - // Boundary faces only have one cell, so cells[1] is unused. - } - CCMIOWriteFaces(err, id, kCCMIOBoundaryFaces, mapID, v.size(), &v[0], - kCCMIOStart, kCCMIOEnd); - CCMIOWriteFaceCells(err, id, kCCMIOBoundaryFaces, mapID, &c[0], kCCMIOStart, - kCCMIOEnd); - - // Write any prostar sets that we are using (this is optional) - int set1[] = { 1, 2, 3, 4 }, set2[] = {2, 4, 6, 8}; - int vset[] = { 2, 3, 5, 7, 11, 13,15, 17, 19, 23}; - char shortName[] = "half"; - char longName[] = "Supercalifragilisticexpialidocious"; - char truncatedName[] = "SetWithAReallyLongNameThatWillGetTruncated"; - vector setNames; - CCMIOID setID; - CCMIONewProstarSet(err, id, shortName, shortName, &setID); - CCMIOWriteOpt1i(err, setID, "CellSet", 4, set1, kCCMIOStart, kCCMIOEnd); - CCMIOWriteOpt1i(err, setID, "VertexSet", 10, vset, kCCMIOStart, kCCMIOEnd); - setNames.push_back(shortName); - // The name of the next set is more than 32 characters long. - CCMIONewProstarSet(err, id, longName, longName, &setID); - CCMIOWriteOpt1i(err, setID, "SplineSet", 4, set2, kCCMIOStart, kCCMIOEnd); - setNames.push_back(longName); - // But we don't need to specify a long name if we don't want to. - CCMIONewProstarSet(err, id, truncatedName, NULL, &setID); - CCMIOWriteOpt1i(err, setID, "BoundarySet", 4, set2, kCCMIOStart, kCCMIOEnd); - setNames.push_back(truncatedName); - - // Now make a string for the monitoring set node later on - vector setStr; - vector::iterator sit; - for (sit = setNames.begin(); sit != setNames.end(); ++sit) - { - int i = 0, size = sit->size(); - if (size == 0) // A size of zero will be a premature end-of-string - continue; - - setStr.push_back(min(kCCMIOMaxStringLength, size)); - while (i < size && i < kCCMIOMaxStringLength) - setStr.push_back((*sit)[i++]); - } - setStr.push_back('\0'); // End the C string - - // Write out a dummy problem description. If we happen to know that - // there already is a problem description previously recorded that - // is valid we could skip this step. - CCMIOID problem, constants; - - CCMIONewEntity(err, rootID, kCCMIOProblemDescription, "Dummy description", - &problem); - CCMIONewIndexedEntity(err, problem, kCCMIOCellType, 1, "Dummy celltypes", &id); - CCMIOWriteOptstr(err, id, "MaterialType", "solid"); - CCMIONewIndexedEntity(err, problem, kCCMIOCellType, 2, "Dummy celltypes", &id); - CCMIOWriteOptstr(err, id, "MaterialType", "solid"); - - CCMIONewEntity(err, problem, kCCMIOModelConstants, "Constant values", - &constants); - CCMIOWriteOptf(err, constants, "Gravity", 9.82); - CCMIOWriteOptf(err, constants, "B.P. of water", 373); - CCMIOWriteOptstr(err, problem, "MonitoringSets", &setStr[0]); - - // We have problem description recorded but our state does not know - // about it. So tell the state that it has a problem description. - CCMIOWriteState(err, stateID, problem, "Example state"); - - // Write out some simple solution data - CCMIOID phase, field; - CCMIONewEntity(err, rootID, kCCMIOFieldSet, "Dummy post data", &solutionID); - CCMIONewIndexedEntity(err, solutionID, kCCMIOFieldPhase, 0, NULL, &phase); - CCMIONewField(err, phase, kDataName, kShortDataName, kCCMIOScalar, &field); - CCMIOWriteOptstr(err, field, kUnitsName, "°F"); - CCMIONewEntity(err, field, kCCMIOFieldData, NULL, &id); - CCMIOWriteFieldDataf(err, id, cellMapID, kCCMIOCell, postData, - kCCMIOStart, kCCMIOEnd); - - // Write out a piece of vector data (which also illustrates constant data) - CCMIOID vectorField; - CCMIONewField(err, phase, "Velocity", "VELO", kCCMIOVector, &vectorField); - - CCMIONewField(err, phase, "Velocity (U)", "U", kCCMIOScalar, &field); - CCMIOWriteOptstr(err, field, kUnitsName, "m/s"); - CCMIONewEntity(err, field, kCCMIOFieldData, NULL, &id); - CCMIOWriteConstantFieldDataf(err, id, cellMapID, kCCMIOCell, 0.0); - CCMIOWriteMultiDimensionalFieldData(err, vectorField, kCCMIOVectorX, field); - - CCMIONewField(err, phase, "Velocity (V)", "V", kCCMIOScalar, &field); - CCMIOWriteOptstr(err, field, kUnitsName, "m/s"); - CCMIONewEntity(err, field, kCCMIOFieldData, NULL, &id); - CCMIOWriteConstantFieldDataf(err, id, cellMapID, kCCMIOCell, 1.0); - CCMIOWriteMultiDimensionalFieldData(err, vectorField, kCCMIOVectorY, field); - - CCMIONewField(err, phase, "Velocity (W)", "W", kCCMIOScalar, &field); - CCMIOWriteOptstr(err, field, kUnitsName, "m/s"); - CCMIONewEntity(err, field, kCCMIOFieldData, NULL, &id); - CCMIOWriteConstantFieldDataf(err, id, cellMapID, kCCMIOCell, 0.5); - CCMIOWriteMultiDimensionalFieldData(err, vectorField, kCCMIOVectorZ, field); - - // Add in some sample restart info - int iteration = 0; - float time = 0.0, startAngle = 0.0; - CCMIOID restart, restartData; - CCMIONewEntity(err, solutionID, kCCMIORestart, NULL, &restart); - CCMIOWriteRestartInfo(err, restart, "writeexample", iteration, time, NULL, - startAngle); - // The solver part can have anything the solver wants - CCMIONewEntity(err, restart, kCCMIORestartData, NULL, &restartData); - CCMIOWriteOptf(err, restartData, "Convergence", 100); - - // Now we have the mesh (vertices and topology) and the post data written. - // Since we now have their IDs, we can write out the processor information. - CCMIOWriteProcessor(err, processorID, NULL, &verticesID, NULL, &topologyID, - NULL, NULL, NULL, &solutionID); - - // Write out some simple Lagrangian data - CCMIONewEntity(err, rootID, kCCMIOMap, "Positions map", &mapID); - CCMIOWriteMap(err, mapID, nDroplets, mapData[nDroplets], mapData, - kCCMIOStart, kCCMIOEnd); - CCMIONewEntity(err, rootID, kCCMIOVertices, "Positions", &verticesID); - CCMIOWriteVerticesf(err, verticesID, 3, 1.0, mapID, positions, - kCCMIOStart, kCCMIOEnd); - - CCMIONewEntity(err, rootID, kCCMIOFieldSet, "Dummy Lagrangian post data", - &solutionID); - CCMIONewIndexedEntity(err, solutionID, kCCMIOFieldPhase, 0, NULL, &phase); - CCMIONewField(err, phase, "Droplet type", "droplet", kCCMIOScalar, &field); - CCMIONewEntity(err, field, kCCMIOFieldData, NULL, &id); - CCMIOWriteOptstr(err, field, kUnitsName, "none"); - CCMIOWriteFieldDatai(err, id, cellMapID, kCCMIOCell, types, - kCCMIOStart, kCCMIOEnd); - - CCMIOID lagrangian; - CCMIONewEntity(err, processorID, kCCMIOLagrangianData, NULL, &lagrangian); - CCMIOWriteLagrangianData(err, lagrangian, NULL, &verticesID, - NULL, &solutionID); - - CCMIOCloseFile(err, rootID); - - if (*err != kCCMIONoErr) - { - cout << "Error " << *err << " writing mesh" << endl; - return(0); - } - - // The CCMIO library uses ADF to store the actual data. Unfortunately, - // ADF leaks disk space; deleting a node does not recover all the disk - // space. Now that everything is successfully written it might be useful - // to call CCMIOCompress() here to ensure that the file is as small as - // possible. Please see the Core API documentation for caveats on its - // usage. - if (CCMIOCompress(NULL, argv[1]) != kCCMIONoErr) - { - cout << "Error compressing file. Check that you have " - << "adequate disk space " << endl << "and that you have write " - << "permission to the current directory." << endl; - return(0); - } - - return(1); -} diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/groups.dox b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/groups.dox deleted file mode 100644 index bd617868f2..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/groups.dox +++ /dev/null @@ -1,8 +0,0 @@ -/** \defgroup core Core API -The Core API provides low-level access to the file. In general this API -is not necessary as the Intermediate API provides a more useful interface. -*/ - -/** \defgroup intermediate Intermediate API -The Intermediate API provides a higher level method of accessing -data than the Core API. */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/header.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/header.html deleted file mode 100644 index 01e4303c53..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/header.html +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/hierarchy.dox b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/hierarchy.dox deleted file mode 100644 index 1e10d2cc98..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/hierarchy.dox +++ /dev/null @@ -1,73 +0,0 @@ -/** \page hierarchy CCMIO Hierarchy -
-The CCMIO API presupposes a certain conceptual layout of the data.  -This layout is consists of a hierarchical collection of entities. Each entity -stores a particular type of information and is decribed below:
-\image html hierarchy.png -

-All entities are conceptually of the same nature and are often interchangeable. -Ideally the API would provide one general set of functions for handling entities. -However some entities must be referred to by a specific name or number. Because -of C's strict typing system it is necessary to divide entities into several -types: regular entities, indexed entities, and special entities. Regular -entities do not have any identifying information visible outside the API. -For instance, each map is indistiguishable (but not interchangeable!) from -another map as far as the API is concerned. Indexed entities are referred to -by a user-specified ID. They are marked with a blue number on the diagram. -Indexed entities are created with CCMIONewIndexedEntity() and are retrieved with -CCMIOGetEntity() or, probably more commonly, with CCMIONextEntity(). The special -entities contain information that is conceptually part of the entity itself -and they are created and retrieved with special functions CCMIONew*(), CCMIOGet*(), -where * is the entity type name. Special entities are marked with thick -borders. -

-Some entities contain references to other entities. The border of the referrer -is colored the color as the text of the referree. -

-The entity type names are taken from the CCMIO specification. Although they are -largely self-explanatory, a more complete description of several entities -follows:
- - - - - - - - - - - - - - - - - - - - - - - - - -
StateEach state describes everything -necessary to solve a mesh at a given instant in time.  Multiple -states will be required for moving or morphing meshes.
-
ProcessorContains the mesh, solution, and -initial conditions for the state.
-
Field SetA field set is the collection of -post data. It may (and probably will) contain many fields.
-
FieldOne post data variable (e.g. "Pressure").
-
Field DataEither the cell, vertex, or face values -for a particular post data variable.
-
MapThe map converts a data index into an ID. -For instance given vertex data { (0, 0, 0), (0, 1, 0), (1, 1, 0) } and the -map { 3, 1, 4 }, we know that

-      Vertex 1    (0, 1, 0)
-      Vertex 3    (0, 0, 0)
-      Vertex 4    (1, 1, 0)
-
-*/ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/hierarchy.png b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/hierarchy.png deleted file mode 100644 index be51822811..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/hierarchy.png and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00004.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00004.html deleted file mode 100644 index 0e047cab5f..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00004.html +++ /dev/null @@ -1,689 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

readexample.cpp

A self-contained example that reads the mesh and post data. -

-

#include <stdlib.h>     // For exit()
-#include <ccmio.h>
-#include <vector>
-#include <map>
-#include <iostream>
-
-typedef std::vector< unsigned int > UIntArray;
-typedef std::map< int, std::vector< int > > FaceMap;
-
-// If you are unfamiliar with the Standard Template Library (STL), please read.
-//   vector:    A dynamic array.  vector<int> is an array of ints.  Suppose
-//              we have vector<int> iarr;
-//                  iarr.push_back( ... ); adds an item to the end of the
-//                                         array, resizing if necessary.
-//                  iarr.size();           Returns the number of items.
-//                  iarr[10];              The 11th item in the array.
-//                                         No bounds checking is performed.
-//                  iarr.resize(10);       Makes the array 10 items long.
-//   map:       An associative container.   map< int, float > is an sorted
-//              based on an integer key and contains a value float.
-//              Suppose we have map<int, float> m;
-//                  m[18] = 3.141592;      Associates Pi with the key 18.
-//                                         Technically m[18] returns a reference
-//                                         to the value associated with 18,
-//                                         which is then assigned to.
-//                                         (A reference is like a pointer that
-//                                         cannot change where it is pointed to
-//                                         and is treated syntactically like a
-//                                         normal variable).
-//   iterators: The way to increment through the container.
-//                  container.begin()      Returns an iterator to the first item
-//                  container.end()        Returns an iterator just past the end
-//                  *iter                  The item being iterated to.
-
-enum DataType { kScalar, kVector, kVertex, kCell, kInternalFace, kBoundaryFace,
-                kBoundaryData, kBoundaryFaceData, kCellType };
-
-using namespace std;
-
-static int const kNValues = 10; // Number of values of each element to print
-static char const kDefaultState[] = "default";
-static char const kUnitsName[] = "Units";
-static int const kVertOffset = 2;
-static int const kCellInc = 4;
-
-static void ReadMesh( CCMIOError &err, CCMIOID &vertices, CCMIOID &topology );
-static void ReadVertices( CCMIOError &err, CCMIOID &vertices,
-                          char const *counter, int offset = 0 );
-static void ReadSolverInfo( CCMIOError &err, CCMIOID &solution);
-static void ReadPost( CCMIOError &err, CCMIOID &solution );
-static void ReadScalar( CCMIOError &err, CCMIOID field, vector<int> &mapData,
-                        vector<float> &data, bool readingVector = false );
-static void ReadSets( CCMIOError &err, CCMIOID &problem );
-static void CheckError( CCMIOError const &err, char const *str );
-static void PrintData( int n, int id, DataType type, void *data,
-                       void *data2 = NULL );
-
-int main( int argc, char *argv[])
-{
-    bool hasSolution = true;
-    int i = 0;
-    CCMIOID root, state, processor, vertices, topology, solution, problem, next;
-    CCMIOError err;
-
-    // Open the file.  Because we did not initialize 'err' we need to pass
-    // in NULL (which always means kCCMIONoErr) and then assign the return
-    // value to 'err'.).
-    err = CCMIOOpenFile(NULL, argv[1], kCCMIORead, &root);
-
-    // We are going to assume that we have a state with a known name.
-    // We could instead use CCMIONextEntity() to walk through all the states in
-    // the file and present the list to the user for selection.
-    CCMIOGetState(&err, root, kDefaultState, &problem, &state);
-    if (err != kCCMIONoErr)
-    {
-        cout << "No state named '" << kDefaultState << "'" << endl;
-        return(0);
-    }
-    
-    unsigned int size;
-    CCMIOEntityDescription(&err, state, &size, NULL);
-    char *desc = new char[size + 1];
-    CCMIOEntityDescription(&err, state, NULL, desc);
-    cout << "Reading state '" << kDefaultState << "' (" << desc << ")" << endl;
-    delete [] desc;
-
-    // Find the first processor (i has previously been initialized to 0) and
-    // read the mesh and solution information.
-    CCMIONextEntity(&err, state, kCCMIOProcessor, &i, &processor);
-    CCMIOReadProcessor(&err, processor, &vertices, &topology, NULL, &solution);
-
-    if (err != kCCMIONoErr)
-    {
-        // Maybe no solution;  try again
-        err = kCCMIONoErr;
-        CCMIOReadProcessor(&err, processor, &vertices, &topology, NULL, NULL);
-        if (err != kCCMIONoErr)
-        {
-            cout << "Could not read the file." << endl;
-            return(0);
-        }
-        hasSolution = false;
-    }
-
-    // Print out the problem description (just cell types, and model constants)
-    i = 0;
-    if (CCMIOIsValidEntity(problem))   // if we have a problem description...
-    {
-        // ... walk through each cell type and print it...
-        while (CCMIONextEntity(NULL, problem, kCCMIOCellType, &i, &next)
-                                                                 == kCCMIONoErr)
-        {
-            char *name;
-            int size, cellType;
-
-            // ... if it has a material type.  (Note that we do not pass in
-            // an array to get the name because we do not know how long the
-            // string is yet.  Many parameters to CCMIO functions that return
-            // data can be NULL if that data is not needed.)
-            if (CCMIOReadOptstr(NULL, next, "MaterialType", &size, NULL)
-                                                                   == kCCMIONoErr)
-            {
-                name = new char[size + 1];
-                CCMIOReadOptstr(&err, next, "MaterialType", &size, name);
-                CCMIOGetEntityIndex(&err, next, &cellType);
-                PrintData(i, cellType, kCellType, name);
-                delete [] name;
-            }
-        }
-
-        float value;
-        CCMIOID constants;
-
-        // Read some constants of particular interest, fall back to defaults
-        // if they don't exist (or at least, that is what we would do if we
-        // actually used them).  If you want to iterate over all the constants
-        // instead, you will need to use CCMIOGetEntityNode() and use
-        // CCMIOGetNextChild(), and CCMIOReadData() in the Core API.
-        if (CCMIOGetEntity(NULL, problem, kCCMIOModelConstants, 0, &constants)
-                                                                 == kCCMIONoErr)
-        {
-            if (CCMIOReadOptf(NULL, constants, "Gravity", &value) == kCCMIONoErr)
-                cout << "Gravity is " << value << " m/s^2" << endl;
-            else
-                cout << "Gravity is unspecified" << endl;
-
-            if (CCMIOReadOptf(NULL, constants, "Hubble constant", &value) == kCCMIONoErr)
-                cout << "Hubble constant is " << value << endl;
-            else
-                cout << "Hubble constant is unspecified" << endl;
-        }
-
-        // Read in the prostar sets.  (This is probably not necessary for
-        // most applications, but included to show proper parsing.)
-        ReadSets(err, problem);
-    }
-    ReadMesh(err, vertices, topology);
-    if (hasSolution)
-        {
-        ReadSolverInfo(err, solution);
-        ReadPost(err, solution);
-        }
-    else
-        cout << "No post data." << endl;
-
-    // Read Lagrangian data
-    vector<CCMIOID> ids;
-    CCMIOID lagrangian;
-    i = 0;
-    while (CCMIONextEntity(&err, processor, kCCMIOLagrangianData, &i,
-                           &lagrangian) == kCCMIONoErr)
-    {
-        CCMIOID solutionID, positionsID;
-        CCMIOReadLagrangianData(&err, lagrangian, &positionsID, &solutionID);
-
-        CCMIOEntityDescription(&err, lagrangian, &size, NULL);
-        char *label = new char[size + 1];
-        CCMIOEntityDescription(&err, lagrangian, NULL, label);
-        cout << "Lagrangian data '" << label << "'" << endl;
-        delete [] label;
-
-        ReadVertices(err, positionsID, "positions");
-        ReadPost(err, solutionID);
-        ids.push_back(positionsID);
-        ids.push_back(solutionID);
-    }
-
-    for (vector<CCMIOID>::iterator it = ids.begin();  it != ids.end();  ++it)
-        CCMIOCloseFile(&err, *it);
-
-    CCMIOCloseFile(&err, vertices);
-    CCMIOCloseFile(&err, topology);
-    CCMIOCloseFile(&err, solution);
-    CCMIOCloseFile(&err, root);
-}
-
-void ReadMesh( CCMIOError &err, CCMIOID &vertices, CCMIOID &topology )
-{
-    unsigned int i, j, nCells, nFaces, size;
-    CCMIOID mapID, id;
-    vector<int> mapData, faces, cells, faceCells;
-    vector<float> verts;
-
-    ReadVertices(err, vertices, "vertices", kVertOffset);
-
-    // Read the cells.  Store cell IDs so that we know what cells are in
-    // this post data.
-    CCMIOGetEntity(&err, topology, kCCMIOCells, 0, &id);
-    CCMIOEntitySize(&err, id, &nCells, NULL);
-    cells.resize(nCells);
-    mapData.resize(nCells);
-    for (unsigned int k = 0;  k < nCells;  k += kCellInc)
-    {
-        CCMIOReadCells(&err, id, &mapID, &cells[k], k, k + kCellInc);
-        CCMIOReadMap(&err, mapID, &mapData[k], k, k + kCellInc);
-    }
-
-    cout << "\t" << nCells << " cells" << endl;
-    for (i = 0;  i < nCells && err == kCCMIONoErr;  ++i)
-        PrintData(i, mapData[i], kCell, &cells[i]);
-    CheckError(err, "Error reading cells");
-
-    // Read the internal faces.
-    CCMIOGetEntity(&err, topology, kCCMIOInternalFaces, 0, &id);
-    CCMIOEntitySize(&err, id, &nFaces, NULL);
-    mapData.resize(nFaces);
-    faceCells.resize(2 * nFaces);
-    CCMIOReadFaces(&err, id, kCCMIOInternalFaces, NULL, &size, NULL,
-                   kCCMIOStart, kCCMIOEnd);
-    faces.resize(size);
-    CCMIOReadFaces(&err, id, kCCMIOInternalFaces, &mapID, NULL, &faces[0],
-                   kCCMIOStart, kCCMIOEnd);
-    CCMIOReadFaceCells(&err, id, kCCMIOInternalFaces, &faceCells[0],
-                       kCCMIOStart, kCCMIOEnd);
-    CCMIOReadMap(&err, mapID, &mapData[0], kCCMIOStart, kCCMIOEnd);
-    
-    cout << "\t" << nFaces << " faces" << endl;
-    unsigned int pos = 0;
-    i = 0;
-    while (pos < faces.size())
-    {
-        PrintData(i, mapData[i], kInternalFace, &faces[pos], &faceCells[2 * i]);
-        pos += faces[pos] + 1;
-        i++;
-    }
-    CheckError(err, "Error reading internal faces");
-
-    // Read the boundary faces.
-    int index = 0;
-    while (CCMIONextEntity(NULL, topology, kCCMIOBoundaryFaces, &index, &id)
-                                                                 == kCCMIONoErr)
-    {
-        int boundaryVal;
-        vector<int> prostarIDs;
-
-        CCMIOEntitySize(&err, id, &nFaces, NULL);
-        mapData.resize(nFaces);
-        faceCells.resize(nFaces);
-        CCMIOReadFaces(&err, id, kCCMIOBoundaryFaces, NULL, &size, NULL,
-                       kCCMIOStart, kCCMIOEnd);
-        faces.resize(size);
-        CCMIOReadFaces(&err, id, kCCMIOBoundaryFaces, &mapID, NULL, &faces[0],
-                       kCCMIOStart, kCCMIOEnd);
-        CCMIOReadFaceCells(&err, id, kCCMIOBoundaryFaces, &faceCells[0],
-                           kCCMIOStart, kCCMIOEnd);
-        CCMIOReadMap(&err, mapID, &mapData[0], kCCMIOStart, kCCMIOEnd);
-
-        // If the optional ProstarFaceId is there, read it
-        if (CCMIOReadOpt1i(NULL, id, "ProstarFaceId", NULL,
-                           kCCMIOStart, kCCMIOEnd) == kCCMIONoErr)
-        {
-            prostarIDs.resize(nFaces);
-            CCMIOReadOpt1i(NULL, id, "ProstarFaceId", &prostarIDs[0],
-                           kCCMIOStart, kCCMIOEnd);
-        }
-    
-        CCMIOGetEntityIndex(&err, id, &boundaryVal);
-        cout << "\t" << nFaces << " boundary faces (boundary " << boundaryVal
-             << ")" << endl;
-        unsigned int pos = 0;
-        j = 0;
-        while (pos < faces.size())
-        {
-            PrintData(j, mapData[j], kBoundaryFace, &faces[pos],
-                      &faceCells[j]);
-            j++;
-            pos += faces[pos] + 1;
-        }
-        CheckError(err, "Error reading boundary faces");
-    }
-}
-
-void ReadVertices( CCMIOError &err, CCMIOID &vertices, char const *counter,
-                   int offset )
-{
-    int dims = 1;
-    unsigned int i, nVertices, size;
-    float scale;
-    int mapData[kNValues] = { 0 };
-    float verts[3 * kNValues] = { 0 };
-    CCMIOID mapID;
-
-    // Read the vertices.  This involves reading both the vertex data and
-    // the map, which maps the index into the data array with the ID number.
-    // As we process the vertices we need to be sure to scale them by the
-    // appropriate scaling factor.  The offset is just to show you can read
-    // any chunk.  Normally this would be in a for loop.
-    CCMIOEntitySize(&err, vertices, &nVertices, NULL);
-    CCMIOReadVerticesf(&err, vertices, &dims, &scale, &mapID, verts,
-                       offset, offset + kNValues);
-    CCMIOReadMap(&err, mapID, mapData, offset, offset + kNValues);
-
-    CCMIOEntityDescription(&err, vertices, &size, NULL);
-    char *label = new char[size + 1];
-    CCMIOEntityDescription(&err, vertices, NULL, label);
-    cout << "label: '" << label << "'" << endl;
-    delete [] label;
-
-    cout << "\t" << nVertices << " " << counter << endl;
-    if (nVertices > (unsigned int)kNValues)
-        nVertices = kNValues;
-    for (i = 0;  i < nVertices && err == kCCMIONoErr;  ++i)
-    {
-        verts[dims * i    ] *= scale;
-        verts[dims * i + 1] *= scale;
-        verts[dims * i + 2] *= scale;   // This example assumes three
-                                        // dimensional vertices.
-        PrintData(i, mapData[i], kVertex, &verts[dims * i]);
-    }
-    cout << "\t\t..." << endl;
-    CheckError(err, "Error reading vertices");
-}
-
-void ReadSolverInfo( CCMIOError &err, CCMIOID &solution)
-{
-    char solver[kCCMIOMaxStringLength+1], timeUnits[kCCMIOMaxStringLength+1];
-    int iterations;
-    float time, angle;
-    CCMIOID restart;
-
-    if (CCMIOGetEntity(NULL, solution, kCCMIORestart, 0, &restart)!=kCCMIONoErr)
-    {
-        cout << "(No solver information)" << endl;
-        return;
-    }
-
-    CCMIOReadRestartInfo(&err, restart, solver, &iterations, &time, timeUnits,
-                         &angle);
-    cout << "The following post data is the result of iteration "
-         << iterations << " (time: " << time << " " << timeUnits
-         << ")" << endl;
-    cout << "of solver '" << solver << "':" << endl;
-
-    // You might want to read more solver data here, in which case, do
-    // CCMIOGetEntity(&err, restart, kCCMIORestartData, 0, &restartData);
-    // and proceed to read the information.  Do likewise if you want to read
-    // the reference data.
-}
-
-void ReadPost( CCMIOError &err, CCMIOID &solution )
-{
-    bool oldFile = false;
-    char name[kCCMIOMaxStringLength + 1];
-    int h = 0, i = 0, dimSizes[] = { 0, 1, 3, 9 };
-    CCMIOID field, phase;
-    CCMIODimensionality dims;
-    vector<int> mapData;
-    vector<float> data;
-
-    oldFile = (CCMIONextEntity(NULL, solution, kCCMIOFieldPhase, &h, &phase)
-                                                                != kCCMIONoErr);
-    h = 0;
-    while (oldFile ||
-           CCMIONextEntity(NULL, solution, kCCMIOFieldPhase, &h, &phase)
-                                                                == kCCMIONoErr)
-    {
-        if (oldFile)
-            phase = solution;
-        else
-        {
-            int phaseNum = 0;
-            CCMIOGetEntityIndex(NULL, phase, &phaseNum);
-            cout << "Phase " << phaseNum << endl;
-        }
-        // Walk through each field in this field set (i.e. the post data)
-        // and print out each one.
-        while (CCMIONextEntity(NULL, phase, kCCMIOField, &i, &field)
-                                                                == kCCMIONoErr)
-        {
-            // Read the information about the field so that we know how to
-            // process this field.
-            char shortName[kCCMIOProstarShortNameLength+1], *units = NULL;
-            int usize;
-            CCMIODataType datatype;
-            CCMIOReadField(&err, field, name, shortName, &dims, &datatype);
-            if (CCMIOReadOptstr(NULL, field, kUnitsName, &usize, NULL)
-                                                                 == kCCMIONoErr)
-            {
-                units = new char[usize + 1];
-                CCMIOReadOptstr(&err, field, kUnitsName, NULL, units);
-            }
-            cout << "\tPost field '" << name << "'  (" << shortName << "):\t(";
-            if (dims == 1)    // datatype is not meaningful for vectors/tensors
-            {
-                if (datatype == kCCMIOFloat32)
-                    cout << "Float32";
-                else if (datatype == kCCMIOFloat64)
-                    cout << "Float64";
-                else if (datatype == kCCMIOInt32)
-                    cout << "Int32";
-                else
-                    cout << "Invalid datatype";
-            }
-            cout << ")\tUnits: " << ((units) ? units : "<none>") << endl;
-            delete [] units;
-            
-            switch (dims)
-            {
-                case kCCMIOScalar:
-                    {
-                    ReadScalar(err, field, mapData, data);
-                    for (unsigned int k = 0;  k < data.size();  ++k)
-                        PrintData(k, mapData[i], kScalar, &data[k]); 
-                    }
-                    break;
-                case kCCMIOVector:
-                    {
-                    vector<float> u, v, w;
-                    CCMIOID scalar;
-                    CCMIOReadMultiDimensionalFieldData(&err, field,
-                                                       kCCMIOVectorX, &scalar);
-                    if (err == kCCMIOVersionErr)
-                    {
-                        // If we are reading an older version of the file,
-                        // where vectors are stored as vectors, not components,
-                        // we need to call CCMIOReadFieldData*(), which is
-                        // all that ReadScalar() does.
-                        err = kCCMIONoErr;
-                        ReadScalar(err, field, mapData, data, true);
-                        unsigned int const size = data.size() / dimSizes[dims];
-                        for (unsigned int k = 0;  k < size;  ++k)
-                            PrintData(k, mapData[i], kVector,
-                                  &data[dimSizes[dims] * k]);
-                    }
-                    else
-                    {
-                        ReadScalar(err, scalar, mapData, u);
-                        CCMIOReadMultiDimensionalFieldData(&err, field,
-                                                           kCCMIOVectorY,
-                                                           &scalar);
-                        ReadScalar(err, scalar, mapData, v);
-                        CCMIOReadMultiDimensionalFieldData(&err, field,
-                                                           kCCMIOVectorZ,
-                                                           &scalar);
-                        ReadScalar(err, scalar, mapData, w);
-                        data.resize(3 * u.size());
-                        for (unsigned int k = 0;  k < u.size();  ++k)
-                        {
-                            data[3 * k    ] = u[k];
-                            data[3 * k + 1] = v[k];
-                            data[3 * k + 2] = w[k];
-                        }
-                        for (unsigned int k = 0;  k < u.size();  ++k)
-                            PrintData(k, mapData[i], kVector,
-                                      &data[dimSizes[dims] * k]);
-                    }
-                    }
-                    break;
-                case kCCMIOTensor:
-                    cout << "Tensor data not supported.  Ignoring field "
-                         << name << "." << endl;
-                    continue;
-            }
-            CheckError(err, "Error reading post data");
-        }
-        oldFile = false;
-    }
-}
-
-void ReadScalar( CCMIOError &err, CCMIOID field,
-                 vector<int> &mapData, vector<float> &data,
-                 bool readingVector /* = false */)
-{
-    CCMIOSize n;
-    CCMIOIndex max;
-    int j = 0;
-    CCMIOID fieldData, mapID;
-    CCMIODataLocation type;
-
-    // Read each piece of field data
-    while (CCMIONextEntity(NULL, field, kCCMIOFieldData, &j, &fieldData)
-                                                                 == kCCMIONoErr)
-    {
-        // Figure out how big this data is so we can read it. If we were
-        // storing this information permanently we might use a sparse
-        // array, in which case we would need to find the maximum ID and
-        // make the array that size.
-        CCMIOEntitySize(&err, fieldData, &n, &max);
-        mapData.resize(n);
-        CCMIOReadFieldDataf(&err, fieldData, &mapID, &type, NULL,
-                            kCCMIOStart, kCCMIOEnd);
-        CCMIOReadMap(&err, mapID, &mapData[0], kCCMIOStart, kCCMIOEnd);
-
-        // We are only going to process cell data.  Vertex data would
-        // be processed similarly. If your appliation has only one value
-        // for boundary data, you would separate the face data into
-        // each boundary and combine it together.  If your application
-        // stores boundary data on each face you could read it in using
-        // similar procedures for the cell and vertex data.  Note that
-        // the file may not contain all types of data.
-        if (type == kCCMIOCell)
-        {
-            if (readingVector)
-                data.resize(3 * n);
-            else
-                data.resize(n);
-            // If we want double precision we should use
-            // CCMIOReadFieldDatad().
-            CCMIOReadFieldDataf(&err, fieldData, &mapID, NULL,
-                                &data[0], kCCMIOStart, kCCMIOEnd);
-        }
-
-        CheckError(err, "Error reading post data");
-    }
-}
-
-void ReadSets( CCMIOError &err, CCMIOID &problem )
-{
-    int nChars;
-        
-    if (CCMIOReadOptstr(NULL, problem, "MonitoringSets", &nChars, NULL) == kCCMIONoErr)
-    {
-        char *setStr = new char[nChars + 1];
-        char setNames[][16] = { "CellSet", "VertexSet", "BoundarySet",
-                                "BlockSet", "SplineSet", "CoupleSet" };
-        int i = 0, j, len, size;
-        unsigned int flags;
-        string name;
-        CCMIOID setID;
-            
-        cout << "Monitoring prostar sets:" << endl;
-
-        // See the CCM specification for official documentation of this node.
-        // The format is "<size of string> string <size of string> string ..."
-        // The size of the string is one (binary) character.
-        CCMIOReadOptstr(&err, problem, "MonitoringSets", NULL, setStr);
-        while (i < nChars)
-        {
-            j = 0;
-            len = setStr[i++];  // First character is the length
-            name.clear();
-            for (j = 0;  j < len;  ++j)  // Then the string (no C-style \0)
-                name.push_back(setStr[i++]);
-            CCMIOGetProstarSet(&err, problem, name.c_str(), &size, NULL,
-                               NULL, NULL);
-            char *longName = new char[size + 1];
-            CCMIOGetProstarSet(&err, problem, name.c_str(), NULL, longName,
-                               &flags, &setID);
-            cout << "\t" << name << " (" << longName << "):" << endl;
-            delete [] longName;
-
-            // Read each set that is available and print it out.
-            // There is no need to loop through the nodes if you know which
-            // set you want;  just check 'flags' to see if the node is there
-            // (or just access the node and check for an error).
-            int n = 0;
-            for (unsigned int s = 1;  s <= kCCMIOCoupleSet;  s = s << 1)
-            {
-                if (flags & s)
-                {
-                    int *theSet;
-                    unsigned int size;
-                    CCMIOGetOptInfo(&err, setID, setNames[n], NULL,
-                                    &size, NULL, NULL);
-                    theSet = new int[size];
-                    CCMIOReadOpt1i(&err, setID, setNames[n], theSet,
-                                   kCCMIOStart, kCCMIOEnd);
-
-                    // Print out the set
-                    cout << "\t\t" << setNames[n] << ":  ";
-                    for (unsigned int idx = 0;  idx < size;  ++idx)
-                        cout << theSet[idx] << "  ";
-                    cout << endl;
-                    delete [] theSet;
-                }
-                n++;
-            }
-        }
-
-        delete [] setStr;
-    }
-    else
-        cout << "No prostar sets selected for monitoring" << endl;
-    CheckError(err, "Error reading prostar sets");
-}
-//--------------------------- Helper functions --------------------------------
-void CheckError( CCMIOError const &err, char const *str )
-{
-    if (err == kCCMIONoErr)
-        return;
-
-    cout << str << " (error " << err << ")" << endl;
-    exit(1);
-}
-
-void PrintData( int n, int id, DataType type, void *data, void *data2 /*=NULL*/ )
-{
-    if (n > kNValues)
-        return;
-    if (n == kNValues)
-    {
-        cout << "\t\t..." << endl;
-        return;
-    }
-
-    switch (type)
-    {
-        case kScalar:
-            cout << "\t\t" << *(float *)data << endl;
-            break;
-        case kVector:
-            cout << "\t\t(" << ((float *)data)[0] << ", "
-                 << ((float *)data)[1] << ", " << ((float *)data)[2] << ")"
-                 << endl;
-            break;
-        case kVertex:
-            cout << "\t\t" << "Vertex " << id << ":  ("
-                 << ((float *)data)[0] << ", "
-                 << ((float *)data)[1] << ", "
-                 << ((float *)data)[2] << ")" << endl;
-            break;
-        case kCell:
-            cout << "\t\t" << "Cell " << id << ":  type " << *(int *)data
-                 << endl;
-            break;
-        case kInternalFace:
-            {
-                int nVerts = *(int *)data;
-                cout << "\t\t" << "Face " << id << ": \tCells: "
-                     << ((int *)data2)[0] << ", " << ((int *)data2)[1]
-                     << "\tVertices: ";
-                for (int i = 0;  i < nVerts;  ++i)
-                    cout << *(((int *)data) + 1 + i) << " ";
-                cout << endl;
-            }
-            break;
-        case kBoundaryFace:
-            {
-                int nVerts = *(int *)data;
-                cout << "\t\t" << "Face " << id << ": \tCell: "
-                     << *(int *)data2 << "\tVertices: ";
-                for (int i = 0;  i < nVerts;  ++i)
-                    cout << *(((int *)data) + 1 + i) << " ";
-                cout << endl;
-            }
-            break;
-        case kBoundaryData:
-            cout << "\t\tBoundary " << *(int *)data << "  priority "
-                 << *(int *)data2 << endl;
-            break;
-        case kBoundaryFaceData:
-            {
-                cout << "\t\tBoundary data [ ";
-                for (int i = 0;  i < *(int *)data2; ++i)
-                    cout << ((float *)data)[i] << " ";
-                cout << "]" << endl;
-            }
-            break;
-        case kCellType:
-            cout << "Cell type " << id << ":  " << (char *)data << endl;
-            break;
-    }
-}
-

Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00005.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00005.html deleted file mode 100644 index 4582e8abf2..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00005.html +++ /dev/null @@ -1,357 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

writeexample.cpp

A self-contained example that writes a mesh and post data. -

-

#include "ccmio.h"
-#include "ccmioutility.h"
-#include <vector>
-#include <iostream>
-#include <algorithm>  // for min()
-
-// If you are unfamiliar with the Standard Template Library (STL), please read.
-//   vector:    A dynamic array.  vector<int> is an array of ints.  Suppose
-//              we have vector<int> iarr;
-//                  iarr.push_back( ... ); adds an item to the end of the
-//                                         array, resizing if necessary.
-//                  iarr.size();           Returns the number of items.
-//                  iarr[10];              The 11th item in the array.
-//                                         No bounds checking is performed.
-//                  iarr.resize(10);       Makes the array 10 items long.
-
-using namespace std;
-
-struct Face {
-    int nVerts;
-    int vertices[4];
-    int cells[2];
-};
-static int const nCells = 8;
-int cells[] = { 1, 1, 1, 2, 1, 1, 1, 1 };
-static int const nInternalFaces = 12;
-Face internalFaces[] = { { 4, {2, 5, 14, 11}, {2, 1} },
-                         { 4, {4, 5, 14, 13}, {1, 3} },
-                         { 4, {5, 6, 15, 14}, {2, 4} },
-                         { 4, {5, 8, 17, 14}, {4, 3} },
-                         { 4, {10, 11, 14, 13}, {5, 1} },
-                         { 4, {11, 12, 15, 14}, {6, 2} },
-                         { 4, {11, 14, 23, 20}, {6, 5} },
-                         { 4, {13, 14, 17, 16}, {7, 3} },
-                         { 4, {13, 14, 23, 22}, {5, 7} },
-                         { 4, {14, 15, 18, 17}, {8, 4} },
-                         { 4, {14, 15, 24, 23}, {6, 8} },
-                         { 4, {14, 17, 26, 23}, {8, 7} } };
-
-static int const nBoundaryFaces = 24;
-Face boundaryFaces[] = { { 4, {1, 2, 5, 4}, {1, 0} },
-                         { 4, {1, 10, 11, 2}, {1, 0} },
-                         { 4, {1, 4, 13, 10}, {1, 0} },
-                         { 4, {2, 3, 6, 5}, {2, 0} },
-                         { 4, {2, 11, 12, 3}, {2, 0} },
-                         { 4, {3, 12, 15, 6}, {2, 0} },
-                         { 4, {4, 5, 8, 7}, {3, 0} },
-                         { 4, {4, 7, 16, 13}, {3, 0} },
-                         { 4, {5, 6, 9, 8}, {4, 0} },
-                         { 4, {6, 15, 18, 9}, {4, 0} },
-                         { 4, {7, 8, 17, 16}, {3, 0} },
-                         { 4, {8, 9, 18, 17}, {4, 0} },
-                         { 4, {10, 19, 20, 11}, {5, 0} },
-                         { 4, {10, 13, 22, 19}, {5, 0} },
-                         { 4, {11, 20, 21, 12}, {6, 0} },
-                         { 4, {12, 21, 24, 15}, {6, 0} },
-                         { 4, {13, 16, 25, 22}, {7, 0} },
-                         { 4, {15, 24, 27, 18}, {8, 0} },
-                         { 4, {16, 17, 26, 25}, {7, 0} },
-                         { 4, {17, 18, 27, 26}, {8, 0} },
-                         { 4, {19, 22, 23, 20}, {5, 0} },
-                         { 4, {20, 23, 24, 21}, {6, 0} },
-                         { 4, {22, 25, 26, 23}, {7, 0} },
-                         { 4, {23, 26, 27, 24}, {8, 0} } };
-int nVertices = 27;
-float vertices[] = { 0, 0, 0, 0, 0.5, 0, 0, 1, 0, 0.5, 0, 0, 0.5, 0.5, 0, 0.5, 1, 0, 1, 0, 0, 1, 0.5, 0, 1, 1, 0, 0, 0, 0.5, 0, 0.5, 0.5, 0, 1, 0.5, 0.5, 0, 0.5, 0.5, 0.5, 0.5, 0.5, 1, 0.5, 1, 0, 0.5, 1, 0.5, 0.5, 1, 1, 0.5, 0, 0, 1, 0, 0.5, 1, 0, 1, 1, 0.5, 0, 1, 0.5, 0.5, 1, 0.5, 1, 1, 1, 0, 1, 1, 0.5, 1, 1, 1, 1 };
-int mapData[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 };
-
-float postData[] = { 100.0, 100.0, 100.0, 200.0, 100.0, 100.0, 100.0, 100.0 };
-
-static int nDroplets = 8;
-float positions[] = { 0, 0, 0,  1, 0, 0,  0, 1, 0,  0, 0, 1,  0, 1, 1,  1, 0, 1,
-                      1, 1, 0,  1, 1, 1 };
-int types[] = { 1, 1, 2, 1, 2, 1, 2, 2 };
-
-static char const kStateName[] = "default";
-static char const kDataName[] = "Temperature";
-static char const kShortDataName[] = "Temp";
-static char const kUnitsName[] = "Units";
-static int const kInc = 10;
-
-int main( int argc, char *argv[] )
-{
-    int i = 0;
-    CCMIOID stateID, processorID, rootID, verticesID, topologyID, solutionID;
-    CCMIOID mapID;
-    CCMIOID id, cellMapID;
-    CCMIOError error = kCCMIONoErr, *err = &error;
-
-    if (argc < 2)
-    {
-        cout << "Usage:  " << argv[0] << " outputFile" << endl;
-        return(0);
-    }
-
-    CCMIOOpenFile(err, argv[1], kCCMIOWrite, &rootID);
-
-    // Create a new state (or re-use an existing one).  If you want to
-    // re-use the problem description, check if there is a state first,
-    // because CCMIONewState() may destroy it:
-    //     if (CCMIOGetState(NULL, rootID, kStateName, &stateID) != kCCMIONoErr)
-    //         CCMIONewState(err, rootID, kStateName, NULL, &stateID);
-    CCMIONewState(err, rootID, kStateName, NULL, NULL, &stateID);
-
-    // Attempt to find the first processor (i has already been initialized to 0)
-    // If this was not a brand-new state, then we should reuse this processor
-    // (if we just create a processor, we will have more than one processor,
-    // and one of them will no longer be meaningful).  If we were writing
-    // a multiprocessor mesh we should loop through all the processors, delete
-    // them, and then create however many processors we need.
-    // Note that we pass NULL for the error because it is not an error for
-    // us if there is not a processor;  it just means that we need to create
-    // one.  If we pass in 'err' then all the rest of the functions will
-    // needlessly fail because we encountered an expected error.
-    if (CCMIONextEntity(NULL, stateID, kCCMIOProcessor, &i, &processorID) != kCCMIONoErr)
-        CCMIONewEntity(err, stateID, kCCMIOProcessor, NULL, &processorID);
-
-    // Get rid of any data that may be in this processor (if the state was
-    // not new).
-    CCMIOClearProcessor(err, stateID, processorID, TRUE, TRUE, TRUE, TRUE,
-                        TRUE);
-
-    // Write the vertices (the vertices are in Fortran order, so we need to
-    // make sure we specify that).  First we will need to create the mapping
-    // from the index in the data array to the vertex ID.  Then we can write
-    // the actual data.
-    CCMIONewEntity(err, rootID, kCCMIOMap, "Vertex map", &mapID);
-    CCMIOWriteMap(err, mapID, nVertices, mapData[nVertices], mapData,
-                  kCCMIOStart, kCCMIOEnd);
-    CCMIONewEntity(err, rootID, kCCMIOVertices, "Vertices", &verticesID);
-    // Write the vertices piecemeal by way of illustration
-    for (i = 0;  i < nVertices;  i += kInc)
-        CCMIOWriteVerticesf(err, verticesID, 3, 1.0, mapID, vertices + 3 * i,
-                            i, i + kInc);
-
-    // Write the cells
-    CCMIONewEntity(err, rootID, kCCMIOMap, "Cell map", &cellMapID);
-    CCMIOWriteMap(err, cellMapID, nCells, mapData[nVertices], mapData,
-                  kCCMIOStart, kCCMIOEnd);
-    CCMIONewEntity(err, rootID, kCCMIOTopology, "Topology", &topologyID);
-    CCMIONewEntity(err, topologyID, kCCMIOCells, "Cells", &id);
-    for (i = 0;  i < nCells;  i += 3)
-        CCMIOWriteCells(err, id, cellMapID, cells + i, i, i + 3);
-
-    // Write the faces.  There are two kinds of faces, internal faces and
-    // boundary faces.  The procedure is the same for each except that
-    // internal faces' cell array is a two dimensional array because internal
-    // faces have a cell on both sides.  Boundary faces, obviously, only
-    // have one cell.
-    vector<int> v, c;
-
-    CCMIONewEntity(err, rootID, kCCMIOMap, NULL, &mapID);
-    CCMIOWriteMap(err, mapID, nInternalFaces,
-                mapData[nBoundaryFaces + nInternalFaces],
-                &mapData[nBoundaryFaces], kCCMIOStart, kCCMIOEnd);
-    CCMIONewEntity(err, topologyID, kCCMIOInternalFaces, "Internal faces", &id);
-    for (int f = 0;  f < nInternalFaces;  ++f)
-    {
-        v.push_back(internalFaces[f].nVerts);
-        for (int i = 0;  i < internalFaces[f].nVerts;  ++i)
-            v.push_back(internalFaces[f].vertices[i]);
-        c.push_back(internalFaces[f].cells[0]);
-        c.push_back(internalFaces[f].cells[1]);  // Our other cell
-    }
-    CCMIOWriteFaces(err, id, kCCMIOInternalFaces, mapID, v.size(), &v[0],
-                    kCCMIOStart, kCCMIOEnd);
-    CCMIOWriteFaceCells(err, id, kCCMIOInternalFaces, mapID, &c[0], kCCMIOStart,
-                        kCCMIOEnd);
-        
-    v.clear();
-    c.clear();
-    CCMIONewEntity(err, rootID, kCCMIOMap, NULL, &mapID);
-    CCMIOWriteMap(err, mapID, nBoundaryFaces, mapData[nBoundaryFaces], mapData,
-                  kCCMIOStart, kCCMIOEnd);
-    CCMIONewIndexedEntity(err, topologyID, kCCMIOBoundaryFaces, 0,
-                          "Boundary faces", &id);
-    for (int f = 0;  f < nBoundaryFaces;  ++f)
-    {
-        v.push_back(boundaryFaces[f].nVerts);
-        for (int i = 0;  i < boundaryFaces[f].nVerts;  ++i)
-            v.push_back(boundaryFaces[f].vertices[i]);
-        c.push_back(boundaryFaces[f].cells[0]);
-        // Boundary faces only have one cell, so cells[1] is unused.
-    }
-    CCMIOWriteFaces(err, id, kCCMIOBoundaryFaces, mapID, v.size(), &v[0],
-                    kCCMIOStart, kCCMIOEnd);
-    CCMIOWriteFaceCells(err, id, kCCMIOBoundaryFaces, mapID, &c[0], kCCMIOStart,
-                        kCCMIOEnd);
-
-    // Write any prostar sets that we are using (this is optional)
-    int set1[] = { 1, 2, 3, 4 }, set2[] = {2, 4, 6, 8};
-    int vset[] = { 2, 3, 5, 7, 11, 13,15, 17, 19, 23};
-    char shortName[] = "half";
-    char longName[] = "Supercalifragilisticexpialidocious";
-    char truncatedName[] = "SetWithAReallyLongNameThatWillGetTruncated";
-    vector<string> setNames;
-    CCMIOID setID;
-    CCMIONewProstarSet(err, id, shortName, shortName, &setID);
-    CCMIOWriteOpt1i(err, setID, "CellSet", 4, set1, kCCMIOStart, kCCMIOEnd);
-    CCMIOWriteOpt1i(err, setID, "VertexSet", 10, vset, kCCMIOStart, kCCMIOEnd);
-    setNames.push_back(shortName);
-    // The name of the next set is more than 32 characters long.  
-    CCMIONewProstarSet(err, id, longName, longName, &setID);
-    CCMIOWriteOpt1i(err, setID, "SplineSet", 4, set2, kCCMIOStart, kCCMIOEnd);
-    setNames.push_back(longName);
-    // But we don't need to specify a long name if we don't want to.
-    CCMIONewProstarSet(err, id, truncatedName, NULL, &setID);
-    CCMIOWriteOpt1i(err, setID, "BoundarySet", 4, set2, kCCMIOStart, kCCMIOEnd);
-    setNames.push_back(truncatedName);
-
-    // Now make a string for the monitoring set node later on
-    vector<char> setStr;
-    vector<string>::iterator sit;
-    for (sit = setNames.begin();  sit != setNames.end();  ++sit)
-    {
-        int i = 0, size = sit->size();
-        if (size == 0)  // A size of zero will be a premature end-of-string
-            continue;
-
-        setStr.push_back(min(kCCMIOMaxStringLength, size));
-        while (i < size && i < kCCMIOMaxStringLength)
-            setStr.push_back((*sit)[i++]);
-    }
-    setStr.push_back('\0');  // End the C string
-
-    // Write out a dummy problem description.  If we happen to know that
-    // there already is a problem description previously recorded that
-    // is valid we could skip this step.
-    CCMIOID problem, constants;
-
-    CCMIONewEntity(err, rootID, kCCMIOProblemDescription, "Dummy description",
-                 &problem);
-    CCMIONewIndexedEntity(err, problem, kCCMIOCellType, 1, "Dummy celltypes", &id);
-    CCMIOWriteOptstr(err, id, "MaterialType", "solid");
-    CCMIONewIndexedEntity(err, problem, kCCMIOCellType, 2, "Dummy celltypes", &id);
-    CCMIOWriteOptstr(err, id, "MaterialType", "solid");
-    
-    CCMIONewEntity(err, problem, kCCMIOModelConstants, "Constant values",
-                   &constants);
-    CCMIOWriteOptf(err, constants, "Gravity", 9.82);
-    CCMIOWriteOptf(err, constants, "B.P. of water", 373);
-    CCMIOWriteOptstr(err, problem, "MonitoringSets", &setStr[0]);
-
-    // We have problem description recorded but our state does not know
-    // about it.  So tell the state that it has a problem description.
-    CCMIOWriteState(err, stateID, problem, "Example state");
-
-    // Write out some simple solution data
-    CCMIOID phase, field;
-    CCMIONewEntity(err, rootID, kCCMIOFieldSet, "Dummy post data", &solutionID);
-    CCMIONewIndexedEntity(err, solutionID, kCCMIOFieldPhase, 0, NULL, &phase);
-    CCMIONewField(err, phase, kDataName, kShortDataName, kCCMIOScalar, &field);
-    CCMIOWriteOptstr(err, field, kUnitsName, "°F");
-    CCMIONewEntity(err, field, kCCMIOFieldData, NULL, &id);
-    CCMIOWriteFieldDataf(err, id, cellMapID, kCCMIOCell, postData,
-                         kCCMIOStart, kCCMIOEnd);
-
-    // Write out a piece of vector data (which also illustrates constant data)
-    CCMIOID vectorField;
-    CCMIONewField(err, phase, "Velocity", "VELO", kCCMIOVector, &vectorField);
-
-    CCMIONewField(err, phase, "Velocity (U)", "U", kCCMIOScalar, &field);
-    CCMIOWriteOptstr(err, field, kUnitsName, "m/s");
-    CCMIONewEntity(err, field, kCCMIOFieldData, NULL, &id);
-    CCMIOWriteConstantFieldDataf(err, id, cellMapID, kCCMIOCell, 0.0);
-    CCMIOWriteMultiDimensionalFieldData(err, vectorField, kCCMIOVectorX, field);
-
-    CCMIONewField(err, phase, "Velocity (V)", "V", kCCMIOScalar, &field);
-    CCMIOWriteOptstr(err, field, kUnitsName, "m/s");
-    CCMIONewEntity(err, field, kCCMIOFieldData, NULL, &id);
-    CCMIOWriteConstantFieldDataf(err, id, cellMapID, kCCMIOCell, 1.0);
-    CCMIOWriteMultiDimensionalFieldData(err, vectorField, kCCMIOVectorY, field);
-
-    CCMIONewField(err, phase, "Velocity (W)", "W", kCCMIOScalar, &field);
-    CCMIOWriteOptstr(err, field, kUnitsName, "m/s");
-    CCMIONewEntity(err, field, kCCMIOFieldData, NULL, &id);
-    CCMIOWriteConstantFieldDataf(err, id, cellMapID, kCCMIOCell, 0.5);
-    CCMIOWriteMultiDimensionalFieldData(err, vectorField, kCCMIOVectorZ, field);
-
-    // Add in some sample restart info
-    int iteration = 0;
-    float time = 0.0, startAngle = 0.0;
-    CCMIOID restart, restartData;
-    CCMIONewEntity(err, solutionID, kCCMIORestart, NULL, &restart);
-    CCMIOWriteRestartInfo(err, restart, "writeexample", iteration, time, NULL,
-                          startAngle);
-    // The solver part can have anything the solver wants
-    CCMIONewEntity(err, restart, kCCMIORestartData, NULL, &restartData);
-    CCMIOWriteOptf(err, restartData, "Convergence", 100);
-
-    // Now we have the mesh (vertices and topology) and the post data written.
-    // Since we now have their IDs, we can write out the processor information.
-    CCMIOWriteProcessor(err, processorID, NULL, &verticesID, NULL, &topologyID,
-                      NULL, NULL, NULL, &solutionID);
-
-    // Write out some simple Lagrangian data
-    CCMIONewEntity(err, rootID, kCCMIOMap, "Positions map", &mapID);
-    CCMIOWriteMap(err, mapID, nDroplets, mapData[nDroplets], mapData,
-                  kCCMIOStart, kCCMIOEnd);
-    CCMIONewEntity(err, rootID, kCCMIOVertices, "Positions", &verticesID);
-    CCMIOWriteVerticesf(err, verticesID, 3, 1.0, mapID, positions,
-                        kCCMIOStart, kCCMIOEnd);
-
-    CCMIONewEntity(err, rootID, kCCMIOFieldSet, "Dummy Lagrangian post data",
-                   &solutionID);
-    CCMIONewIndexedEntity(err, solutionID, kCCMIOFieldPhase, 0, NULL, &phase);
-    CCMIONewField(err, phase, "Droplet type", "droplet", kCCMIOScalar, &field);
-    CCMIONewEntity(err, field, kCCMIOFieldData, NULL, &id);
-    CCMIOWriteOptstr(err, field, kUnitsName, "none");
-    CCMIOWriteFieldDatai(err, id, cellMapID, kCCMIOCell, types,
-                         kCCMIOStart, kCCMIOEnd);
-
-    CCMIOID lagrangian;
-    CCMIONewEntity(err, processorID, kCCMIOLagrangianData, NULL, &lagrangian);
-    CCMIOWriteLagrangianData(err, lagrangian, NULL, &verticesID,
-                             NULL, &solutionID);
-
-    CCMIOCloseFile(err, rootID);
-
-    if (*err != kCCMIONoErr)
-    {
-        cout << "Error " << *err << " writing mesh" << endl;
-        return(0);
-    }
-
-    // The CCMIO library uses ADF to store the actual data.  Unfortunately,
-    // ADF leaks disk space;  deleting a node does not recover all the disk
-    // space.  Now that everything is successfully written it might be useful
-    // to call CCMIOCompress() here to ensure that the file is as small as
-    // possible.  Please see the Core API documentation for caveats on its
-    // usage.
-    if (CCMIOCompress(NULL, argv[1]) != kCCMIONoErr)
-    {
-        cout << "Error compressing file.  Check that you have "
-             << "adequate disk space " << endl << "and that you have write "
-             << "permission to the current directory." << endl;
-        return(0);
-    }
-
-    return(1);
-}
-

Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00006.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00006.html deleted file mode 100644 index bb0ac8d364..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00006.html +++ /dev/null @@ -1,580 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

rewriteexample.cpp

A self-contained example that writes or overwrites a mesh and post data. Since calling CCMIOClearProcessor() causes the low-level ADF library on which libccmio is based to lose a certain amount of disk space, this example shows how to overwrite a .ccm file without losing disk space. However, the structure of the new file must exactly match the old file: no new or deleted nodes, and the data for the nodes is the same size. If the structure differs then the old structure will still remain in the file, causing readers to misread the file. If the nodes are not the same size, so disk space may still be lost. -

-

#include "ccmio.h"
-#include "ccmioutility.h"
-#include <vector>
-#include <iostream>
-#include <algorithm>  // for min()
-
-// If you are unfamiliar with the Standard Template Library (STL), please read.
-//   vector:    A dynamic array.  vector<int> is an array of ints.  Suppose
-//              we have vector<int> iarr;
-//                  iarr.push_back( ... ); adds an item to the end of the
-//                                         array, resizing if necessary.
-//                  iarr.size();           Returns the number of items.
-//                  iarr[10];              The 11th item in the array.
-//                                         No bounds checking is performed.
-//                  iarr.resize(10);       Makes the array 10 items long.
-
-using namespace std;
-
-struct Face {
-    int nVerts;
-    int vertices[4];
-    int cells[2];
-};
-static int const nCells = 8;
-int cells[] = { 1, 1, 1, 2, 1, 1, 1, 1 };
-static int const nInternalFaces = 12;
-Face internalFaces[] = { { 4, {2, 5, 14, 11}, {2, 1} },
-                         { 4, {4, 5, 14, 13}, {1, 3} },
-                         { 4, {5, 6, 15, 14}, {2, 4} },
-                         { 4, {5, 8, 17, 14}, {4, 3} },
-                         { 4, {10, 11, 14, 13}, {5, 1} },
-                         { 4, {11, 12, 15, 14}, {6, 2} },
-                         { 4, {11, 14, 23, 20}, {6, 5} },
-                         { 4, {13, 14, 17, 16}, {7, 3} },
-                         { 4, {13, 14, 23, 22}, {5, 7} },
-                         { 4, {14, 15, 18, 17}, {8, 4} },
-                         { 4, {14, 15, 24, 23}, {6, 8} },
-                         { 4, {14, 17, 26, 23}, {8, 7} } };
-
-static int const nBoundaryFaces = 24;
-Face boundaryFaces[] = { { 4, {1, 2, 5, 4}, {1, 0} },
-                         { 4, {1, 10, 11, 2}, {1, 0} },
-                         { 4, {1, 4, 13, 10}, {1, 0} },
-                         { 4, {2, 3, 6, 5}, {2, 0} },
-                         { 4, {2, 11, 12, 3}, {2, 0} },
-                         { 4, {3, 12, 15, 6}, {2, 0} },
-                         { 4, {4, 5, 8, 7}, {3, 0} },
-                         { 4, {4, 7, 16, 13}, {3, 0} },
-                         { 4, {5, 6, 9, 8}, {4, 0} },
-                         { 4, {6, 15, 18, 9}, {4, 0} },
-                         { 4, {7, 8, 17, 16}, {3, 0} },
-                         { 4, {8, 9, 18, 17}, {4, 0} },
-                         { 4, {10, 19, 20, 11}, {5, 0} },
-                         { 4, {10, 13, 22, 19}, {5, 0} },
-                         { 4, {11, 20, 21, 12}, {6, 0} },
-                         { 4, {12, 21, 24, 15}, {6, 0} },
-                         { 4, {13, 16, 25, 22}, {7, 0} },
-                         { 4, {15, 24, 27, 18}, {8, 0} },
-                         { 4, {16, 17, 26, 25}, {7, 0} },
-                         { 4, {17, 18, 27, 26}, {8, 0} },
-                         { 4, {19, 22, 23, 20}, {5, 0} },
-                         { 4, {20, 23, 24, 21}, {6, 0} },
-                         { 4, {22, 25, 26, 23}, {7, 0} },
-                         { 4, {23, 26, 27, 24}, {8, 0} } };
-int nVertices = 27;
-float vertices[] = { 0, 0, 0, 0, 0.5, 0, 0, 1, 0, 0.5, 0, 0, 0.5, 0.5, 0, 0.5, 1, 0, 1, 0, 0, 1, 0.5, 0, 1, 1, 0, 0, 0, 0.5, 0, 0.5, 0.5, 0, 1, 0.5, 0.5, 0, 0.5, 0.5, 0.5, 0.5, 0.5, 1, 0.5, 1, 0, 0.5, 1, 0.5, 0.5, 1, 1, 0.5, 0, 0, 1, 0, 0.5, 1, 0, 1, 1, 0.5, 0, 1, 0.5, 0.5, 1, 0.5, 1, 1, 1, 0, 1, 1, 0.5, 1, 1, 1, 1 };
-int mapData[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 };
-
-float postData[] = { 100.0, 100.0, 100.0, 200.0, 100.0, 100.0, 100.0, 100.0 };
-
-static int nDroplets = 8;
-float positions[] = { 0, 0, 0,  1, 0, 0,  0, 1, 0,  0, 0, 1,  0, 1, 1,  1, 0, 1,
-                      1, 1, 0,  1, 1, 1 };
-int types[] = { 1, 1, 2, 1, 2, 1, 2, 2 };
-
-static char const kStateName[] = "default";
-static char const kDataName[] = "Temperature";
-static char const kShortDataName[] = "Temp";
-static char const kUnitsName[] = "Units";
-static int const kInc = 10;
-
-bool HasSameDescription(CCMIOID entity, const char *desc);
-CCMIOError GetOrCreateEntity(CCMIOError *err, CCMIOID parent, CCMIOEntity which,
-                             const char *description, CCMIOID *id);
-CCMIOError GetOrCreateIndexedEntity(CCMIOError *err, CCMIOID parent,
-                                    CCMIOEntity which, int idx,
-                                    const char *description, CCMIOID *id);
-CCMIOError GetOrCreateField(CCMIOError *err, CCMIOID phase, const char *name,
-                            const char *description,
-                            CCMIODimensionality dim, CCMIOID *field);
-CCMIOError WriteMonolithicFieldData(CCMIOError *err, CCMIOID field,
-                                    CCMIOID mapID, CCMIODataType type,
-                                    void *postData, void *constData);
-CCMIOError WriteLagrangianPositions(CCMIOError *err, CCMIOID processorID,
-                                    CCMIOID *lagrangian,
-                                    CCMIOID *verticesID, CCMIOID *solutionID);
-
-int main( int argc, char *argv[] )
-{
-    int i;
-    CCMIOID stateID, processorID, rootID, verticesID, topologyID, solutionID;
-    CCMIOID mapID, problem;
-    CCMIOID id, cellMapID;
-    CCMIOError error = kCCMIONoErr, *err = &error;
-
-    if (argc < 2)
-    {
-        cout << "Usage:  " << argv[0] << " outputFile" << endl;
-        return(0);
-    }
-
-    CCMIOOpenFile(err, argv[1], kCCMIOWrite, &rootID);
-
-    // Create a new state (or re-use an existing one).
-    if (CCMIOGetState(err, rootID, kStateName, &problem, &stateID) == kCCMIONoNodeErr)
-    {
-        *err = kCCMIONoErr;
-        CCMIONewState(err, rootID, kStateName, NULL, NULL, &stateID);
-    }
-
-    // Attempt to find the first processor.  If we find it, re-use it, otherwise
-    // create one.  Multiprocessor meshes will obviously need to do this
-    // multiple times...
-    // Note that we pass NULL for the error because it is not an error for
-    // us if there is not a processor;  it just means that we need to create
-    // one.  If we pass in 'err' then all the rest of the functions will
-    // needlessly fail because we encountered an expected error.
-    i = 0;
-    while (CCMIONextEntity(NULL, stateID, kCCMIOProcessor, &i, &processorID)
-                                                                == kCCMIONoErr)
-        if (HasSameDescription(processorID, "CPU 1"))
-            break;
-    
-    if (CCMIOIsValidEntity(processorID))  // Won't be if we didn't find one
-        CCMIOReadProcessor(err, processorID, &verticesID, &topologyID, NULL,
-                           &solutionID);
-    else
-    {
-        CCMIONewEntity(err, stateID, kCCMIOProcessor, "CPU 1", &processorID);
-        // Initialize the processor's sub-nodes to be invalid;  if they
-        // are unitialized, checks below may fail.
-        CCMIOInvalidateEntity(&topologyID);
-        CCMIOInvalidateEntity(&verticesID);
-        CCMIOInvalidateEntity(&solutionID);
-
-        CCMIONewEntity(err, rootID, kCCMIOTopology, "Topology", &topologyID);
-    }
-
-    // Write the vertices.  First we will need to get (or create) the mapping
-    // from the index in the data array to the vertex ID.  Then we can write
-    // the actual data.
-    if (CCMIOIsValidEntity(verticesID))
-        CCMIOReadVerticesf(err, verticesID, NULL, NULL, &mapID, NULL, 0, 0);
-    else
-    {
-        CCMIONewEntity(err, rootID, kCCMIOMap, "Vertex map", &mapID);
-        CCMIONewEntity(err, rootID, kCCMIOVertices, "Vertices", &verticesID);
-    }
-
-    CCMIOWriteMap(err, mapID, nVertices, mapData[nVertices], mapData,
-                  kCCMIOStart, kCCMIOEnd);
-    // Write the vertices piecemeal by way of illustration
-    for (i = 0;  i < nVertices;  i += kInc)
-        CCMIOWriteVerticesf(err, verticesID, 3, 1.0, mapID, vertices + 3 * i,
-                            i, i + kInc);
-
-    // Write the cells
-    if (CCMIOGetEntity(err, topologyID, kCCMIOCells, 0, &id) == kCCMIONoNodeErr)
-    {
-        *err = kCCMIONoErr;
-        CCMIONewEntity(err, topologyID, kCCMIOCells, "Cells", &id);
-        CCMIONewEntity(err, rootID, kCCMIOMap, "Cell map", &cellMapID);
-    }
-    else
-        CCMIOReadCells(err, id, &cellMapID, NULL, 0, 0);
-
-    CCMIOWriteMap(err, cellMapID, nCells, mapData[nVertices], mapData,
-                  kCCMIOStart, kCCMIOEnd);
-    for (i = 0;  i < nCells;  i += 3)
-        CCMIOWriteCells(err, id, cellMapID, cells + i, i, i + 3);
-
-    // Write the faces.  There are two kinds of faces, internal faces and
-    // boundary faces.  The procedure is the same for each except that
-    // internal faces' cell array is a two dimensional array because internal
-    // faces have a cell on both sides.  Boundary faces, obviously, only
-    // have one cell.
-    vector<int> v, c;
-
-    if (CCMIOGetEntity(err, topologyID, kCCMIOInternalFaces, 0, &id) == kCCMIONoNodeErr)
-    {
-        *err = kCCMIONoErr;
-        CCMIONewEntity(err, rootID, kCCMIOMap, NULL, &mapID);
-        CCMIONewEntity(err, topologyID, kCCMIOInternalFaces, "Internal faces",
-                       &id);
-    }
-    else
-        CCMIOReadFaces(err, id, kCCMIOInternalFaces, &mapID, NULL, NULL, 0, 0);
-
-    CCMIOWriteMap(err, mapID, nInternalFaces,
-                mapData[nBoundaryFaces + nInternalFaces],
-                &mapData[nBoundaryFaces], kCCMIOStart, kCCMIOEnd);
-    for (int f = 0;  f < nInternalFaces;  ++f)
-    {
-        v.push_back(internalFaces[f].nVerts);
-        for (int i = 0;  i < internalFaces[f].nVerts;  ++i)
-            v.push_back(internalFaces[f].vertices[i]);
-        c.push_back(internalFaces[f].cells[0]);
-        c.push_back(internalFaces[f].cells[1]);  // Our other cell
-    }
-    CCMIOWriteFaces(err, id, kCCMIOInternalFaces, mapID, v.size(), &v[0],
-                    kCCMIOStart, kCCMIOEnd);
-    CCMIOWriteFaceCells(err, id, kCCMIOInternalFaces, mapID, &c[0], kCCMIOStart,
-                        kCCMIOEnd);
-        
-    // Write the boundary faces
-    if (CCMIOGetEntity(err, topologyID, kCCMIOBoundaryFaces, 0, &id) == kCCMIONoNodeErr)
-    {
-        *err = kCCMIONoErr;
-        CCMIONewEntity(err, rootID, kCCMIOMap, NULL, &mapID);
-        CCMIONewIndexedEntity(err, topologyID, kCCMIOBoundaryFaces, 0,
-                              "Boundary faces", &id);
-    }
-    else
-        CCMIOReadFaces(err, id, kCCMIOBoundaryFaces, &mapID, NULL, NULL, 0, 0);
-
-    v.clear();
-    c.clear();
-    CCMIOWriteMap(err, mapID, nBoundaryFaces, mapData[nBoundaryFaces], mapData,
-                  kCCMIOStart, kCCMIOEnd);
-    for (int f = 0;  f < nBoundaryFaces;  ++f)
-    {
-        v.push_back(boundaryFaces[f].nVerts);
-        for (int i = 0;  i < boundaryFaces[f].nVerts;  ++i)
-            v.push_back(boundaryFaces[f].vertices[i]);
-        c.push_back(boundaryFaces[f].cells[0]);
-        // Boundary faces only have one cell, so cells[1] is unused.
-    }
-    CCMIOWriteFaces(err, id, kCCMIOBoundaryFaces, mapID, v.size(), &v[0],
-                    kCCMIOStart, kCCMIOEnd);
-    CCMIOWriteFaceCells(err, id, kCCMIOBoundaryFaces, mapID, &c[0], kCCMIOStart,
-                        kCCMIOEnd);
-
-    // Write any prostar sets that we are using (this is optional)
-    int set1[] = { 1, 2, 3, 4 }, set2[] = {2, 4, 6, 8};
-    int vset[] = { 2, 3, 5, 7, 11, 13,15, 17, 19, 23};
-    char shortName[] = "half";
-    char longName[] = "Supercalifragilisticexpialidocious";
-    char truncatedName[] = "SetWithAReallyLongNameThatWillGetTruncated";
-    vector<string> setNames;
-    CCMIOID setID;
-    if (CCMIOGetProstarSet(err, id, shortName, NULL, NULL, NULL, &setID) == kCCMIONoNodeErr)
-    {
-        *err = kCCMIONoErr;
-        CCMIONewProstarSet(err, id, shortName, shortName, &setID);
-    }
-    CCMIOWriteOpt1i(err, setID, "CellSet", 4, set1, kCCMIOStart, kCCMIOEnd);
-    CCMIOWriteOpt1i(err, setID, "VertexSet", 10, vset, kCCMIOStart, kCCMIOEnd);
-    setNames.push_back(shortName);
-    // The name of the next set is more than 32 characters long.  
-    if (CCMIOGetProstarSet(err, id, longName, NULL, NULL, NULL, &setID) == kCCMIONoNodeErr)
-    {
-        *err = kCCMIONoErr;
-        CCMIONewProstarSet(err, id, longName, longName, &setID);
-    }
-    CCMIOWriteOpt1i(err, setID, "SplineSet", 4, set2, kCCMIOStart, kCCMIOEnd);
-    setNames.push_back(longName);
-    // But we don't need to specify a long name if we don't want to.
-    if (CCMIOGetProstarSet(err, id, truncatedName, NULL, NULL, NULL, &setID) == kCCMIONoNodeErr)
-    {
-        *err = kCCMIONoErr;
-        CCMIONewProstarSet(err, id, truncatedName, NULL, &setID);
-    }
-    CCMIOWriteOpt1i(err, setID, "BoundarySet", 4, set2, kCCMIOStart, kCCMIOEnd);
-    setNames.push_back(truncatedName);
-
-    // Now make a string for the monitoring set node later on
-    vector<char> setStr;
-    vector<string>::iterator sit;
-    for (sit = setNames.begin();  sit != setNames.end();  ++sit)
-    {
-        int i = 0, size = sit->size();
-        if (size == 0)  // A size of zero will be a premature end-of-string
-            continue;
-
-        setStr.push_back(min(kCCMIOMaxStringLength, size));
-        while (i < size && i < kCCMIOMaxStringLength)
-            setStr.push_back((*sit)[i++]);
-    }
-    setStr.push_back('\0');  // End the C string
-
-    // Write out a dummy problem description.  If we happen to know that
-    // there already is a problem description previously recorded that
-    // is valid we could skip this step.
-    CCMIOID constants;
-
-    if (!CCMIOIsValidEntity(problem))
-    {
-        *err = kCCMIONoErr;
-        CCMIONewEntity(err, rootID, kCCMIOProblemDescription,
-                       "Dummy description", &problem);
-    }
-    GetOrCreateEntity(err, problem, kCCMIOModelConstants, "Constant values",
-                      &constants);
-    GetOrCreateIndexedEntity(err, problem, kCCMIOCellType, 1, "Dummy celltypes",
-                             &id);
-    CCMIOWriteOptstr(err, id, "MaterialType", "solid");
-    GetOrCreateIndexedEntity(err, problem, kCCMIOCellType, 2, "Dummy celltypes",
-                             &id);
-    CCMIOWriteOptstr(err, id, "MaterialType", "solid");
-    
-    CCMIOWriteOptf(err, constants, "Gravity", 9.82);
-    CCMIOWriteOptf(err, constants, "B.P. of water", 373);
-    CCMIOWriteOptstr(err, problem, "MonitoringSets", &setStr[0]);
-
-    // We have a problem description recorded but our state does not know
-    // about it.  So tell the state that it has a problem description.
-    CCMIOWriteState(err, stateID, problem, "Example state");
-
-    // Write out some simple solution data
-    float zero = 0.0, one = 1.0, half = 0.5;
-    CCMIOID phase, field;
-    CCMIODimensionality dim;
-    if (!CCMIOIsValidEntity(solutionID))
-        CCMIONewEntity(err, rootID, kCCMIOFieldSet, "Dummy post data",
-                       &solutionID);
-    GetOrCreateIndexedEntity(err, solutionID, kCCMIOFieldPhase, 0, NULL,&phase);
-    if (CCMIOGetField(err, phase, kDataName, &dim, &field) == kCCMIONoNodeErr)
-    {
-        *err = kCCMIONoErr;
-        CCMIONewField(err, phase, kDataName, kShortDataName, kCCMIOScalar, &field);
-    }
-    CCMIOWriteOptstr(err, field, kUnitsName, "°F");
-    WriteMonolithicFieldData(err, field, cellMapID, kCCMIOFloat32,
-                             (void *)postData, NULL);
-
-    // Write out a piece of vector data (which also illustrates constant data)
-    CCMIOID vectorField;
-    GetOrCreateField(err, phase, "Velocity", "VELO", kCCMIOVector, &vectorField);
-
-    GetOrCreateField(err, phase, "Velocity (U)", "U", kCCMIOScalar, &field);
-    CCMIOWriteOptstr(err, field, kUnitsName, "m/s");
-    WriteMonolithicFieldData(err, field, cellMapID, kCCMIOFloat32,
-                             NULL, (void *)&zero);
-    CCMIOWriteMultiDimensionalFieldData(err, vectorField, kCCMIOVectorX, field);
-
-    GetOrCreateField(err, phase, "Velocity (V)", "V", kCCMIOScalar, &field);
-    CCMIOWriteOptstr(err, field, kUnitsName, "m/s");
-    WriteMonolithicFieldData(err, field, cellMapID, kCCMIOFloat32,
-                             NULL, (void *)&one);
-    CCMIOWriteMultiDimensionalFieldData(err, vectorField, kCCMIOVectorY, field);
-
-    GetOrCreateField(err, phase, "Velocity (W)", "W", kCCMIOScalar, &field);
-    CCMIOWriteOptstr(err, field, kUnitsName, "m/s");
-    WriteMonolithicFieldData(err, field, cellMapID, kCCMIOFloat32,
-                             NULL, (void *)&half);
-    CCMIOWriteMultiDimensionalFieldData(err, vectorField, kCCMIOVectorZ, field);
-
-    // Add in some sample restart info
-    int iteration = 0;
-    float time = 0.0, startAngle = 0.0;
-    CCMIOID restart, restartData;
-    GetOrCreateEntity(err, solutionID, kCCMIORestart, NULL, &restart);
-    CCMIOWriteRestartInfo(err, restart, "writeexample", iteration, time, NULL,
-                          startAngle);
-    // The solver part can have anything the solver wants
-    GetOrCreateEntity(err, restart, kCCMIORestartData, NULL, &restartData);
-    CCMIOWriteOptf(err, restartData, "Convergence", 100);
-
-    // Now we have the mesh (vertices and topology) and the post data written.
-    // Since we now have their IDs, we can write out the processor information.
-    CCMIOWriteProcessor(err, processorID, NULL, &verticesID, NULL, &topologyID,
-                      NULL, NULL, NULL, &solutionID);
-
-    // Write out some simple Lagrangian data
-    int nLagrangians = 0;
-    CCMIOID tmp, lagrangian;
-    i = 0;
-    while (CCMIONextEntity(NULL, processorID, kCCMIOLagrangianData, &i, &tmp) == kCCMIONoErr)
-    {
-        if (nLagrangians > 0)
-            printf("Too many Langrangians in this file; only expecting one.\n");
-        else
-        {
-            lagrangian = tmp;
-            WriteLagrangianPositions(err, processorID, &lagrangian,
-                                     &verticesID, &solutionID);
-        }
-        nLagrangians++;
-    }
-    if (nLagrangians == 0)
-    {
-        lagrangian = tmp;  // tmp was set to invalid by CCMIONextEntity
-        WriteLagrangianPositions(err, processorID, &lagrangian,
-                                 &verticesID, &solutionID);
-    }
-
-    GetOrCreateIndexedEntity(err, solutionID, kCCMIOFieldPhase, 0, NULL,&phase);
-    GetOrCreateField(err, phase, "Droplet type", "droplet", kCCMIOScalar,
-                     &field);
-    CCMIOWriteOptstr(err, field, kUnitsName, "none");
-    WriteMonolithicFieldData(err, field, cellMapID, kCCMIOInt32,
-                             (void *)types, NULL);
-
-    CCMIOWriteLagrangianData(err, lagrangian, NULL, &verticesID,
-                             NULL, &solutionID);
-
-    // We're done!
-    CCMIOCloseFile(err, rootID);
-
-    if (*err != kCCMIONoErr)
-    {
-        cout << "Error " << *err << " writing mesh" << endl;
-        return(0);
-    }
-
-    return(1);
-}
-
-bool HasSameDescription(CCMIOID entity, const char *desc)
-{
-    unsigned int size;
-    if (CCMIOEntityDescription(NULL, entity, &size, NULL) != kCCMIONoErr ||
-        size <= 0)
-        return(false);
-
-    bool eq = false;
-    char *str = new char[size + 1];
-    if (CCMIOEntityDescription(NULL, entity, &size, str) == kCCMIONoErr &&
-        strcmp(desc, str) == 0)
-            eq = true;
-
-    delete [] str;
-
-    return(eq);
-}
-
-CCMIOError GetOrCreateEntity(CCMIOError *err, CCMIOID parent, CCMIOEntity which,
-                             const char *description, CCMIOID *id)
-{
-    if (CCMIOGetEntity(err, parent, which, 0, id) == kCCMIONoNodeErr)
-    {
-        *err = kCCMIONoErr;
-        CCMIONewEntity(err, parent, which, description, id);
-    }
-    return(*err);
-}
-
-CCMIOError GetOrCreateIndexedEntity(CCMIOError *err, CCMIOID parent,
-                                    CCMIOEntity which, int idx,
-                                    const char *description, CCMIOID *id)
-{
-    if (CCMIOGetEntity(err, parent, which, idx, id) == kCCMIONoNodeErr)
-    {
-        *err = kCCMIONoErr;
-        CCMIONewIndexedEntity(err, parent, which, idx, description, id);
-    }
-    return(*err);
-}
-
-CCMIOError GetOrCreateField(CCMIOError *err, CCMIOID phase, const char *name,
-                            const char *description,
-                            CCMIODimensionality dim, CCMIOID *field)
-{
-    if (CCMIOGetField(err, phase, name, &dim, field) == kCCMIONoNodeErr)
-    {
-        *err = kCCMIONoErr;
-        CCMIONewField(err, phase, name, description, kCCMIOScalar,
-                      field);
-    }
-    return(*err);
-}
-
-CCMIOError WriteMonolithicFieldData(CCMIOError *err, CCMIOID field,
-                                    CCMIOID mapID, CCMIODataType type,
-                                    void *postData, void *constData)
-{
-    int n = 0, i = 0;
-    CCMIOID id, tmp;
-
-    // We need to be very careful here, because field data nodes are numbered,
-    // but we don't know which number is which.  CCMIONextEntity() will traverse
-    // them in the order that they were created.
-    if (CCMIONextEntity(NULL, field, kCCMIOFieldData, &i, &id) == kCCMIONoNodeErr)
-    {
-        CCMIONewEntity(err, field, kCCMIOFieldData, NULL, &id);
-        // Since we have a new node, the do-while loop will find it, so 
-        // send it past it.
-        while (CCMIONextEntity(NULL, field, kCCMIOFieldData, &i, &tmp) == kCCMIONoErr)
-            ;
-    }
-    do
-    {
-        if (n == 0)
-        {
-            if (postData)
-            {
-                if (type == kCCMIOFloat32)
-                    CCMIOWriteFieldDataf(err, id, mapID, kCCMIOCell,
-                                         (float *)postData,
-                                         kCCMIOStart, kCCMIOEnd);
-                else if (type == kCCMIOFloat64)
-                    CCMIOWriteFieldDatad(err, id, mapID, kCCMIOCell,
-                                         (double *)postData,
-                                         kCCMIOStart, kCCMIOEnd);
-                else if (type == kCCMIOInt32)
-                    CCMIOWriteFieldDatai(err, id, mapID, kCCMIOCell,
-                                         (int *)postData,
-                                         kCCMIOStart, kCCMIOEnd);
-                else
-                    cout << "Bad type" << endl;
-            }
-            else
-            {
-                if (type == kCCMIOFloat32)
-                    CCMIOWriteConstantFieldDataf(err, id, mapID, kCCMIOCell,
-                                                 *(float *)constData);
-                else if (type == kCCMIOFloat64)
-                    CCMIOWriteConstantFieldDatad(err, id, mapID, kCCMIOCell,
-                                                 *(double *)constData);
-                else if (type == kCCMIOInt32)
-                    CCMIOWriteConstantFieldDatai(err, id, mapID, kCCMIOCell,
-                                                 *(int *)constData);
-                else
-                    cout << "Bad type" << endl;
-            }
-        }
-        else
-            cout << "Too many field entities;  only expected one!" << endl;
-        n++;
-    } while(CCMIONextEntity(NULL, field, kCCMIOFieldData, &i, &id)
-                                                                == kCCMIONoErr);
-
-    return(*err);
-}
-
-
-CCMIOError WriteLagrangianPositions(CCMIOError *err, CCMIOID processorID,
-                                    CCMIOID *lagrangian,
-                                    CCMIOID *verticesID, CCMIOID *solutionID)
-{
-    CCMIOID mapID;
-
-    if (!CCMIOIsValidEntity(*lagrangian))
-        GetOrCreateEntity(err, processorID, kCCMIOLagrangianData, NULL,
-                          lagrangian);
-    CCMIOReadLagrangianData(NULL, *lagrangian, verticesID, solutionID);
-    if (!CCMIOIsValidEntity(*verticesID)) {
-        CCMIONewEntity(err, *lagrangian, kCCMIOVertices, "Positions",
-                       verticesID);
-        CCMIONewEntity(err, *lagrangian, kCCMIOMap, "Positions map", &mapID);
-    }
-    else
-        CCMIOReadVerticesf(err, *verticesID, NULL, NULL, &mapID, NULL, 0, 0);
-    if (!CCMIOIsValidEntity(*solutionID))
-        CCMIONewEntity(err, *lagrangian, kCCMIOFieldSet,
-                       "Dummy Lagrangian post data", solutionID);
-
-    CCMIOWriteMap(err, mapID, nDroplets, mapData[nDroplets], mapData,
-                  kCCMIOStart, kCCMIOEnd);
-    CCMIOWriteVerticesf(err, *verticesID, 3, 1.0, mapID, positions,
-                        kCCMIOStart, kCCMIOEnd);
-
-    return(*err);
-}
-

Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00007.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00007.html deleted file mode 100644 index ae238a7a4c..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00007.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

_CCMIONode Struct Reference

#include <ccmiotypes.h> -

- - - - - -

Data Fields

double node
double parent
-


Field Documentation

-

- - - - -
- - -
double node -
-
- - - - - -
-   - - -

- -

-Definition at line 62 of file ccmiotypes.h.

-

- - - - -
- - -
double parent -
-
- - - - - -
-   - - -

- -

-Definition at line 63 of file ccmiotypes.h.

-


The documentation for this struct was generated from the following file:
    -
  • /u/xeona04/people/prewett/src/libccmio/libccmio/ccmiotypes.h
-
Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00008.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00008.html deleted file mode 100644 index 9ff7d1a665..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00008.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

_Vector Struct Reference

#include <vector.h> -

- - - - - - - - -

Data Fields

int size
int alloc
int typeSize
int clear
void * buffer
-


Field Documentation

-

- - - - -
- - -
int alloc -
-
- - - - - -
-   - - -

- -

-Definition at line 26 of file vector.h.

-

- - - - -
- - -
void* buffer -
-
- - - - - -
-   - - -

- -

-Definition at line 29 of file vector.h.

-

- - - - -
- - -
int clear -
-
- - - - - -
-   - - -

- -

-Definition at line 28 of file vector.h.

-

- - - - -
- - -
int size -
-
- - - - - -
-   - - -

- -

-Definition at line 25 of file vector.h.

-

- - - - -
- - -
int typeSize -
-
- - - - - -
-   - - -

- -

-Definition at line 27 of file vector.h.

-


The documentation for this struct was generated from the following file:
    -
  • /u/xeona04/people/prewett/src/libccmio/libccmio/vector.h
-
Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00009.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00009.html deleted file mode 100644 index 557f7b7a60..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00009.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

CCMIOID Struct Reference

#include <ccmiotypes.h> -

- - - - - - - - -

Data Fields

CCMIONode root
CCMIONode node
int id
CCMIOEntity type
int version
-


Detailed Description

-
Examples:
- -

-readexample.cpp, rewriteexample.cpp, and writeexample.cpp.

-

- -

-Definition at line 135 of file ccmiotypes.h.


Field Documentation

-

- - - - -
- - -
int id -
-
- - - - - -
-   - - -

- -

-Definition at line 138 of file ccmiotypes.h.

-

- - - - -
- - -
CCMIONode node -
-
- - - - - -
-   - - -

- -

-Definition at line 137 of file ccmiotypes.h.

-

- - - - -
- - -
CCMIONode root -
-
- - - - - -
-   - - -

- -

-Definition at line 136 of file ccmiotypes.h.

-

- - - - -
- - -
CCMIOEntity type -
-
- - - - - -
-   - - -

- -

-Definition at line 139 of file ccmiotypes.h.

-

- - - - -
- - -
int version -
-
- - - - - -
-   - - -

- -

-Definition at line 140 of file ccmiotypes.h.

-


The documentation for this struct was generated from the following file:
    -
  • /u/xeona04/people/prewett/src/libccmio/libccmio/ccmiotypes.h
-
Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00010.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00010.html deleted file mode 100644 index 9e881dfc8a..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00010.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

/u/xeona04/people/prewett/src/libccmio/docs/compatibility.dox File Reference

- -
-
Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00011.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00011.html deleted file mode 100644 index 4f28b904c5..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00011.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

/u/xeona04/people/prewett/src/libccmio/docs/errors.dox File Reference

- -
-
Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00012.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00012.html deleted file mode 100644 index e96ba4bf89..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00012.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

/u/xeona04/people/prewett/src/libccmio/docs/examples.dox File Reference

- -
-
Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00013.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00013.html deleted file mode 100644 index 5000696eae..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00013.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

/u/xeona04/people/prewett/src/libccmio/docs/groups.dox File Reference

- -
-
Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00014.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00014.html deleted file mode 100644 index 3a8fdafa51..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00014.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

/u/xeona04/people/prewett/src/libccmio/docs/hierarchy.dox File Reference

- -
-
Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00015.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00015.html deleted file mode 100644 index 4129a1c445..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00015.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

/u/xeona04/people/prewett/src/libccmio/docs/intropage.dox File Reference

- -
-
Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00016.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00016.html deleted file mode 100644 index 3d0737c875..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00016.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

/u/xeona04/people/prewett/src/libccmio/docs/mainpage.dox File Reference

- -
-
Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00017.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00017.html deleted file mode 100644 index 0121aedf16..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00017.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

/u/xeona04/people/prewett/src/libccmio/libccmio/ccmio.h File Reference

-

-Go to the source code of this file. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Basic functions

CCMIOError CCMIOOpenFile (CCMIOError *err, char const *file, CCMIOIOType mode, CCMIOID *root)
 Opens an CCMIO file.

CCMIOError CCMIOCloseFile (CCMIOError *err, CCMIOID root)
 Closes all references to the CCMIO file.

CCMIOError CCMIOGetVersion (CCMIOError *err, CCMIONode root, int *version)
 Returns the version number of the file.

CCMIOError CCMIOSetVersion (CCMIOError *err, CCMIONode root, int version)
 Sets the version number of the file.

CCMIOError CCMIOGetTitle (CCMIOError *err, CCMIONode root, char **title)
 Returns the title of the file.

CCMIOError CCMIOSetTitle (CCMIOError *err, CCMIONode root, char const *title)
 Sets the title of the file.


Functions for Optional Nodes

CCMIOError CCMIOWriteOpti (CCMIOError *err, CCMIOID parent, char const *name, int value)
 Creates a child node of parent with given name and scalar value.

CCMIOError CCMIOWriteOptf (CCMIOError *err, CCMIOID parent, char const *name, float value)
 Creates a child node of parent with given name and scalar value.

CCMIOError CCMIOWriteOptd (CCMIOError *err, CCMIOID parent, char const *name, double value)
 Creates a child node of parent with given name and scalar value.

CCMIOError CCMIOWriteOptstr (CCMIOError *err, CCMIOID parent, char const *name, char const *value)
 Creates a child node of parent with given name and string value.

CCMIOError CCMIOReadOpti (CCMIOError *err, CCMIOID parent, char const *name, int *value)
 Creates a child node of parent with given name and scalar value.

CCMIOError CCMIOReadOptf (CCMIOError *err, CCMIOID parent, char const *name, float *value)
 Creates a child node of parent with given name and scalar value.

CCMIOError CCMIOReadOptd (CCMIOError *err, CCMIOID parent, char const *name, double *value)
 Creates a child node of parent with given name and scalar value.

CCMIOError CCMIOReadOptstr (CCMIOError *err, CCMIOID parent, char const *name, int *size, char *value)
 Creates a child node of parent with given name and scalar value.

CCMIOError CCMIOReadOpt1i (CCMIOError *err, CCMIOID parent, char const *name, int *data, CCMIOIndex start, CCMIOIndex end)
 Reads a one-dimensional array from the child node of 'parent' with name 'name' into 'data'.

CCMIOError CCMIOReadOpt1f (CCMIOError *err, CCMIOID parent, char const *name, float *data, CCMIOIndex start, CCMIOIndex end)
 Reads a one-dimensional array from the child node of 'parent' with name 'name' into 'data'.

CCMIOError CCMIOReadOpt1d (CCMIOError *err, CCMIOID parent, char const *name, double *data, CCMIOIndex start, CCMIOIndex end)
 Reads a one-dimensional array from the child node of 'parent' with name 'name' into 'data'.

CCMIOError CCMIOReadOpt2i (CCMIOError *err, CCMIOID parent, char const *name, int *data, CCMIOIndex start, CCMIOIndex end)
 Reads a two-dimensional array from the child node of 'parent' with name 'name' into 'data'.

CCMIOError CCMIOReadOpt2f (CCMIOError *err, CCMIOID parent, char const *name, float *data, CCMIOIndex start, CCMIOIndex end)
 Reads a two-dimensional array from the child node of 'parent' with name 'name' into 'data'.

CCMIOError CCMIOReadOpt2d (CCMIOError *err, CCMIOID parent, char const *name, double *data, CCMIOIndex start, CCMIOIndex end)
 Reads a two-dimensional array from the child node of 'parent' with name 'name' into 'data'.

CCMIOError CCMIOReadOpt3i (CCMIOError *err, CCMIOID parent, char const *name, int *data, CCMIOIndex start, CCMIOIndex end)
 Reads a three-dimensional array from the child node of 'parent' with name 'name' into 'data'.

CCMIOError CCMIOReadOpt3f (CCMIOError *err, CCMIOID parent, char const *name, float *data, CCMIOIndex start, CCMIOIndex end)
 Reads a three-dimensional array from the child node of 'parent' with name 'name' into 'data'.

CCMIOError CCMIOReadOpt3d (CCMIOError *err, CCMIOID parent, char const *name, double *data, CCMIOIndex start, CCMIOIndex end)
 Reads a three-dimensional array from the child node of 'parent' with name 'name' into 'data'.

CCMIOError CCMIOWriteOpt1i (CCMIOError *err, CCMIOID const parent, char const *name, CCMIOSize const n, int const *data, CCMIOIndex start, CCMIOIndex end)
 Writes a one-dimensional array to a child node of 'parent' with name 'name'.

CCMIOError CCMIOWriteOpt1f (CCMIOError *err, CCMIOID parent, char const *name, CCMIOSize n, float const *data, CCMIOIndex start, CCMIOIndex end)
 Writes a one-dimensional array to a child node of 'parent' with name 'name'.

CCMIOError CCMIOWriteOpt1d (CCMIOError *err, CCMIOID parent, char const *name, CCMIOSize n, double const *data, CCMIOIndex start, CCMIOIndex end)
 Writes a one-dimensional array to a child node of 'parent' with name 'name'.

CCMIOError CCMIOWriteOpt2i (CCMIOError *err, CCMIOID const parent, char const *name, CCMIOIndex x, CCMIOIndex y, int const *data, CCMIOIndex start, CCMIOIndex end)
 Writes a two-dimensional array to a child node of 'parent' with name 'name'.

CCMIOError CCMIOWriteOpt2f (CCMIOError *err, CCMIOID parent, char const *name, CCMIOIndex x, CCMIOIndex y, float const *data, CCMIOIndex start, CCMIOIndex end)
 Writes a two-dimensional array to a child node of 'parent' with name 'name'.

CCMIOError CCMIOWriteOpt2d (CCMIOError *err, CCMIOID parent, char const *name, CCMIOIndex x, CCMIOIndex y, double const *data, CCMIOIndex start, CCMIOIndex end)
 Writes a two-dimensional array to a child node of 'parent' with name 'name'.

CCMIOError CCMIOWriteOpt3i (CCMIOError *err, CCMIOID parent, char const *name, CCMIOIndex x, CCMIOIndex y, CCMIOIndex z, int const *data, CCMIOIndex start, CCMIOIndex end)
 Writes a three-dimensional array to a child node of 'parent' with name 'name'.

CCMIOError CCMIOWriteOpt3f (CCMIOError *err, CCMIOID parent, char const *name, CCMIOIndex x, CCMIOIndex y, CCMIOIndex z, float const *data, CCMIOIndex start, CCMIOIndex end)
 Writes a three-dimensional array to a child node of 'parent' with name 'name'.

CCMIOError CCMIOWriteOpt3d (CCMIOError *err, CCMIOID parent, char const *name, CCMIOIndex x, CCMIOIndex y, CCMIOIndex z, double const *data, CCMIOIndex start, CCMIOIndex end)
 Writes a three-dimensional array to a child node of 'parent' with name 'name'.

CCMIOError CCMIOGetOptInfo (CCMIOError *err, CCMIOID parent, char const *name, CCMIODataType *type, CCMIOIndex *x, CCMIOIndex *y, CCMIOIndex *z)
 Returns information about the optional node.


Intermediate API

void CCMIOInvalidateEntity (CCMIOID *entity)
 Marks the entity as invalid.

int CCMIOIsValidEntity (CCMIOID entity)
 Returns TRUE if the entity is valid, FALSE otherwise.

int CCMIOIsFromSameFile (CCMIOID entity1, CCMIOID entity2)
 Returns TRUE if the two entities are from the same file, FALSE otherwise.

CCMIOError CCMIONewEntity (CCMIOError *err, CCMIOID parent, CCMIOEntity type, char const *description, CCMIOID *id)
 Creates a new entity.

CCMIOError CCMIOGetEntity (CCMIOError *err, CCMIOID parent, CCMIOEntity type, int idVal, CCMIOID *id)
 Retrieves an entity.

CCMIOError CCMIONewIndexedEntity (CCMIOError *err, CCMIOID parent, CCMIOEntity which, int idVal, char const *description, CCMIOID *id)
 Creates a new entity identified by an index number.

CCMIOError CCMIOGetEntityIndex (CCMIOError *err, CCMIOID id, int *n)
 Returns the index (i.e.

CCMIOError CCMIONewState (CCMIOError *err, CCMIOID root, char const *name, CCMIOID *problemDescription, char const *description, CCMIOID *state)
 Creates a new state.

CCMIOError CCMIOGetState (CCMIOError *err, CCMIOID root, char const *name, CCMIOID *problemDescription, CCMIOID *state)
 Marks the entity as invalid.

CCMIOError CCMIOWriteState (CCMIOError *err, CCMIOID state, CCMIOID problemDescription, char const *description)
 Writes the problem description node to the state.

CCMIOError CCMIONewField (CCMIOError *err, CCMIOID phase, char const *name, char const *shortName, CCMIODimensionality dim, CCMIOID *field)
 Marks the entity as invalid.

CCMIOError CCMIOGetField (CCMIOError *err, CCMIOID phase, char const *name, CCMIODimensionality *dim, CCMIOID *field)
 Retrieves a field entity.

CCMIOError CCMIOReadField (CCMIOError *err, CCMIOID field, char *name, char *shortName, CCMIODimensionality *dim, CCMIODataType *datatype)
 Reads information about a field.

CCMIOError CCMIONewProstarSet (CCMIOError *err, CCMIOID root, const char *name, const char *longName, CCMIOID *setID)
 Creates a new prostar set.

CCMIOError CCMIOGetProstarSet (CCMIOError *err, CCMIOID root, const char *name, int *longNameSize, char *longName, unsigned int *setsAvailableFlag, CCMIOID *setID)
 Gets a prostar set.

CCMIOError CCMIODeleteEntity (CCMIOError *err, CCMIOID id)
 Deletes the entity and all of its children.

CCMIOError CCMIONextEntity (CCMIOError *err, CCMIOID parent, CCMIOEntity type, int *i, CCMIOID *next)
 Marks the entity as invalid.

CCMIOError CCMIOEntitySize (CCMIOError *err, CCMIOID id, CCMIOSize *n, CCMIOIndex *max)
 Returns the number of elements and the maximum element ID in the specified entity.

CCMIOError CCMIOEntityName (CCMIOError *err, CCMIOID id, char *name)
 Gets the name of the entity.

CCMIOError CCMIOEntityLabel (CCMIOError *err, CCMIOID id, CCMIOSize *size, char *label)
 Gets the label of the entity.

CCMIOError CCMIOEntityDescription (CCMIOError *err, CCMIOID id, CCMIOSize *size, char *desc)
 Gets the description (if any) of the specified entity.

CCMIOError CCMIOGetEntityNode (CCMIOError *err, CCMIOID id, CCMIONode *node)
 Returns the CCMIO node corresponding to this entity.

CCMIOError CCMIOEntityDataType (CCMIOError *err, CCMIOID id, CCMIODataType *type)
 Returns the data type of the main data of the entity.

CCMIOError CCMIOWriteMap (CCMIOError *err, CCMIOID id, CCMIOSize n, CCMIOSize max, int const *data, CCMIOIndex start, CCMIOIndex end)
 Writes the map data.

CCMIOError CCMIOReadMap (CCMIOError *err, CCMIOID id, int *data, CCMIOIndex start, CCMIOIndex end)
 Reads the map data.

CCMIOError CCMIOReadVerticesf (CCMIOError *err, CCMIOID id, int *dims, float *scale, CCMIOID *mapID, float *vertices, CCMIOIndex start, CCMIOIndex end)
 Reads the vertex data.

CCMIOError CCMIOReadVerticesd (CCMIOError *err, CCMIOID id, int *dims, float *scale, CCMIOID *mapID, double *vertices, CCMIOIndex start, CCMIOIndex end)
 Reads the vertex data.

CCMIOError CCMIOWriteVerticesf (CCMIOError *err, CCMIOID id, int dims, float scale, CCMIOID mapID, float const *vertices, CCMIOIndex start, CCMIOIndex end)
 Writes the vertex data.

CCMIOError CCMIOWriteVerticesd (CCMIOError *err, CCMIOID id, int dims, float scale, CCMIOID mapID, double const *vertices, CCMIOIndex start, CCMIOIndex end)
 Writes the vertex data.

CCMIOError CCMIOReadCells (CCMIOError *err, CCMIOID id, CCMIOID *mapID, int *cellTypes, CCMIOIndex start, CCMIOIndex end)
 Reads the cell data.

CCMIOError CCMIOWriteCells (CCMIOError *err, CCMIOID id, CCMIOID mapID, int *cellTypes, CCMIOIndex start, CCMIOIndex end)
 Writes the cell data.

CCMIOError CCMIOReadFaces (CCMIOError *err, CCMIOID entity, CCMIOEntity which, CCMIOID *mapID, CCMIOSize *streamSize, int *vertexStream, CCMIOIndex start, CCMIOIndex end)
 Reads the face data.

CCMIOError CCMIOWriteFaces (CCMIOError *err, CCMIOID entity, CCMIOEntity which, CCMIOID mapID, CCMIOSize streamSize, int const *vertexStream, CCMIOIndex start, CCMIOIndex end)
 Writes the face data.

CCMIOError CCMIOReadFaceCells (CCMIOError *err, CCMIOID entity, CCMIOEntity which, int *cells, CCMIOIndex start, CCMIOIndex end)
 Reads the faces' cell associations with the faces.

CCMIOError CCMIOWriteFaceCells (CCMIOError *err, CCMIOID entity, CCMIOEntity which, CCMIOID mapID, int const *cells, CCMIOIndex start, CCMIOIndex end)
 Writes the face data.

CCMIOError CCMIOWriteProcessor (CCMIOError *err, CCMIOID processor, char const *verticesFile, CCMIOID *vertices, char const *topologyFile, CCMIOID *topology, char const *initialFieldFile, CCMIOID *initialField, char const *solutionFile, CCMIOID *solution)
 Writes the processor information.

CCMIOError CCMIOReadProcessor (CCMIOError *err, CCMIOID processor, CCMIOID *vertices, CCMIOID *topology, CCMIOID *initialField, CCMIOID *solution)
 Reads the processor information.

CCMIOError CCMIOClearProcessor (CCMIOError *err, CCMIOID state, CCMIOID processor, int clearVertices, int clearTopology, int clearInitialField, int clearSolution, int clearLagrangian)
 Clears the relevant information from the processor.

CCMIOError CCMIOWriteLagrangianData (CCMIOError *err, CCMIOID lagrangian, char const *positionsFile, CCMIOID *positions, char const *solutionFile, CCMIOID *solution)
 Writes Lagrangian data.

CCMIOError CCMIOReadLagrangianData (CCMIOError *err, CCMIOID lagrangian, CCMIOID *positions, CCMIOID *solution)
 Reads the Langrangian information.

CCMIOError CCMIOWriteMultiDimensionalFieldData (CCMIOError *err, CCMIOID fieldID, CCMIOComponent component, CCMIOID componentField)
 Writes one component of a vector or tensor data field.

CCMIOError CCMIOReadMultiDimensionalFieldData (CCMIOError *err, CCMIOID fieldID, CCMIOComponent component, CCMIOID *componentField)
 Gets the field ID of one component of a vector or tensor data field.

CCMIOError CCMIOWriteFieldDataf (CCMIOError *err, CCMIOID fieldData, CCMIOID mapID, CCMIODataLocation loc, float *data, CCMIOIndex start, CCMIOIndex end)
 Writes scalar data for a field.

CCMIOError CCMIOWriteFieldDatad (CCMIOError *err, CCMIOID fieldData, CCMIOID mapID, CCMIODataLocation loc, double *data, CCMIOIndex start, CCMIOIndex end)
 Writes the data for a field.

CCMIOError CCMIOWriteFieldDatai (CCMIOError *err, CCMIOID fieldData, CCMIOID mapID, CCMIODataLocation loc, int *data, CCMIOIndex start, CCMIOIndex end)
 Writes the data for a field.

CCMIOError CCMIOWriteConstantFieldDataf (CCMIOError *err, CCMIOID fieldData, CCMIOID mapID, CCMIODataLocation loc, float value)
 Writes data for a field that is constant.

CCMIOError CCMIOWriteConstantFieldDatad (CCMIOError *err, CCMIOID fieldData, CCMIOID mapID, CCMIODataLocation loc, double value)
 Writes data for a field that is constant.

CCMIOError CCMIOWriteConstantFieldDatai (CCMIOError *err, CCMIOID fieldData, CCMIOID mapID, CCMIODataLocation loc, int value)
 Writes data for a field that is constant.

CCMIOError CCMIOReadFieldDataf (CCMIOError *err, CCMIOID fieldData, CCMIOID *mapID, CCMIODataLocation *loc, float *data, CCMIOIndex start, CCMIOIndex end)
 Reads scalar data from a field.

CCMIOError CCMIOReadFieldDatad (CCMIOError *err, CCMIOID fieldData, CCMIOID *mapID, CCMIODataLocation *loc, double *data, CCMIOIndex start, CCMIOIndex end)
 Reads the data from a field.

CCMIOError CCMIOReadFieldDatai (CCMIOError *err, CCMIOID fieldData, CCMIOID *mapID, CCMIODataLocation *loc, int *data, CCMIOIndex start, CCMIOIndex end)
 Reads the data from a field.

CCMIOError CCMIOWriteRestartInfo (CCMIOError *err, CCMIOID restartInfo, char const *solverName, int iteration, float time, char const *timeUnits, float startAngle)
 Writes the solver restart entity.

CCMIOError CCMIOReadRestartInfo (CCMIOError *err, CCMIOID restartInfo, char *solverName, int *iteration, float *time, char *timeUnits, float *startAngle)
 Reads the solver restart entity.

CCMIOError CCMIOV2WriteFaceCells (CCMIOError *err, CCMIOID entity, CCMIOEntity which, CCMIOSize nFace, int const *cells, CCMIOIndex start, CCMIOIndex end)
-


Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00018.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00018.html deleted file mode 100644 index c3b8b84b39..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00018.html +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

/u/xeona04/people/prewett/src/libccmio/libccmio/ccmiocore.h File Reference

-

-Go to the source code of this file. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Core functions

The minimal set of functions.

CCMIOError CCMIOOpen (char const *filename, CCMIOIOType mode, CCMIONode *root)
 Opens the data file.

CCMIOError CCMIOClose (CCMIONode root)
 Closes the data file.

CCMIOError CCMIOGetNode (CCMIOError *err, CCMIONode parent, char const *path, CCMIONode *node)
 Finds a node, given a node path.

CCMIOError CCMIOGetNumberOfChildren (CCMIOError *err, CCMIONode parent, int *n)
 Returns the number of children in the parent node.

CCMIOError CCMIOGetNextChild (CCMIOError *err, CCMIONode parent, int *n, CCMIONode *child)
 Returns the next child node.

CCMIOError CCMIOGetName (CCMIOError *err, CCMIONode node, char *name)
 Returns the name of the node.

CCMIOError CCMIOSetName (CCMIOError *err, CCMIONode node, char const *name)
 Sets the name of an existing node.

CCMIOError CCMIOGetLabel (CCMIOError *err, CCMIONode node, char *label)
 Returns the label of the node.

CCMIOError CCMIOSetLabel (CCMIOError *err, CCMIONode node, char const *label)
 Sets the label of an existing node.

CCMIOError CCMIOCreateNode (CCMIOError *err, CCMIONode parent, int openDup, char const *name, char const *label, CCMIONode *node)
 Creates a new node.

CCMIOError CCMIOCreateLink (CCMIOError *err, CCMIONode parent, char const *name, char const *filename, char const *destName, CCMIONode *node)
 Creates a new link.

CCMIOError CCMIODeleteNode (CCMIOError *err, CCMIONode node)
 Deletes the node.

CCMIOError CCMIODeleteAllChildren (CCMIOError *err, CCMIONode node)
 Deletes all children of the node, but not the node itself.

CCMIOError CCMIOMoveNode (CCMIOError *err, CCMIONode node, CCMIONode newParent)
 Moves the node underneath newParent.

CCMIOError CCMIOGetDimensions (CCMIOError *err, CCMIONode node, int *nDims, CCMIOIndex **dims)
 Returns the number of items in the node's data.

CCMIOError CCMIOGetDataSize (CCMIOError *err, CCMIONode node, CCMIOSize *bytes)
 Returns the number of bytes of the data.

CCMIOError CCMIOGetDataType (CCMIOError *err, CCMIONode node, CCMIODataType *type)
 Returns the data type for the node.

CCMIOError CCMIOSetDataType (CCMIOError *err, CCMIONode node, CCMIODataType type,...)
 Sets the datatype of the node.

CCMIOError CCMIOvSetDataType (CCMIOError *err, CCMIONode node, CCMIODataType type, va_list args)
 Opens the data file.

CCMIOError CCMIOSetDataTypev (CCMIOError *err, CCMIONode node, CCMIODataType type, int nDims, CCMIOIndex const *dims)
 Opens the data file.

int CCMIOAreNodesEqual (CCMIONode node1, CCMIONode node2)
 Returns all the data in the node.

CCMIOError CCMIOGetRootNode (CCMIOError *err, CCMIONode node, CCMIONode *root)
 Returns the root node, or kCCMIOBadParameterErr if 'node' is not valid.

-


Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00019.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00019.html deleted file mode 100644 index 3bb97be073..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00019.html +++ /dev/null @@ -1,636 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

/u/xeona04/people/prewett/src/libccmio/libccmio/ccmioprivate.h File Reference

-

-Go to the source code of this file. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Typedefs

typedef int ADFError

Functions

void MakeInvalidNode (CCMIONode *node)
 Writes an invalid CCMIO node in 'node'.

int IsRootNode (CCMIONode node)
 Returns TRUE if 'node' is the root node, FALSE otherwise.

unsigned int CCMIOGetDataTypeSize (CCMIODataType type)
 Returns the size of the specified datatype.

char const * CCMIOGetDataTypeADFName (CCMIODataType type)
 Returns an ADF typename string from the specified type.

CCMIODataType CCMIOGetCCMIODataType (char const *dataStr)
 Returns an CCMIODataType from an ADF string.

CCMIOError IsSameFormat (CCMIONode node, CCMIODataType type, int dimSize)
 Checks to see if the node has the same datatype and dimension size as specified.

int ParseArgs (va_list args, CCMIOIndex *out)
 Parses a va_list of dimension arguments.

void FortranToCArray (int size, int *ary)
 Converts an array of Fortran dimensions to C dimensions (i.e.

int CalcOffset (int n, int coord[], int dimWidth[])
 Takes a coordinate and size of array and returns the offset of the index into the array (if StoreCStyleArrays is enabled then the array is assumed to be in C-ordering, otherwise it is in FORTRAN ordering).

CCMIOError GetADFNodeDimensions (CCMIOError *err, CCMIONode node, int *nDims, int *dims)
 Like CCMIOGetDimensions, except only gives the dimensions of the node passed in; does not take into account extended data.

CCMIOSize GetADFNodeDataSize (CCMIOError *err, CCMIONode node)
 Like CCMIOGetDataSize, except only returns the size (in bytes) of the node passed in; does not take into account extended data.

int IsADFError (int adfErr)
 Returns 1 if adfErr is an ADF error, 0 otherwise.

CCMIOError ADFToCCMIOError (int adfErr)
 Returns the appropriate CCMIOError from the specified adfErr.

CCMIOError CCMIOExtendedADFIO (CCMIOError *err, CCMIONode node, CCMIOIOType ioType, CCMIODataType dataType, int nDims, CCMIOIndex const *dims, char *data, CCMIOIndex start, CCMIOIndex end)
-


Typedef Documentation

-

- - - - -
- - -
typedef int ADFError -
-
- - - - - -
-   - - -

- -

-Definition at line 48 of file ccmioprivate.h.

-


Function Documentation

-

- - - - -
- - - - - - - - - - -
CCMIOError ADFToCCMIOError int   adfErr
-
- - - - - -
-   - - -

-Returns the appropriate CCMIOError from the specified adfErr. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
int CalcOffset int   n,
int   coord[],
int   dimWidth[]
-
- - - - - -
-   - - -

-Takes a coordinate and size of array and returns the offset of the index into the array (if StoreCStyleArrays is enabled then the array is assumed to be in C-ordering, otherwise it is in FORTRAN ordering). -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOExtendedADFIO CCMIOError  err,
CCMIONode   node,
CCMIOIOType   ioType,
CCMIODataType   dataType,
int   nDims,
CCMIOIndex const *   dims,
char *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-

-

- - - - -
- - - - - - - - - - -
CCMIODataType CCMIOGetCCMIODataType char const *   dataStr
-
- - - - - -
-   - - -

-Returns an CCMIODataType from an ADF string. -

-

-

- - - - -
- - - - - - - - - - -
char const* CCMIOGetDataTypeADFName CCMIODataType   type
-
- - - - - -
-   - - -

-Returns an ADF typename string from the specified type. -

-

-

- - - - -
- - - - - - - - - - -
unsigned int CCMIOGetDataTypeSize CCMIODataType   type
-
- - - - - -
-   - - -

-Returns the size of the specified datatype. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - -
void FortranToCArray int   size,
int *   ary
-
- - - - - -
-   - - -

-Converts an array of Fortran dimensions to C dimensions (i.e. -

-reverses them

-

- - - - -
- - - - - - - - - - - - - - - - - - - -
CCMIOSize GetADFNodeDataSize CCMIOError  err,
CCMIONode   node
-
- - - - - -
-   - - -

-Like CCMIOGetDataSize, except only returns the size (in bytes) of the node passed in; does not take into account extended data. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError GetADFNodeDimensions CCMIOError  err,
CCMIONode   node,
int *   nDims,
int *   dims
-
- - - - - -
-   - - -

-Like CCMIOGetDimensions, except only gives the dimensions of the node passed in; does not take into account extended data. -

-

-

- - - - -
- - - - - - - - - - -
int IsADFError int   adfErr
-
- - - - - -
-   - - -

-Returns 1 if adfErr is an ADF error, 0 otherwise. -

-

-

- - - - -
- - - - - - - - - - -
int IsRootNode CCMIONode   node
-
- - - - - -
-   - - -

-Returns TRUE if 'node' is the root node, FALSE otherwise. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError IsSameFormat CCMIONode   node,
CCMIODataType   type,
int   dimSize
-
- - - - - -
-   - - -

-Checks to see if the node has the same datatype and dimension size as specified. -

-

-

- - - - -
- - - - - - - - - - -
void MakeInvalidNode CCMIONode  node
-
- - - - - -
-   - - -

-Writes an invalid CCMIO node in 'node'. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - -
int ParseArgs va_list   args,
CCMIOIndex  out
-
- - - - - -
-   - - -

-Parses a va_list of dimension arguments. -

-

-


Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00020.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00020.html deleted file mode 100644 index f0be339131..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00020.html +++ /dev/null @@ -1,600 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

/u/xeona04/people/prewett/src/libccmio/libccmio/ccmiotypes.h File Reference

-

-Go to the source code of this file. - - - - - - - - - - - - - - - - - - - -

Data Structures

struct  _CCMIONode
struct  CCMIOID

Typedefs

typedef unsigned int CCMIOIndex
typedef unsigned int CCMIOSize
typedef CCMIOBufferType CCMIOIOType
typedef _CCMIONode CCMIONode

Enumerations

enum  CCMIOError {
-  kCCMIONoErr = 0, -kCCMIONoFileErr, -kCCMIOPermissionErr, -kCCMIOCorruptFileErr, -
-  kCCMIOBadLinkErr, -kCCMIONoNodeErr, -kCCMIODuplicateNodeErr, -kCCMIOWrongDataTypeErr, -
-  kCCMIONoDataErr, -kCCMIOWrongParentErr, -kCCMIOBadParameterErr, -kCCMIONoMemoryErr, -
-  kCCMIOIOErr, -kCCMIOTooManyFacesErr, -kCCMIOVersionErr, -kCCMIOArrayDimensionToLargeErr, -
-  kCCMIOInternalErr -
- }
 Please see CCMIO Error Handling for details on the use of CCMIOError. More...

enum  CCMIODataType {
-  kCCMIOFloat32 = 0, -kCCMIOFloat64, -kCCMIOInt32, -kCCMIOInt64, -
-  kCCMIOString, -kCCMIOUnknownType, -kCCMIOBadType, -kCCMIOLastType -
- }
enum  CCMIOBufferType { kCCMIORead, -kCCMIOWrite - }
enum  CCMIOOpenType { kCCMIOReadData, -kCCMIONewData, -kCCMIOAddData - }
enum  CCMIODimensionality { kCCMIODimNull = 0, -kCCMIOScalar = 1, -kCCMIOVector, -kCCMIOTensor - }
enum  CCMIODataLocation { kCCMIOVertex = 0, -kCCMIOCell, -kCCMIOFace - }
enum  CCMIOEntity {
-  kCCMIONull = -1, -kCCMIOMap = 0, -kCCMIOVertices, -kCCMIOTopology, -
-  kCCMIOInternalFaces, -kCCMIOBoundaryFaces, -kCCMIOCells, -kCCMIOProblemDescription, -
-  kCCMIOFieldSet, -kCCMIOField, -kCCMIOFieldData, -kCCMIOState, -
-  kCCMIOProcessor, -kCCMIOCellType, -kCCMIOBoundaryRegion, -kCCMIOLagrangianData, -
-  kCCMIOInterfaces, -kCCMIOFieldPhase, -kCCMIORestart, -kCCMIORestartData, -
-  kCCMIOReferenceData, -kCCMIOModelConstants, -kCCMIOProstarSet, -kCCMIOMaxEntity -
- }
enum  CCMIOComponent {
-  kCCMIOVectorX = 0, -kCCMIOVectorY, -kCCMIOVectorZ, -kCCMIOTensorXX = 0, -
-  kCCMIOTensorXY, -kCCMIOTensorXZ, -kCCMIOTensorYX, -kCCMIOTensorYY, -
-  kCCMIOTensorYZ, -kCCMIOTensorZX, -kCCMIOTensorZY, -kCCMIOTensorZZ -
- }
-


Typedef Documentation

-

- - - - -
- - -
typedef unsigned int CCMIOIndex -
-
- - - - - -
-   - - -

- -

-Definition at line 70 of file ccmiotypes.h.

-

- - - - -
- - -
typedef CCMIOBufferType CCMIOIOType -
-
- - - - - -
-   - - -

- -

-Definition at line 74 of file ccmiotypes.h.

-

- - - - -
- - -
typedef struct _CCMIONode CCMIONode -
-
- - - - - -
-   - - -

- -

-Definition at line 78 of file ccmiotypes.h.

-

- - - - -
- - -
typedef unsigned int CCMIOSize -
-
- - - - - -
-   - - -

- -

-Definition at line 71 of file ccmiotypes.h.

-


Enumeration Type Documentation

-

- - - - -
- - -
enum CCMIOBufferType -
-
- - - - - -
-   - - -

-

Enumeration values:
- - - -
kCCMIORead  -
kCCMIOWrite  -
-
- -

-Definition at line 73 of file ccmiotypes.h.

-

- - - - -
- - -
enum CCMIOComponent -
-
- - - - - -
-   - - -

-

Enumeration values:
- - - - - - - - - - - - - -
kCCMIOVectorX  -
kCCMIOVectorY  -
kCCMIOVectorZ  -
kCCMIOTensorXX  -
kCCMIOTensorXY  -
kCCMIOTensorXZ  -
kCCMIOTensorYX  -
kCCMIOTensorYY  -
kCCMIOTensorYZ  -
kCCMIOTensorZX  -
kCCMIOTensorZY  -
kCCMIOTensorZZ  -
-
- -

-Definition at line 130 of file ccmiotypes.h.

-

- - - - -
- - -
enum CCMIODataLocation -
-
- - - - - -
-   - - -

-

Enumeration values:
- - - - -
kCCMIOVertex  -
kCCMIOCell  -
kCCMIOFace  -
-
- -

-Definition at line 110 of file ccmiotypes.h.

-

- - - - -
- - -
enum CCMIODataType -
-
- - - - - -
-   - - -

-

Enumeration values:
- - - - - - - - - -
kCCMIOFloat32  -
kCCMIOFloat64  -
kCCMIOInt32  -
kCCMIOInt64  -
kCCMIOString  -
kCCMIOUnknownType  -
kCCMIOBadType  -
kCCMIOLastType  -
-
- -

-Definition at line 56 of file ccmiotypes.h.

-

- - - - -
- - -
enum CCMIODimensionality -
-
- - - - - -
-   - - -

-

Enumeration values:
- - - - - -
kCCMIODimNull  -
kCCMIOScalar  -
kCCMIOVector  -
kCCMIOTensor  -
-
- -

-Definition at line 109 of file ccmiotypes.h.

-

- - - - -
- - -
enum CCMIOEntity -
-
- - - - - -
-   - - -

-

Enumeration values:
- - - - - - - - - - - - - - - - - - - - - - - - - -
kCCMIONull  -
kCCMIOMap  -
kCCMIOVertices  -
kCCMIOTopology  -
kCCMIOInternalFaces  -
kCCMIOBoundaryFaces  -
kCCMIOCells  -
kCCMIOProblemDescription  -
kCCMIOFieldSet  -
kCCMIOField  -
kCCMIOFieldData  -
kCCMIOState  -
kCCMIOProcessor  -
kCCMIOCellType  -
kCCMIOBoundaryRegion  -
kCCMIOLagrangianData  -
kCCMIOInterfaces  -
kCCMIOFieldPhase  -
kCCMIORestart  -
kCCMIORestartData  -
kCCMIOReferenceData  -
kCCMIOModelConstants  -
kCCMIOProstarSet  -
kCCMIOMaxEntity  -
-
- -

-Definition at line 121 of file ccmiotypes.h.

-

- - - - -
- - -
enum CCMIOError -
-
- - - - - -
-   - - -

-Please see CCMIO Error Handling for details on the use of CCMIOError. -

-

Enumeration values:
- - - - - - - - - - - - - - - - - - -
kCCMIONoErr  -
kCCMIONoFileErr  -
kCCMIOPermissionErr  -
kCCMIOCorruptFileErr  -
kCCMIOBadLinkErr  -
kCCMIONoNodeErr  -
kCCMIODuplicateNodeErr  -
kCCMIOWrongDataTypeErr  -
kCCMIONoDataErr  -
kCCMIOWrongParentErr  -
kCCMIOBadParameterErr  -
kCCMIONoMemoryErr  -
kCCMIOIOErr  -
kCCMIOTooManyFacesErr  -
kCCMIOVersionErr  -
kCCMIOArrayDimensionToLargeErr  -
kCCMIOInternalErr  -
-
- -

-Definition at line 36 of file ccmiotypes.h.

-

- - - - -
- - -
enum CCMIOOpenType -
-
- - - - - -
-   - - -

-

Enumeration values:
- - - - -
kCCMIOReadData  -
kCCMIONewData  -
kCCMIOAddData  -
-
- -

-Definition at line 76 of file ccmiotypes.h.

-


Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00021.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00021.html deleted file mode 100644 index c46ca17914..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00021.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

/u/xeona04/people/prewett/src/libccmio/libccmio/ccmioutility.h File Reference

-

-Go to the source code of this file. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Utility functions

Condenses common tasks

CCMIOError CCMIOWriteNodei (CCMIOError *err, CCMIONode parent, char const *name, int value)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOWriteNodef (CCMIOError *err, CCMIONode parent, char const *name, float value)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOWriteNoded (CCMIOError *err, CCMIONode parent, char const *name, double value)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOWriteNodestr (CCMIOError *err, CCMIONode parent, char const *name, char const *value)
 Creates a child node of parent with given name and string value.

CCMIOError CCMIOReadNodei (CCMIOError *err, CCMIONode parent, char const *name, int *value)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOReadNodef (CCMIOError *err, CCMIONode parent, char const *name, float *value)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOReadNoded (CCMIOError *err, CCMIONode parent, char const *name, double *value)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOReadNodestr (CCMIOError *err, CCMIONode parent, char const *name, char **value)
 Creates a child node of parent with given name and value.

CCMIOError CCMIORead1i (CCMIOError *err, CCMIONode node, int *data, CCMIOIndex start, CCMIOIndex end)
 Reads the entire contents of the node into the array provided.

CCMIOError CCMIORead1f (CCMIOError *err, CCMIONode node, float *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIORead1d (CCMIOError *err, CCMIONode node, double *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIORead2i (CCMIOError *err, CCMIONode node, int *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIORead2f (CCMIOError *err, CCMIONode node, float *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIORead2d (CCMIOError *err, CCMIONode node, double *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIORead3i (CCMIOError *err, CCMIONode node, int *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIORead3f (CCMIOError *err, CCMIONode node, float *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIORead3d (CCMIOError *err, CCMIONode node, double *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOWrite1i (CCMIOError *err, CCMIONode node, CCMIOIndex n, int const *data, CCMIOIndex start, CCMIOIndex end)
 Writes the entire array to the node.

CCMIOError CCMIOWrite1f (CCMIOError *err, CCMIONode node, CCMIOIndex n, float const *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOWrite1d (CCMIOError *err, CCMIONode node, CCMIOIndex n, double const *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOWrite2i (CCMIOError *err, CCMIONode node, CCMIOIndex x, CCMIOIndex y, int const *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOWrite2f (CCMIOError *err, CCMIONode node, CCMIOIndex x, CCMIOIndex y, float const *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOWrite2d (CCMIOError *err, CCMIONode node, CCMIOIndex x, CCMIOIndex y, double const *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOWrite3i (CCMIOError *err, CCMIONode node, CCMIOIndex x, CCMIOIndex y, CCMIOIndex z, int const *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOWrite3f (CCMIOError *err, CCMIONode node, CCMIOIndex x, CCMIOIndex y, CCMIOIndex z, float const *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOWrite3d (CCMIOError *err, CCMIONode node, CCMIOIndex x, CCMIOIndex y, CCMIOIndex z, double const *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOOldReadf (CCMIOError *err, CCMIONode node, int dimension, int swapDims, float *data, CCMIOIndex start, CCMIOIndex end)
CCMIOError CCMIOOldReadd (CCMIOError *err, CCMIONode node, int dimension, int swapDims, double *data, CCMIOIndex start, CCMIOIndex end)
CCMIOError CCMIOOldReadi (CCMIOError *err, CCMIONode node, int dimension, int swapDims, int *data, CCMIOIndex start, CCMIOIndex end)
CCMIOError CCMIOCopyNode (CCMIOError *err, CCMIONode origNode, CCMIONode copyNode, int copyExists)
 Recursively copies a node.

CCMIOError CCMIOGetNextChildWithLabel (CCMIOError *err, CCMIONode parent, char const *label, int *n, CCMIONode *child)
 Same as CCMIOGetNextChild() (particularly with respect to the parameter n) except that it only returns children with the specified label.

CCMIOError CCMIOCompress (CCMIOError *err, char *filename)
 Compresses the CCMIO file specified.

-


Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00022.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00022.html deleted file mode 100644 index f3eda473d6..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00022.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

/u/xeona04/people/prewett/src/libccmio/libccmio/ccmioverifymesh.h File Reference

-

-Go to the source code of this file. - - - -

Functions

CCMIOError CCMIOCheckProcessorMesh (CCMIOError *err, CCMIOProcessor proc)
-


Function Documentation

-

- - - - -
- - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOCheckProcessorMesh CCMIOError  err,
CCMIOProcessor   proc
-
- - - - - -
-   - - -

-Should be called only after all data has been written to the processor. Sanity checks the mesh for consistency. Displays all errors in the mesh.

-


Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00023.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00023.html deleted file mode 100644 index f2c969417f..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00023.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

/u/xeona04/people/prewett/src/libccmio/libccmio/ccmioversion.h File Reference

-

-Go to the source code of this file. - -
-


Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00024.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00024.html deleted file mode 100644 index 6f0163aac0..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00024.html +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

/u/xeona04/people/prewett/src/libccmio/libccmio/vector.h File Reference

-

-Go to the source code of this file. - - - - - - - - - - - - - - -

Data Structures

struct  _Vector

Typedefs

typedef _VectorVector

Functions

Vector VCreate (int typeSize, int minSize, int clear)
 Creates a growable array (or NULL if memory error).

void VDestroy (Vector v)
 Destroys a growable array (or does nothing if passed NULL).

int VSize (Vector v)
 Returns the number of elements currently used.

void * VIndex (Vector v, int i)
 Returns a pointer to the index i.

-


Typedef Documentation

-

- - - - -
- - -
typedef struct _Vector* Vector -
-
- - - - - -
-   - - -

- -

-Definition at line 32 of file vector.h.

-


Function Documentation

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
Vector VCreate int   typeSize,
int   minSize,
int   clear
-
- - - - - -
-   - - -

-Creates a growable array (or NULL if memory error). -

-If clear is TRUE, then unused memory will always be zero.

-

- - - - -
- - - - - - - - - - -
void VDestroy Vector   v
-
- - - - - -
-   - - -

-Destroys a growable array (or does nothing if passed NULL). -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - -
void* VIndex Vector   v,
int   i
-
- - - - - -
-   - - -

-Returns a pointer to the index i. -

-If i is larger than the array, it will be expanded to at least i. If an expansion fails, returns NULL.

-

- - - - -
- - - - - - - - - - -
int VSize Vector   v
-
- - - - - -
-   - - -

-Returns the number of elements currently used. -

-

-


Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00025.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00025.html deleted file mode 100644 index c2a1a658dd..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00025.html +++ /dev/null @@ -1,3293 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

Core API

The Core API provides low-level access to the file. -More... - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Core functions

The minimal set of functions.

CCMIOError CCMIOOpen (char const *filename, CCMIOIOType mode, CCMIONode *root)
 Opens the data file.

CCMIOError CCMIOClose (CCMIONode root)
 Closes the data file.

CCMIOError CCMIOGetNode (CCMIOError *err, CCMIONode parent, char const *path, CCMIONode *node)
 Finds a node, given a node path.

CCMIOError CCMIOGetNumberOfChildren (CCMIOError *err, CCMIONode parent, int *n)
 Returns the number of children in the parent node.

CCMIOError CCMIOGetNextChild (CCMIOError *err, CCMIONode parent, int *n, CCMIONode *child)
 Returns the next child node.

CCMIOError CCMIOGetName (CCMIOError *err, CCMIONode node, char *name)
 Returns the name of the node.

CCMIOError CCMIOSetName (CCMIOError *err, CCMIONode node, char const *name)
 Sets the name of an existing node.

CCMIOError CCMIOGetLabel (CCMIOError *err, CCMIONode node, char *label)
 Returns the label of the node.

CCMIOError CCMIOSetLabel (CCMIOError *err, CCMIONode node, char const *label)
 Sets the label of an existing node.

CCMIOError CCMIOCreateNode (CCMIOError *err, CCMIONode parent, int openDup, char const *name, char const *label, CCMIONode *node)
 Creates a new node.

CCMIOError CCMIOCreateLink (CCMIOError *err, CCMIONode parent, char const *name, char const *filename, char const *destName, CCMIONode *node)
 Creates a new link.

CCMIOError CCMIODeleteNode (CCMIOError *err, CCMIONode node)
 Deletes the node.

CCMIOError CCMIODeleteAllChildren (CCMIOError *err, CCMIONode node)
 Deletes all children of the node, but not the node itself.

CCMIOError CCMIOMoveNode (CCMIOError *err, CCMIONode node, CCMIONode newParent)
 Moves the node underneath newParent.

CCMIOError CCMIOGetDimensions (CCMIOError *err, CCMIONode node, int *nDims, CCMIOIndex **dims)
 Returns the number of items in the node's data.

CCMIOError CCMIOGetDataSize (CCMIOError *err, CCMIONode node, CCMIOSize *bytes)
 Returns the number of bytes of the data.

CCMIOError CCMIOGetDataType (CCMIOError *err, CCMIONode node, CCMIODataType *type)
 Returns the data type for the node.

CCMIOError CCMIOSetDataType (CCMIOError *err, CCMIONode node, CCMIODataType type,...)
 Sets the datatype of the node.

CCMIOError CCMIOvSetDataType (CCMIOError *err, CCMIONode node, CCMIODataType type, va_list args)
 Opens the data file.

CCMIOError CCMIOSetDataTypev (CCMIOError *err, CCMIONode node, CCMIODataType type, int nDims, CCMIOIndex const *dims)
 Opens the data file.

int CCMIOAreNodesEqual (CCMIONode node1, CCMIONode node2)
 Returns all the data in the node.

CCMIOError CCMIOGetRootNode (CCMIOError *err, CCMIONode node, CCMIONode *root)
 Returns the root node, or kCCMIOBadParameterErr if 'node' is not valid.


Utility functions

Condenses common tasks

CCMIOError CCMIOWriteNodei (CCMIOError *err, CCMIONode parent, char const *name, int value)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOWriteNodef (CCMIOError *err, CCMIONode parent, char const *name, float value)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOWriteNoded (CCMIOError *err, CCMIONode parent, char const *name, double value)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOWriteNodestr (CCMIOError *err, CCMIONode parent, char const *name, char const *value)
 Creates a child node of parent with given name and string value.

CCMIOError CCMIOReadNodei (CCMIOError *err, CCMIONode parent, char const *name, int *value)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOReadNodef (CCMIOError *err, CCMIONode parent, char const *name, float *value)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOReadNoded (CCMIOError *err, CCMIONode parent, char const *name, double *value)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOReadNodestr (CCMIOError *err, CCMIONode parent, char const *name, char **value)
 Creates a child node of parent with given name and value.

CCMIOError CCMIORead1i (CCMIOError *err, CCMIONode node, int *data, CCMIOIndex start, CCMIOIndex end)
 Reads the entire contents of the node into the array provided.

CCMIOError CCMIORead1f (CCMIOError *err, CCMIONode node, float *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIORead1d (CCMIOError *err, CCMIONode node, double *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIORead2i (CCMIOError *err, CCMIONode node, int *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIORead2f (CCMIOError *err, CCMIONode node, float *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIORead2d (CCMIOError *err, CCMIONode node, double *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIORead3i (CCMIOError *err, CCMIONode node, int *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIORead3f (CCMIOError *err, CCMIONode node, float *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIORead3d (CCMIOError *err, CCMIONode node, double *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOWrite1i (CCMIOError *err, CCMIONode node, CCMIOIndex n, int const *data, CCMIOIndex start, CCMIOIndex end)
 Writes the entire array to the node.

CCMIOError CCMIOWrite1f (CCMIOError *err, CCMIONode node, CCMIOIndex n, float const *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOWrite1d (CCMIOError *err, CCMIONode node, CCMIOIndex n, double const *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOWrite2i (CCMIOError *err, CCMIONode node, CCMIOIndex x, CCMIOIndex y, int const *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOWrite2f (CCMIOError *err, CCMIONode node, CCMIOIndex x, CCMIOIndex y, float const *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOWrite2d (CCMIOError *err, CCMIONode node, CCMIOIndex x, CCMIOIndex y, double const *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOWrite3i (CCMIOError *err, CCMIONode node, CCMIOIndex x, CCMIOIndex y, CCMIOIndex z, int const *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOWrite3f (CCMIOError *err, CCMIONode node, CCMIOIndex x, CCMIOIndex y, CCMIOIndex z, float const *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOWrite3d (CCMIOError *err, CCMIONode node, CCMIOIndex x, CCMIOIndex y, CCMIOIndex z, double const *data, CCMIOIndex start, CCMIOIndex end)
 Creates a child node of parent with given name and value.

CCMIOError CCMIOOldReadf (CCMIOError *err, CCMIONode node, int dimension, int swapDims, float *data, CCMIOIndex start, CCMIOIndex end)
CCMIOError CCMIOOldReadd (CCMIOError *err, CCMIONode node, int dimension, int swapDims, double *data, CCMIOIndex start, CCMIOIndex end)
CCMIOError CCMIOOldReadi (CCMIOError *err, CCMIONode node, int dimension, int swapDims, int *data, CCMIOIndex start, CCMIOIndex end)
CCMIOError CCMIOCopyNode (CCMIOError *err, CCMIONode origNode, CCMIONode copyNode, int copyExists)
 Recursively copies a node.

CCMIOError CCMIOGetNextChildWithLabel (CCMIOError *err, CCMIONode parent, char const *label, int *n, CCMIONode *child)
 Same as CCMIOGetNextChild() (particularly with respect to the parameter n) except that it only returns children with the specified label.

CCMIOError CCMIOCompress (CCMIOError *err, char *filename)
 Compresses the CCMIO file specified.

-

Detailed Description

-The Core API provides low-level access to the file. -

-In general this API is not necessary as the Intermediate API provides a more useful interface.


Function Documentation

-

- - - - -
- - - - - - - - - - - - - - - - - - - -
int CCMIOAreNodesEqual CCMIONode   node1,
CCMIONode   node2
-
- - - - - -
-   - - -

-Returns all the data in the node. -

-

Parameters:
- - - - - - -
err  -Error input and output. If the incoming error is not kCCMIONoErr, the function will do nothing. Is set to the function's return value on exit.
node  -The node to use
data  -Pointer to memory large enough to hold the entire data; note that this is not allocated by the library. The data is returned as FORTRAN data.
expected  -The expected type. A kCCMIOWrongDataTypeErr error is returned if the node's data is not of the expected type and no data is written.
dimsExpected  -The number of dimensions that are expected. A kCCMIOWrongDataType error is returned if the node's data has a different number of dimensions. A scalar and a one-dimensional array both have dimensions of 1. extern CCMIOError CCMIOReadData( CCMIOError *err, CCMIONode node, void *data, CCMIODataType expected, int dimsExpected );
-
/** Returns one element of data. No datatype checking is performed.
Parameters:
- - - - - -
err  -Error input and output. If the incoming error is not kCCMIONoErr, the function will do nothing. Is set to the function's return value on exit.
node  -The node whose data to return.
data  -Pointer to memory large enough to hold one element
...  -Var-arg list that is the C-style index into the array. Scalar values can be read by using a single value of 0, although CCMIOReadData() is preferred. At least one parameter must be passed to the list. Note that the list must be terminated with kCCMIOEndArgs. extern CCMIOError CCMIOReadDataPoint( CCMIOError *err, CCMIONode node, void *data, ...);
-
/** Write one element of data. No datatype checking is performed. See CCMIOReadDataPoint() for a discussion of the parameters. The var-arg list must be terminated with kCCMIOEndArgs. Note: for performance reasons, the datatype of 'data' is unknown to the function, so CCMIOWriteDataPoint() cannot be used to write strings, as it does not know when 'data' is a string. For string data use CCMIOWriteData. Note: When writing scalar data with CCMIOWriteDataPoint(), a dimension of 0 should be used: "CCMIOWriteDataPoint(err, node, data, 0, kCCMIOEndArgs)", although CCMIOWriteData() is preferred. extern CCMIOError CCMIOWriteDataPoint( CCMIOError *err, CCMIONode node, void *data, ... ); -

-/** Writes the entire node's data. Requires that the node's datatype and size were correctly set with CCMIOSetDataType(). CCMIOError CCMIOWriteData( CCMIOError *err, CCMIONode node, void const *data ); -

-/** Returns TRUE if node1 == node2, FALSE otherwise.

-

- - - - -
- - - - - - - - - - -
CCMIOError CCMIOClose CCMIONode   root
-
- - - - - -
-   - - -

-Closes the data file. -

-

Parameters:
- - -
root  -Root node of the file to be closed.
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOCompress CCMIOError  err,
char *   filename
-
- - - - - -
-   - - -

-Compresses the CCMIO file specified. -

-This is occasionally necessary becase ADF (the underlying storage format) leaks disk space; ADF does not completely recover the space when a node is delete or is rewritten with less information. The compression is performed by copying the data to a new ADF file, which is then renamed to the original name. This function will correctly compress CCMIO files, and will probably, but not necessarily, correctly compress ADF files. Also note that this function requires temporary storage equal to the size of the original file in the same filesystem as the original file and should not be called frequently, as it may take a some time.

Examples:
-writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOCopyNode CCMIOError  err,
CCMIONode   origNode,
CCMIONode   copyNode,
int   copyExists
-
- - - - - -
-   - - -

-Recursively copies a node. -

-origNode and copyNode need not be from the same file.

Parameters:
- - - - -
origNode  -The node to be copied.
copyNode  -If copyExists is TRUE, then copyNode is the node to be copied over. Otherwise, it is the parent, and a copy of origNode will be created as a child.
copyExists  -Determines the function of copyNode.
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOCreateLink CCMIOError  err,
CCMIONode   parent,
char const *   name,
char const *   filename,
char const *   destName,
CCMIONode  node
-
- - - - - -
-   - - -

-Creates a new link. -

-

Parameters:
- - - - - - - -
err  -Error input and output. If the incoming error is not kCCMIONoErr, the function will do nothing. Is set to the function's return value on exit.
parent  -The parent node of the new link.
name  -The name of the node. See CCMIOCreateNode() for more details on this parameter.
filename  -Filename that the link points to.
destName  -Path to the node to be linked to.
node  -Returns the new node (invalid in case of an error). NULL may be passed in if no return is required.
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOCreateNode CCMIOError  err,
CCMIONode   parent,
int   openDup,
char const *   name,
char const *   label,
CCMIONode  node
-
- - - - - -
-   - - -

-Creates a new node. -

-

Parameters:
- - - - - - - -
err  -Error input and output. If the incoming error is not kCCMIONoErr, the function will do nothing. Is set to the function's return value on exit.
parent  -The parent node of the new node.
openDup  -If TRUE, a kCCMIODuplicateNodeErr will not be returned in an attempt to create a sibling with the same name; instead, CCMIOGetNode() will be called on the original node If FALSE, the error will be returned and the value of node is undefined.
name  -The name of the node. If the file type (e.g. ADF) limits lengths of names, the name will be truncated.
label  -The label of the name. This may be trunctated like the name.
node  -Returns the new node. NULL may be passed in if no return is required.
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIODeleteAllChildren CCMIOError  err,
CCMIONode   node
-
- - - - - -
-   - - -

-Deletes all children of the node, but not the node itself. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIODeleteNode CCMIOError  err,
CCMIONode   node
-
- - - - - -
-   - - -

-Deletes the node. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOGetDataSize CCMIOError  err,
CCMIONode   node,
CCMIOSize  bytes
-
- - - - - -
-   - - -

-Returns the number of bytes of the data. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOGetDataType CCMIOError  err,
CCMIONode   node,
CCMIODataType  type
-
- - - - - -
-   - - -

-Returns the data type for the node. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOGetDimensions CCMIOError  err,
CCMIONode   node,
int *   nDims,
CCMIOIndex **   dims
-
- - - - - -
-   - - -

-Returns the number of items in the node's data. -

-

Parameters:
- - - - - -
err  -Error input and output. If the incoming error is not kCCMIONoErr, the function will do nothing. Is set to the function's return value on exit.
node  -The node to use
nDims  -Returns the number of dimensions. 0 means no data.
dims  -Returns the number of elements of each dimension. Note that this array is allocated by the library and must be freed by the user.
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOGetLabel CCMIOError  err,
CCMIONode   node,
char *   label
-
- - - - - -
-   - - -

-Returns the label of the node. -

-

Parameters:
- - - - -
err  -Error input and output. If the incoming error is not kCCMIONoErr, the function will do nothing. Is set to the function's return value on exit.
node  -The node whose label is to be returned.
label  -Returns the label of the node. This string must be at least kCCMIOMaxStringLength + 1 bytes.
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOGetName CCMIOError  err,
CCMIONode   node,
char *   name
-
- - - - - -
-   - - -

-Returns the name of the node. -

-

Parameters:
- - - - -
err  -Error input and output. If the incoming error is not kCCMIONoErr, the function will do nothing. Is set to the function's return value on exit.
node  -The node whose name is to be returned.
name  -Returns the name of the node. Must be at least kCCMIOMaxStringLength + 1 bytes.
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOGetNextChild CCMIOError  err,
CCMIONode   parent,
int *   n,
CCMIONode  child
-
- - - - - -
-   - - -

-Returns the next child node. -

-Note that there is no guarantee that the order of the children will always be the same.

Parameters:
- - - - - -
err  -Error input and output. If the incoming error is not kCCMIONoErr, the function will do nothing. Is set to the function's return value on exit.
parent  -Parent node of the prospective children.
n  -Which child (i.e. return the nth child). n will be incremented upon successful completion of the function. If there is no nth child, a kCCMIONoNodeErr error will be returned.
child  -The nth child, or NULL if the nth child does not exist.
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOGetNextChildWithLabel CCMIOError  err,
CCMIONode   parent,
char const *   label,
int *   n,
CCMIONode  child
-
- - - - - -
-   - - -

-Same as CCMIOGetNextChild() (particularly with respect to the parameter n) except that it only returns children with the specified label. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOGetNode CCMIOError  err,
CCMIONode   parent,
char const *   path,
CCMIONode  node
-
- - - - - -
-   - - -

-Finds a node, given a node path. -

-

Parameters:
- - - - - -
err  -Error input and output. If the incoming error is not kCCMIONoErr, the function will do nothing. Is set to the function's return value on exit.
parent  -The node that the root of the path begins with (need not be the actual root node).
path  -A unix-like path containing the names of nodes. The beginning / is optional. (e.g. "/solver/brep/topology/endpoints").
node  -Returns the node (invalid if it does not exist).
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOGetNumberOfChildren CCMIOError  err,
CCMIONode   parent,
int *   n
-
- - - - - -
-   - - -

-Returns the number of children in the parent node. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOGetRootNode CCMIOError  err,
CCMIONode   node,
CCMIONode  root
-
- - - - - -
-   - - -

-Returns the root node, or kCCMIOBadParameterErr if 'node' is not valid. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOMoveNode CCMIOError  err,
CCMIONode   node,
CCMIONode   newParent
-
- - - - - -
-   - - -

-Moves the node underneath newParent. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOOldReadd CCMIOError  err,
CCMIONode   node,
int   dimension,
int   swapDims,
double *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

- -

-For internal use only. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOOldReadf CCMIOError  err,
CCMIONode   node,
int   dimension,
int   swapDims,
float *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

- -

-For internal use only. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOOldReadi CCMIOError  err,
CCMIONode   node,
int   dimension,
int   swapDims,
int *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

- -

-For internal use only. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOOpen char const *   filename,
CCMIOIOType   mode,
CCMIONode  root
-
- - - - - -
-   - - -

-Opens the data file. -

-The file will be created if it does not already exist.

Parameters:
- - - - -
filename  -Name of the file to open.
mode  -Mode to open the file: kCCMIORead or kCCMIOWrite.
root  -Returns the root node of the file.
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIORead1d CCMIOError  err,
CCMIONode   node,
double *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and value. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIORead1f CCMIOError  err,
CCMIONode   node,
float *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and value. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIORead1i CCMIOError  err,
CCMIONode   node,
int *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Reads the entire contents of the node into the array provided. -

-The array must be the proper size (which can be determined with CCMIOGetDimensions()). If actual node data is stored in a different format than requested, it will be converted. For multidimensional arrays, the parameter isC specifies whether the data should be returned in Fortran or C order. Since data is stored in Fortran order on disk, returning C order involves an extra copy.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIORead2d CCMIOError  err,
CCMIONode   node,
double *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and value. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIORead2f CCMIOError  err,
CCMIONode   node,
float *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and value. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIORead2i CCMIOError  err,
CCMIONode   node,
int *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and value. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIORead3d CCMIOError  err,
CCMIONode   node,
double *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and value. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIORead3f CCMIOError  err,
CCMIONode   node,
float *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and value. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIORead3i CCMIOError  err,
CCMIONode   node,
int *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and value. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadNoded CCMIOError  err,
CCMIONode   parent,
char const *   name,
double *   value
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and value. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadNodef CCMIOError  err,
CCMIONode   parent,
char const *   name,
float *   value
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and value. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadNodei CCMIOError  err,
CCMIONode   parent,
char const *   name,
int *   value
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and value. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadNodestr CCMIOError  err,
CCMIONode   parent,
char const *   name,
char **   value
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and value. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOSetDataType CCMIOError  err,
CCMIONode   node,
CCMIODataType   type,
...  
-
- - - - - -
-   - - -

-Sets the datatype of the node. -

-

Parameters:
- - - - - -
err  -Error input and output. If the incoming error is not kCCMIONoErr, the function will do nothing. Is set to the function's return value on exit.
node  -The node
type  -The datatype
...  -The number and size of the dimensions (passed as CCMIOIndex), terminated with a kCCMIOEndArgs. For instance an array of "int ary[5][10];" would be "CCMIOReadDataPoint(node, data, 5ul, 10ul, kCCMIOEndArgs)". A single dimension of size 1 is equivalent to a scalar value.
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOSetDataTypev CCMIOError  err,
CCMIONode   node,
CCMIODataType   type,
int   nDims,
CCMIOIndex const *   dims
-
- - - - - -
-   - - -

-Opens the data file. -

-The file will be created if it does not already exist.

Parameters:
- - - - -
filename  -Name of the file to open.
mode  -Mode to open the file: kCCMIORead or kCCMIOWrite.
root  -Returns the root node of the file.
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOSetLabel CCMIOError  err,
CCMIONode   node,
char const *   label
-
- - - - - -
-   - - -

-Sets the label of an existing node. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOSetName CCMIOError  err,
CCMIONode   node,
char const *   name
-
- - - - - -
-   - - -

-Sets the name of an existing node. -

-

Parameters:
- - - - -
err  -Error input and output. If the incoming error is not kCCMIONoErr, the function will do nothing. Is set to the function's return value on exit.
node  -The node whose name is to be set.
name  -The name of the node. If the file type (e.g. ADF) limits lengths of names, the name will be truncated.
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOvSetDataType CCMIOError  err,
CCMIONode   node,
CCMIODataType   type,
va_list   args
-
- - - - - -
-   - - -

-Opens the data file. -

-The file will be created if it does not already exist.

Parameters:
- - - - -
filename  -Name of the file to open.
mode  -Mode to open the file: kCCMIORead or kCCMIOWrite.
root  -Returns the root node of the file.
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWrite1d CCMIOError  err,
CCMIONode   node,
CCMIOIndex   n,
double const *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and value. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWrite1f CCMIOError  err,
CCMIONode   node,
CCMIOIndex   n,
float const *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and value. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWrite1i CCMIOError  err,
CCMIONode   node,
CCMIOIndex   n,
int const *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Writes the entire array to the node. -

-The node's size and data type will be automatically set to the proper values. See CCMIORead*() for comments on the isC parameter.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWrite2d CCMIOError  err,
CCMIONode   node,
CCMIOIndex   x,
CCMIOIndex   y,
double const *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and value. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWrite2f CCMIOError  err,
CCMIONode   node,
CCMIOIndex   x,
CCMIOIndex   y,
float const *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and value. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWrite2i CCMIOError  err,
CCMIONode   node,
CCMIOIndex   x,
CCMIOIndex   y,
int const *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and value. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWrite3d CCMIOError  err,
CCMIONode   node,
CCMIOIndex   x,
CCMIOIndex   y,
CCMIOIndex   z,
double const *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and value. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWrite3f CCMIOError  err,
CCMIONode   node,
CCMIOIndex   x,
CCMIOIndex   y,
CCMIOIndex   z,
float const *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and value. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWrite3i CCMIOError  err,
CCMIONode   node,
CCMIOIndex   x,
CCMIOIndex   y,
CCMIOIndex   z,
int const *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and value. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteNoded CCMIOError  err,
CCMIONode   parent,
char const *   name,
double   value
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and value. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteNodef CCMIOError  err,
CCMIONode   parent,
char const *   name,
float   value
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and value. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteNodei CCMIOError  err,
CCMIONode   parent,
char const *   name,
int   value
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and value. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteNodestr CCMIOError  err,
CCMIONode   parent,
char const *   name,
char const *   value
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and string value. -

-

-


Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00026.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00026.html deleted file mode 100644 index cb56c9ee75..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00026.html +++ /dev/null @@ -1,6179 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

Intermediate API

The Intermediate API provides a higher level method of accessing data than the Core API. -More... - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Basic functions

CCMIOError CCMIOOpenFile (CCMIOError *err, char const *file, CCMIOIOType mode, CCMIOID *root)
 Opens an CCMIO file.

CCMIOError CCMIOCloseFile (CCMIOError *err, CCMIOID root)
 Closes all references to the CCMIO file.

CCMIOError CCMIOGetVersion (CCMIOError *err, CCMIONode root, int *version)
 Returns the version number of the file.

CCMIOError CCMIOSetVersion (CCMIOError *err, CCMIONode root, int version)
 Sets the version number of the file.

CCMIOError CCMIOGetTitle (CCMIOError *err, CCMIONode root, char **title)
 Returns the title of the file.

CCMIOError CCMIOSetTitle (CCMIOError *err, CCMIONode root, char const *title)
 Sets the title of the file.


Functions for Optional Nodes

CCMIOError CCMIOWriteOpti (CCMIOError *err, CCMIOID parent, char const *name, int value)
 Creates a child node of parent with given name and scalar value.

CCMIOError CCMIOWriteOptf (CCMIOError *err, CCMIOID parent, char const *name, float value)
 Creates a child node of parent with given name and scalar value.

CCMIOError CCMIOWriteOptd (CCMIOError *err, CCMIOID parent, char const *name, double value)
 Creates a child node of parent with given name and scalar value.

CCMIOError CCMIOWriteOptstr (CCMIOError *err, CCMIOID parent, char const *name, char const *value)
 Creates a child node of parent with given name and string value.

CCMIOError CCMIOReadOpti (CCMIOError *err, CCMIOID parent, char const *name, int *value)
 Creates a child node of parent with given name and scalar value.

CCMIOError CCMIOReadOptf (CCMIOError *err, CCMIOID parent, char const *name, float *value)
 Creates a child node of parent with given name and scalar value.

CCMIOError CCMIOReadOptd (CCMIOError *err, CCMIOID parent, char const *name, double *value)
 Creates a child node of parent with given name and scalar value.

CCMIOError CCMIOReadOptstr (CCMIOError *err, CCMIOID parent, char const *name, int *size, char *value)
 Creates a child node of parent with given name and scalar value.

CCMIOError CCMIOReadOpt1i (CCMIOError *err, CCMIOID parent, char const *name, int *data, CCMIOIndex start, CCMIOIndex end)
 Reads a one-dimensional array from the child node of 'parent' with name 'name' into 'data'.

CCMIOError CCMIOReadOpt1f (CCMIOError *err, CCMIOID parent, char const *name, float *data, CCMIOIndex start, CCMIOIndex end)
 Reads a one-dimensional array from the child node of 'parent' with name 'name' into 'data'.

CCMIOError CCMIOReadOpt1d (CCMIOError *err, CCMIOID parent, char const *name, double *data, CCMIOIndex start, CCMIOIndex end)
 Reads a one-dimensional array from the child node of 'parent' with name 'name' into 'data'.

CCMIOError CCMIOReadOpt2i (CCMIOError *err, CCMIOID parent, char const *name, int *data, CCMIOIndex start, CCMIOIndex end)
 Reads a two-dimensional array from the child node of 'parent' with name 'name' into 'data'.

CCMIOError CCMIOReadOpt2f (CCMIOError *err, CCMIOID parent, char const *name, float *data, CCMIOIndex start, CCMIOIndex end)
 Reads a two-dimensional array from the child node of 'parent' with name 'name' into 'data'.

CCMIOError CCMIOReadOpt2d (CCMIOError *err, CCMIOID parent, char const *name, double *data, CCMIOIndex start, CCMIOIndex end)
 Reads a two-dimensional array from the child node of 'parent' with name 'name' into 'data'.

CCMIOError CCMIOReadOpt3i (CCMIOError *err, CCMIOID parent, char const *name, int *data, CCMIOIndex start, CCMIOIndex end)
 Reads a three-dimensional array from the child node of 'parent' with name 'name' into 'data'.

CCMIOError CCMIOReadOpt3f (CCMIOError *err, CCMIOID parent, char const *name, float *data, CCMIOIndex start, CCMIOIndex end)
 Reads a three-dimensional array from the child node of 'parent' with name 'name' into 'data'.

CCMIOError CCMIOReadOpt3d (CCMIOError *err, CCMIOID parent, char const *name, double *data, CCMIOIndex start, CCMIOIndex end)
 Reads a three-dimensional array from the child node of 'parent' with name 'name' into 'data'.

CCMIOError CCMIOWriteOpt1i (CCMIOError *err, CCMIOID const parent, char const *name, CCMIOSize const n, int const *data, CCMIOIndex start, CCMIOIndex end)
 Writes a one-dimensional array to a child node of 'parent' with name 'name'.

CCMIOError CCMIOWriteOpt1f (CCMIOError *err, CCMIOID parent, char const *name, CCMIOSize n, float const *data, CCMIOIndex start, CCMIOIndex end)
 Writes a one-dimensional array to a child node of 'parent' with name 'name'.

CCMIOError CCMIOWriteOpt1d (CCMIOError *err, CCMIOID parent, char const *name, CCMIOSize n, double const *data, CCMIOIndex start, CCMIOIndex end)
 Writes a one-dimensional array to a child node of 'parent' with name 'name'.

CCMIOError CCMIOWriteOpt2i (CCMIOError *err, CCMIOID const parent, char const *name, CCMIOIndex x, CCMIOIndex y, int const *data, CCMIOIndex start, CCMIOIndex end)
 Writes a two-dimensional array to a child node of 'parent' with name 'name'.

CCMIOError CCMIOWriteOpt2f (CCMIOError *err, CCMIOID parent, char const *name, CCMIOIndex x, CCMIOIndex y, float const *data, CCMIOIndex start, CCMIOIndex end)
 Writes a two-dimensional array to a child node of 'parent' with name 'name'.

CCMIOError CCMIOWriteOpt2d (CCMIOError *err, CCMIOID parent, char const *name, CCMIOIndex x, CCMIOIndex y, double const *data, CCMIOIndex start, CCMIOIndex end)
 Writes a two-dimensional array to a child node of 'parent' with name 'name'.

CCMIOError CCMIOWriteOpt3i (CCMIOError *err, CCMIOID parent, char const *name, CCMIOIndex x, CCMIOIndex y, CCMIOIndex z, int const *data, CCMIOIndex start, CCMIOIndex end)
 Writes a three-dimensional array to a child node of 'parent' with name 'name'.

CCMIOError CCMIOWriteOpt3f (CCMIOError *err, CCMIOID parent, char const *name, CCMIOIndex x, CCMIOIndex y, CCMIOIndex z, float const *data, CCMIOIndex start, CCMIOIndex end)
 Writes a three-dimensional array to a child node of 'parent' with name 'name'.

CCMIOError CCMIOWriteOpt3d (CCMIOError *err, CCMIOID parent, char const *name, CCMIOIndex x, CCMIOIndex y, CCMIOIndex z, double const *data, CCMIOIndex start, CCMIOIndex end)
 Writes a three-dimensional array to a child node of 'parent' with name 'name'.

CCMIOError CCMIOGetOptInfo (CCMIOError *err, CCMIOID parent, char const *name, CCMIODataType *type, CCMIOIndex *x, CCMIOIndex *y, CCMIOIndex *z)
 Returns information about the optional node.


Intermediate API

void CCMIOInvalidateEntity (CCMIOID *entity)
 Marks the entity as invalid.

int CCMIOIsValidEntity (CCMIOID entity)
 Returns TRUE if the entity is valid, FALSE otherwise.

int CCMIOIsFromSameFile (CCMIOID entity1, CCMIOID entity2)
 Returns TRUE if the two entities are from the same file, FALSE otherwise.

CCMIOError CCMIONewEntity (CCMIOError *err, CCMIOID parent, CCMIOEntity type, char const *description, CCMIOID *id)
 Creates a new entity.

CCMIOError CCMIOGetEntity (CCMIOError *err, CCMIOID parent, CCMIOEntity type, int idVal, CCMIOID *id)
 Retrieves an entity.

CCMIOError CCMIONewIndexedEntity (CCMIOError *err, CCMIOID parent, CCMIOEntity which, int idVal, char const *description, CCMIOID *id)
 Creates a new entity identified by an index number.

CCMIOError CCMIOGetEntityIndex (CCMIOError *err, CCMIOID id, int *n)
 Returns the index (i.e.

CCMIOError CCMIONewState (CCMIOError *err, CCMIOID root, char const *name, CCMIOID *problemDescription, char const *description, CCMIOID *state)
 Creates a new state.

CCMIOError CCMIOGetState (CCMIOError *err, CCMIOID root, char const *name, CCMIOID *problemDescription, CCMIOID *state)
 Marks the entity as invalid.

CCMIOError CCMIOWriteState (CCMIOError *err, CCMIOID state, CCMIOID problemDescription, char const *description)
 Writes the problem description node to the state.

CCMIOError CCMIONewField (CCMIOError *err, CCMIOID phase, char const *name, char const *shortName, CCMIODimensionality dim, CCMIOID *field)
 Marks the entity as invalid.

CCMIOError CCMIOGetField (CCMIOError *err, CCMIOID phase, char const *name, CCMIODimensionality *dim, CCMIOID *field)
 Retrieves a field entity.

CCMIOError CCMIOReadField (CCMIOError *err, CCMIOID field, char *name, char *shortName, CCMIODimensionality *dim, CCMIODataType *datatype)
 Reads information about a field.

CCMIOError CCMIONewProstarSet (CCMIOError *err, CCMIOID root, const char *name, const char *longName, CCMIOID *setID)
 Creates a new prostar set.

CCMIOError CCMIOGetProstarSet (CCMIOError *err, CCMIOID root, const char *name, int *longNameSize, char *longName, unsigned int *setsAvailableFlag, CCMIOID *setID)
 Gets a prostar set.

CCMIOError CCMIODeleteEntity (CCMIOError *err, CCMIOID id)
 Deletes the entity and all of its children.

CCMIOError CCMIONextEntity (CCMIOError *err, CCMIOID parent, CCMIOEntity type, int *i, CCMIOID *next)
 Marks the entity as invalid.

CCMIOError CCMIOEntitySize (CCMIOError *err, CCMIOID id, CCMIOSize *n, CCMIOIndex *max)
 Returns the number of elements and the maximum element ID in the specified entity.

CCMIOError CCMIOEntityName (CCMIOError *err, CCMIOID id, char *name)
 Gets the name of the entity.

CCMIOError CCMIOEntityLabel (CCMIOError *err, CCMIOID id, CCMIOSize *size, char *label)
 Gets the label of the entity.

CCMIOError CCMIOEntityDescription (CCMIOError *err, CCMIOID id, CCMIOSize *size, char *desc)
 Gets the description (if any) of the specified entity.

CCMIOError CCMIOGetEntityNode (CCMIOError *err, CCMIOID id, CCMIONode *node)
 Returns the CCMIO node corresponding to this entity.

CCMIOError CCMIOEntityDataType (CCMIOError *err, CCMIOID id, CCMIODataType *type)
 Returns the data type of the main data of the entity.

CCMIOError CCMIOWriteMap (CCMIOError *err, CCMIOID id, CCMIOSize n, CCMIOSize max, int const *data, CCMIOIndex start, CCMIOIndex end)
 Writes the map data.

CCMIOError CCMIOReadMap (CCMIOError *err, CCMIOID id, int *data, CCMIOIndex start, CCMIOIndex end)
 Reads the map data.

CCMIOError CCMIOReadVerticesf (CCMIOError *err, CCMIOID id, int *dims, float *scale, CCMIOID *mapID, float *vertices, CCMIOIndex start, CCMIOIndex end)
 Reads the vertex data.

CCMIOError CCMIOReadVerticesd (CCMIOError *err, CCMIOID id, int *dims, float *scale, CCMIOID *mapID, double *vertices, CCMIOIndex start, CCMIOIndex end)
 Reads the vertex data.

CCMIOError CCMIOWriteVerticesf (CCMIOError *err, CCMIOID id, int dims, float scale, CCMIOID mapID, float const *vertices, CCMIOIndex start, CCMIOIndex end)
 Writes the vertex data.

CCMIOError CCMIOWriteVerticesd (CCMIOError *err, CCMIOID id, int dims, float scale, CCMIOID mapID, double const *vertices, CCMIOIndex start, CCMIOIndex end)
 Writes the vertex data.

CCMIOError CCMIOReadCells (CCMIOError *err, CCMIOID id, CCMIOID *mapID, int *cellTypes, CCMIOIndex start, CCMIOIndex end)
 Reads the cell data.

CCMIOError CCMIOWriteCells (CCMIOError *err, CCMIOID id, CCMIOID mapID, int *cellTypes, CCMIOIndex start, CCMIOIndex end)
 Writes the cell data.

CCMIOError CCMIOReadFaces (CCMIOError *err, CCMIOID entity, CCMIOEntity which, CCMIOID *mapID, CCMIOSize *streamSize, int *vertexStream, CCMIOIndex start, CCMIOIndex end)
 Reads the face data.

CCMIOError CCMIOWriteFaces (CCMIOError *err, CCMIOID entity, CCMIOEntity which, CCMIOID mapID, CCMIOSize streamSize, int const *vertexStream, CCMIOIndex start, CCMIOIndex end)
 Writes the face data.

CCMIOError CCMIOReadFaceCells (CCMIOError *err, CCMIOID entity, CCMIOEntity which, int *cells, CCMIOIndex start, CCMIOIndex end)
 Reads the faces' cell associations with the faces.

CCMIOError CCMIOWriteFaceCells (CCMIOError *err, CCMIOID entity, CCMIOEntity which, CCMIOID mapID, int const *cells, CCMIOIndex start, CCMIOIndex end)
 Writes the face data.

CCMIOError CCMIOWriteProcessor (CCMIOError *err, CCMIOID processor, char const *verticesFile, CCMIOID *vertices, char const *topologyFile, CCMIOID *topology, char const *initialFieldFile, CCMIOID *initialField, char const *solutionFile, CCMIOID *solution)
 Writes the processor information.

CCMIOError CCMIOReadProcessor (CCMIOError *err, CCMIOID processor, CCMIOID *vertices, CCMIOID *topology, CCMIOID *initialField, CCMIOID *solution)
 Reads the processor information.

CCMIOError CCMIOClearProcessor (CCMIOError *err, CCMIOID state, CCMIOID processor, int clearVertices, int clearTopology, int clearInitialField, int clearSolution, int clearLagrangian)
 Clears the relevant information from the processor.

CCMIOError CCMIOWriteLagrangianData (CCMIOError *err, CCMIOID lagrangian, char const *positionsFile, CCMIOID *positions, char const *solutionFile, CCMIOID *solution)
 Writes Lagrangian data.

CCMIOError CCMIOReadLagrangianData (CCMIOError *err, CCMIOID lagrangian, CCMIOID *positions, CCMIOID *solution)
 Reads the Langrangian information.

CCMIOError CCMIOWriteMultiDimensionalFieldData (CCMIOError *err, CCMIOID fieldID, CCMIOComponent component, CCMIOID componentField)
 Writes one component of a vector or tensor data field.

CCMIOError CCMIOReadMultiDimensionalFieldData (CCMIOError *err, CCMIOID fieldID, CCMIOComponent component, CCMIOID *componentField)
 Gets the field ID of one component of a vector or tensor data field.

CCMIOError CCMIOWriteFieldDataf (CCMIOError *err, CCMIOID fieldData, CCMIOID mapID, CCMIODataLocation loc, float *data, CCMIOIndex start, CCMIOIndex end)
 Writes scalar data for a field.

CCMIOError CCMIOWriteFieldDatad (CCMIOError *err, CCMIOID fieldData, CCMIOID mapID, CCMIODataLocation loc, double *data, CCMIOIndex start, CCMIOIndex end)
 Writes the data for a field.

CCMIOError CCMIOWriteFieldDatai (CCMIOError *err, CCMIOID fieldData, CCMIOID mapID, CCMIODataLocation loc, int *data, CCMIOIndex start, CCMIOIndex end)
 Writes the data for a field.

CCMIOError CCMIOWriteConstantFieldDataf (CCMIOError *err, CCMIOID fieldData, CCMIOID mapID, CCMIODataLocation loc, float value)
 Writes data for a field that is constant.

CCMIOError CCMIOWriteConstantFieldDatad (CCMIOError *err, CCMIOID fieldData, CCMIOID mapID, CCMIODataLocation loc, double value)
 Writes data for a field that is constant.

CCMIOError CCMIOWriteConstantFieldDatai (CCMIOError *err, CCMIOID fieldData, CCMIOID mapID, CCMIODataLocation loc, int value)
 Writes data for a field that is constant.

CCMIOError CCMIOReadFieldDataf (CCMIOError *err, CCMIOID fieldData, CCMIOID *mapID, CCMIODataLocation *loc, float *data, CCMIOIndex start, CCMIOIndex end)
 Reads scalar data from a field.

CCMIOError CCMIOReadFieldDatad (CCMIOError *err, CCMIOID fieldData, CCMIOID *mapID, CCMIODataLocation *loc, double *data, CCMIOIndex start, CCMIOIndex end)
 Reads the data from a field.

CCMIOError CCMIOReadFieldDatai (CCMIOError *err, CCMIOID fieldData, CCMIOID *mapID, CCMIODataLocation *loc, int *data, CCMIOIndex start, CCMIOIndex end)
 Reads the data from a field.

CCMIOError CCMIOWriteRestartInfo (CCMIOError *err, CCMIOID restartInfo, char const *solverName, int iteration, float time, char const *timeUnits, float startAngle)
 Writes the solver restart entity.

CCMIOError CCMIOReadRestartInfo (CCMIOError *err, CCMIOID restartInfo, char *solverName, int *iteration, float *time, char *timeUnits, float *startAngle)
 Reads the solver restart entity.

CCMIOError CCMIOV2WriteFaceCells (CCMIOError *err, CCMIOID entity, CCMIOEntity which, CCMIOSize nFace, int const *cells, CCMIOIndex start, CCMIOIndex end)
-

Detailed Description

-The Intermediate API provides a higher level method of accessing data than the Core API. -

-


Function Documentation

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOClearProcessor CCMIOError  err,
CCMIOID   state,
CCMIOID   processor,
int   clearVertices,
int   clearTopology,
int   clearInitialField,
int   clearSolution,
int   clearLagrangian
-
- - - - - -
-   - - -

-Clears the relevant information from the processor. -

-If this information is not used elsewhere, it will be removed from the file.

Parameters:
- - - - - - - - -
state  -The state that is the parent of this processor.
processor  -The processor to clear.
clearVertices  -If TRUE, vertex information will be cleared. If FALSE, it will be untouched.
clearTopology  -If TRUE, topology information will be cleared. If FALSE, it will be untouched.
clearInitialField  -If TRUE, initial field information will be cleared. If FALSE, it will be untouched.
clearSolution  -If TRUE, solution post data will be cleared. If FALSE, it will be untouched.
clearLagrangian  -If TRUE, any Lagrangian data will be cleared. If FALSE, it will be untouched.
-
Examples:
-writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOCloseFile CCMIOError  err,
CCMIOID   root
-
- - - - - -
-   - - -

-Closes all references to the CCMIO file. -

-Closing an already closed file generates a kCCMIOBadParameterErr.

Examples:
-readexample.cpp, rewriteexample.cpp, and writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIODeleteEntity CCMIOError  err,
CCMIOID   id
-
- - - - - -
-   - - -

-Deletes the entity and all of its children. -

-Note that deleting a processor without calling CCMIOClearProcessor() first will not delete entites that become unused as a result of the delete (e.g. the mesh and post data referred to by that processor) and may lead to wasted disk space. However, calling CCMIODeleteEntity on a state entity is safe.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOEntityDataType CCMIOError  err,
CCMIOID   id,
CCMIODataType  type
-
- - - - - -
-   - - -

-Returns the data type of the main data of the entity. -

-Currently only valid for vertices.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOEntityDescription CCMIOError  err,
CCMIOID   id,
CCMIOSize  size,
char *   desc
-
- - - - - -
-   - - -

-Gets the description (if any) of the specified entity. -

-

Parameters:
- - - -
size  -Returns the size of the string. May be NULL if the information is not desired.
desc  -Returns the description string. This must be allocated to at least as large as the number of characters + 1 and may be NULL if the information is not desired.
-
Examples:
-readexample.cpp, and rewriteexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOEntityLabel CCMIOError  err,
CCMIOID   id,
CCMIOSize  size,
char *   label
-
- - - - - -
-   - - -

-Gets the label of the entity. -

-

Deprecated:
-Use CCMIOEntityDescription() instead.
Parameters:
- - - -
size  -Returns the length of the label (not including a terminating NULL). May be NULL if the information is not required.
name  -Returns the label. Must be at least 'size' + 1 bytes. If there is no label, this will be the empty string. May be NULL if the information is not required.
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOEntityName CCMIOError  err,
CCMIOID   id,
char *   name
-
- - - - - -
-   - - -

-Gets the name of the entity. -

-Although this is not useful for most entities, it may be convenient for named entities (kCCMIOState, kCCMIOField).

Parameters:
- - -
name  -Returns the name of the entity. Must be at least kCCMIOMaxStringLength + 1.
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOEntitySize CCMIOError  err,
CCMIOID   id,
CCMIOSize  n,
CCMIOIndex  max
-
- - - - - -
-   - - -

-Returns the number of elements and the maximum element ID in the specified entity. -

-Either 'n' or 'max' may be NULL if the information is not desired.

Examples:
-readexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOGetEntity CCMIOError  err,
CCMIOID   parent,
CCMIOEntity   type,
int   idVal,
CCMIOID  id
-
- - - - - -
-   - - -

-Retrieves an entity. -

-Although it is mostly an internal function, it is necessary for retrieving the cell and internal face entities.

Parameters:
- - - - - -
parent  -For top-level entities this may be any CCMIOID in the same file, but for child entities this must be the actual parent.
type  -The type of entity to be retrieved.
idVal  -For entites that may have siblings, this specifies the ID number of the entity (this is most useful internally). For entities that may not have siblings (e.g. cells and internal faces) this value is ignored.
id  -The CCMIOID of the created entity.
-
Examples:
-readexample.cpp, and rewriteexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOGetEntityIndex CCMIOError  err,
CCMIOID   id,
int *   n
-
- - - - - -
-   - - -

-Returns the index (i.e. -

-the id) of the given indexed entity. (See CCMIONewIndexedEntity() for more details and a list of valid entities.)

Examples:
-readexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOGetEntityNode CCMIOError  err,
CCMIOID   id,
CCMIONode  node
-
- - - - - -
-   - - -

-Returns the CCMIO node corresponding to this entity. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOGetField CCMIOError  err,
CCMIOID   phase,
char const *   name,
CCMIODimensionality  dim,
CCMIOID  field
-
- - - - - -
-   - - -

-Retrieves a field entity. -

-

Parameters:
- - - - - -
phase  -The FieldPhase entity.
name  -The name of the field (limited to kCCMIOMaxStringLength characters, not including a terminating NULL).
dim  -Returns the number of dimensions kCCMIOTensor).
field  -The CCMIOID of the field entity.
-
Examples:
-rewriteexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOGetOptInfo CCMIOError  err,
CCMIOID   parent,
char const *   name,
CCMIODataType  type,
CCMIOIndex  x,
CCMIOIndex  y,
CCMIOIndex  z
-
- - - - - -
-   - - -

-Returns information about the optional node. -

-

Parameters:
- - - - - - - -
parant  -The parent node.
name  -Name of the child entity.
type  -Returns the data type of the child. Can be NULL if the information is not desired.
x  -Returns the size of the first dimension (1 if the node is a scalar). Can be NULL.
y  -Returns the size of the third dimension (0 if the node is one dimensional). Can be NULL.
z  -Returns the size of the first dimension (0 if the node is less than three dimensions). Can be NULL.
-
Examples:
-readexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOGetProstarSet CCMIOError  err,
CCMIOID   root,
const char *   name,
int *   longNameSize,
char *   longName,
unsigned int *   setsAvailableFlag,
CCMIOID  setID
-
- - - - - -
-   - - -

-Gets a prostar set. -

-

Parameters:
- - - - - -
name  -The name of the set.
longNameSize  -The size of the long name, not including the C string terminator. Can be NULL if the size is not desired.
longName  -The long name. Can be NULL if the information is not desired.
setsAvailableFlag  -Lists the available sets. The sets can be read using CCMIOReadOpti(). Can be NULL if not desired.
-
ma setID The CCMIOID of the prostar set. Can be NULL if not
- desired.
Examples:
-readexample.cpp, and rewriteexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOGetState CCMIOError  err,
CCMIOID   root,
char const *   name,
CCMIOID  problemDescription,
CCMIOID  state
-
- - - - - -
-   - - -

-Marks the entity as invalid. -

-Further CCMIO calls will fail, until a call (such as CCMIOGetEntity()) writes a valid entity into it.

Examples:
-readexample.cpp, and rewriteexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOGetTitle CCMIOError  err,
CCMIONode   root,
char **   title
-
- - - - - -
-   - - -

-Returns the title of the file. -

-Note that the returned string is allocated by the library and must be freed by the user. It is null-terminated.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOGetVersion CCMIOError  err,
CCMIONode   root,
int *   version
-
- - - - - -
-   - - -

-Returns the version number of the file. -

-

-

- - - - -
- - - - - - - - - - -
void CCMIOInvalidateEntity CCMIOID  entity
-
- - - - - -
-   - - -

-Marks the entity as invalid. -

-Further CCMIO calls will fail, until a call (such as CCMIOGetEntity()) writes a valid entity into it.

Examples:
-rewriteexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - -
int CCMIOIsFromSameFile CCMIOID   entity1,
CCMIOID   entity2
-
- - - - - -
-   - - -

-Returns TRUE if the two entities are from the same file, FALSE otherwise. -

-

-

- - - - -
- - - - - - - - - - -
int CCMIOIsValidEntity CCMIOID   entity
-
- - - - - -
-   - - -

-Returns TRUE if the entity is valid, FALSE otherwise. -

-Note that unitialized entities will likely return TRUE, even though they are not actually valid. Use CCMIOInvalidateEntity() to initialize them.

Examples:
-readexample.cpp, and rewriteexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIONewEntity CCMIOError  err,
CCMIOID   parent,
CCMIOEntity   type,
char const *   description,
CCMIOID  id
-
- - - - - -
-   - - -

-Creates a new entity. -

-

Parameters:
- - - - - -
parent  -For top-level entities this may be any CCMIOID in the same file, but for child entities this must be the actual parent.
type  -The type of entity to be created.
description  -An optional description of the entity. Passing NULL will omit a description.
id  -The CCMIOID of the created entity.
-
Examples:
-rewriteexample.cpp, and writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIONewField CCMIOError  err,
CCMIOID   phase,
char const *   name,
char const *   shortName,
CCMIODimensionality   dim,
CCMIOID  field
-
- - - - - -
-   - - -

-Marks the entity as invalid. -

-Further CCMIO calls will fail, until a call (such as CCMIOGetEntity()) writes a valid entity into it.

Examples:
-rewriteexample.cpp, and writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIONewIndexedEntity CCMIOError  err,
CCMIOID   parent,
CCMIOEntity   which,
int   idVal,
char const *   description,
CCMIOID  id
-
- - - - - -
-   - - -

-Creates a new entity identified by an index number. -

-Although almost all entities are internally identified by an ID number, this number is unimportant for most entities and is only used internally. Some entities, however, are most easily identified with a number and for these entities (kCCMIOBoundaryFaces, kCCMIOCellType, and kCCMIOBoundaryRegion) the ID number is provided by the creator. The entities, called indexed entities, can be created with this function.

Parameters:
- - - - - - -
parent  -The CCMIOID of the parent entity.
idVal  -The boundary ID number.
which  -May be kCCMIOBoundaryFaces, kCCMIOCellType, or kCCMIOBoundaryRegion.
description  -An optional description (NULL for no description)
id  -The CCMIOID to the new entity.
-
Examples:
-rewriteexample.cpp, and writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIONewProstarSet CCMIOError  err,
CCMIOID   root,
const char *   name,
const char *   longName,
CCMIOID  setID
-
- - - - - -
-   - - -

-Creates a new prostar set. -

-The sets can be written with CCMIOWriteOpti(). If called on a pre-existing set, all contents of the original set will be removed.

Parameters:
- - - - -
name  -The name of the set. This is limited to kCCMIOMaxStringLength.
longName  -The name of the set; length is not limited. If no long name is desired, NULL may be passed here, and the short name will be used.
setID  -The CCMIOID of the new prostar set. Can be NULL if not desired.
-
Examples:
-rewriteexample.cpp, and writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIONewState CCMIOError  err,
CCMIOID   root,
char const *   name,
CCMIOID  problemDescription,
char const *   description,
CCMIOID  state
-
- - - - - -
-   - - -

-Creates a new state. -

-If a state with that name exists, its contents, including processor entities, will be cleared.

Parameters:
- - - - - - -
root  -The root node of the file (returned by CCMIOOpenFile()).
name  -The name of the new state (limited to kCCMIOMaxStringLength characters, not including a terminating NULL).
problemDescription  -The CCMIOID of the problemDescription entity relevant to this state, or NULL if there is none.
state  -The CCMIOID of the new entity.
description  -An optional description string (NULL for no description)
-
Examples:
-rewriteexample.cpp, and writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIONextEntity CCMIOError  err,
CCMIOID   parent,
CCMIOEntity   type,
int *   i,
CCMIOID  next
-
- - - - - -
-   - - -

-Marks the entity as invalid. -

-Further CCMIO calls will fail, until a call (such as CCMIOGetEntity()) writes a valid entity into it.

Examples:
-readexample.cpp, rewriteexample.cpp, and writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOOpenFile CCMIOError  err,
char const *   file,
CCMIOIOType   mode,
CCMIOID  root
-
- - - - - -
-   - - -

-Opens an CCMIO file. -

-Calling CCMIOOpenFile() multiple times on a file does not create multiple references to it; thus if CCMIOOpenFile() is called five times on the same file, only one CCMIOCloseFile() is required.

Examples:
-readexample.cpp, rewriteexample.cpp, and writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadCells CCMIOError  err,
CCMIOID   id,
CCMIOID  mapID,
int *   cellTypes,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Reads the cell data. -

-

Parameters:
- - - - - - -
id  -The CCMIOID of the cell entity.
mapID  -Returns the CCMIOID of the map corresponding to this entity. May be NULL if the information is not desired.
cellTypes  -Returns an array of cell type information. May be NULL if the information is not desired.
start  -The beginning cell.
end  -The ending cell. Data from 'start' to 'end' -1 will be read. If end is zero, data will be read from 'start' to the end of the data.
-
Examples:
-readexample.cpp, and rewriteexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadFaceCells CCMIOError  err,
CCMIOID   entity,
CCMIOEntity   which,
int *   cells,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Reads the faces' cell associations with the faces. -

-

Parameters:
- - - - - - - -
entity  -The face entity.
which  -Either kCCMIOInternalFaces or kCCMIOBoundaryFaces.
mapID  -Returns the CCMIOID of the map associated with these faces. May be NULL if the information is not desired.
cells  -If reading internal faces, this is a two dimensional array with size [nFaces][2]. If reading boundary faces it is a one dimensional array of size nFaces. Must be pre-allocated to the correct size. May be NULL if the information is not desired.
start  -The beginning face.
end  -The ending face. Data from 'start' to 'end' -1 will be read. If end is zero, data will be read from 'start' to the end of the data.
-
To read the whole array, set start to kCCMIOStart and end to kCCMIOEnd. -

-Note: When writing partial arrays, the first block of the array you write must have start equal to kCCMIOStart.

Examples:
-readexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadFaces CCMIOError  err,
CCMIOID   entity,
CCMIOEntity   which,
CCMIOID  mapID,
CCMIOSize  streamSize,
int *   vertexStream,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Reads the face data. -

-

Parameters:
- - - - - - - - -
entity  -The face entity.
which  -Either kCCMIOInternalFaces or kCCMIOBoundaryFaces.
mapID  -Returns the CCMIOID of the map associated with these faces. May be NULL if the information is not desired.
streamSize  -Returns the total number of elements in the vertexStream. May be NULL if the information is not desired.
vertexStream  -Returns the vertices in the faces in the form
- nVerts v1 v2 ... vn
- nVerts v1 v2 ... vn
-    ...

- Note that if the stream is being buffered (with 'start' and 'end'), only a piece of the stream will be returned, and may be in the middle of a face.
start  -The beginning element.
end  -The ending element. Data from 'start' to 'end' -1 will be read. If end is zero, data will be read from 'start' to the end of the data.
-
To read the whole array, set start to kCCMIOStart and end to kCCMIOEnd.
Examples:
-readexample.cpp, and rewriteexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadField CCMIOError  err,
CCMIOID   field,
char *   name,
char *   shortName,
CCMIODimensionality  dim,
CCMIODataType  datatype
-
- - - - - -
-   - - -

-Reads information about a field. -

-Note that this does not read the data of the node; use CCMIOReadFieldData(f|v|i)() for that. This is for determining the name of the field when using CCMIONextEntity().

Parameters:
- - - - - - -
field  -The CCMIOID of the field.
name  -Returns the name of the field. Must be allocated to at least kCCMIOMaxStringLength + 1 characters.
shortName  -Returns the short name of the field. Must be allocated to at least kCCMIOProstarShortName + 1 characters.
dim  -Returns the dimensions of the field.
datatype  -Returns the type of data. Only valid for scalar data; Vector and tensor components are not required to be the same data type (kCCMIOUnknownType will be returned for non-scalar data). May be NULL if the information is not desired.
-
Examples:
-readexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadFieldDatad CCMIOError  err,
CCMIOID   fieldData,
CCMIOID  mapID,
CCMIODataLocation  loc,
double *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Reads the data from a field. -

-The data is returned in double-precision so if the original data is single-precision it will be converted. See CCMIOReadFieldDataf() for a full description.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadFieldDataf CCMIOError  err,
CCMIOID   fieldData,
CCMIOID  mapID,
CCMIODataLocation  loc,
float *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Reads scalar data from a field. -

-The data is returned in single-precision so if the original data is double-precision it will be converted. If the data is a constant value, the entire array will be filled with that value.
-
- Note: If the file pre-dates vector and tensor data being stored as separate components (that is, if CCMIOReadMultiDimensionalArray() returns a kCCMIOVersion error), CCMIOReadFieldDataf() may be used to read the data. If this is the case, CCMIOReadFieldDataf() will automatically return the multidimensional data into 'data', and 'data' must be big enough to accomodate it.

Parameters:
- - - - - - - -
fieldData  -The CCMIOID of the field entity.
mapID  -Returns the CCMIOID of the map corresponding to this field. May be NULL if not desired.
loc  -Returns the type of data this node is (cell, vertex, face). May be NULL if not desired.
data  -The data, must be preallocated to [n], [n][3], or [n][3][3] for kCCMIOScalar, kCCMIOVector, and kCCMIOTensor data, respectively. May be NULL if not desired.
start  -The offset of the element pointed to by 'data'. Must Be in units of of the first element; so if float data[10][3][3]; then start can be in the range [0, 9].
end  -The element one beyond the end. So to read from [2, 5], start = 2, end = 6, which reads from data[2][0][0] to data[5][3][3]. (Note that newer files will only have scalar data)
-
Examples:
-readexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadFieldDatai CCMIOError  err,
CCMIOID   fieldData,
CCMIOID  mapID,
CCMIODataLocation  loc,
int *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Reads the data from a field. -

-The data is returned in double-precision so if the original data is single-precision it will be converted. See CCMIOReadFieldDataf() for a full description.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadLagrangianData CCMIOError  err,
CCMIOID   lagrangian,
CCMIOID  positions,
CCMIOID  solution
-
- - - - - -
-   - - -

-Reads the Langrangian information. -

-The returned entities may be in a a different file and this will need to be closed with CCMIOClose, but since the node might be the root of the current file, they should not be closed until the end. 'positions' and 'solution' may be NULL if the information is not desired.

Examples:
-readexample.cpp, and rewriteexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadMap CCMIOError  err,
CCMIOID   id,
int *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Reads the map data. -

-

Parameters:
- - - -
id  -The CCMIOID of the map.
data  -The map data. Must be pre-allocated to the correct number of elements (given by CCMIOEntitySize()).
-
Examples:
-readexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadMultiDimensionalFieldData CCMIOError  err,
CCMIOID   fieldID,
CCMIOComponent   component,
CCMIOID  componentField
-
- - - - - -
-   - - -

-Gets the field ID of one component of a vector or tensor data field. -

-Although applications should specify all components, if there is a kCCMIONoNodeErr reading the entity, the application should assume that this component was not written and should use a proper default value (presumably 0.0). If the file is from an older version of the library that stores multiple dimensions in one node, a kCCMIOVersionErr is returned. In this case CCMIOReadFieldData*() will read a multiple dimensional array, instead of just one component.

Parameters:
- - - - -
fieldID  -The postdata field.
component  -The component (kCCMIOVectorX to kCCMIOVectorZ and kCCMIOTensorXX to kCCMIOTensorZZ).
componentField  -The component field ID.
-
Examples:
-readexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadOpt1d CCMIOError  err,
CCMIOID   parent,
char const *   name,
double *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Reads a one-dimensional array from the child node of 'parent' with name 'name' into 'data'. -

-See CCMIOReadOpt1f() for a complete description.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadOpt1f CCMIOError  err,
CCMIOID   parent,
char const *   name,
float *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Reads a one-dimensional array from the child node of 'parent' with name 'name' into 'data'. -

-'data' must be the proper size (which can be determined with CCMIOGetDimensions()). If actual node data is stored in a different format than requested (i.e. float or double), it will be converted.

Parameters:
- - - - -
parent  -The parent entity.
name  -Name of the child node.
data  -Data to be read into. Must be non-NULL.
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadOpt1i CCMIOError  err,
CCMIOID   parent,
char const *   name,
int *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Reads a one-dimensional array from the child node of 'parent' with name 'name' into 'data'. -

-See CCMIOReadOpt1f() for a complete description.

Examples:
-readexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadOpt2d CCMIOError  err,
CCMIOID   parent,
char const *   name,
double *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Reads a two-dimensional array from the child node of 'parent' with name 'name' into 'data'. -

-See CCMIOReadOpt2f() for a complete description.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadOpt2f CCMIOError  err,
CCMIOID   parent,
char const *   name,
float *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Reads a two-dimensional array from the child node of 'parent' with name 'name' into 'data'. -

-'data' must be the proper size (which can be determined with CCMIOGetDimensions()). If actual node data is stored in a different format than requested (i.e. float or double), it will be converted.

Parameters:
- - - - - - -
parent  -The parent entity.
name  -Name of the child node.
data  -Data to be read into. Must be non-NULL.
start  -The offset of the element pointed to by 'data'. Must Be in units of of the first element; so if float data[10][3]; then start can be in the range [0, 9].
end  -The element one beyond the end. So to read from [2, 5], start = 2, end = 6, which reads from data[2][0] to data[5][3].
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadOpt2i CCMIOError  err,
CCMIOID   parent,
char const *   name,
int *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Reads a two-dimensional array from the child node of 'parent' with name 'name' into 'data'. -

-See CCMIOReadOpt2f() for a complete description.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadOpt3d CCMIOError  err,
CCMIOID   parent,
char const *   name,
double *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Reads a three-dimensional array from the child node of 'parent' with name 'name' into 'data'. -

-See CCMIOReadOpt3f() for a complete description.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadOpt3f CCMIOError  err,
CCMIOID   parent,
char const *   name,
float *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Reads a three-dimensional array from the child node of 'parent' with name 'name' into 'data'. -

-'data' must be the proper size (which can be determined with CCMIOGetDimensions()). If actual node data is stored in a different format than requested (i.e. float or double), it will be converted.

Parameters:
- - - - - - -
parent  -The parent entity.
name  -Name of the child node.
data  -Data to be read into. Must be non-NULL.
start  -The offset of the element pointed to by 'data'. Must Be in units of of the first element; so if float data[10][3][3]; then start can be in the range [0, 9].
end  -The element one beyond the end. So to read from [2, 5], start = 2, end = 6, which reads from data[2][0][0] to data[5][3][3].
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadOpt3i CCMIOError  err,
CCMIOID   parent,
char const *   name,
int *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Reads a three-dimensional array from the child node of 'parent' with name 'name' into 'data'. -

-See CCMIOReadOpt3f() for a complete description.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadOptd CCMIOError  err,
CCMIOID   parent,
char const *   name,
double *   value
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and scalar value. -

-If the node already exists it will be overwritten.

Parameters:
- - - - -
parent  -The parent entity.
name  -Name of the child node.
value  -Scalar value to be written.
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadOptf CCMIOError  err,
CCMIOID   parent,
char const *   name,
float *   value
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and scalar value. -

-If the node already exists it will be overwritten.

Parameters:
- - - - -
parent  -The parent entity.
name  -Name of the child node.
value  -Scalar value to be written.
-
Examples:
-readexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadOpti CCMIOError  err,
CCMIOID   parent,
char const *   name,
int *   value
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and scalar value. -

-If the node already exists it will be overwritten.

Parameters:
- - - - -
parent  -The parent entity.
name  -Name of the child node.
value  -Scalar value to be written.
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadOptstr CCMIOError  err,
CCMIOID   parent,
char const *   name,
int *   size,
char *   value
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and scalar value. -

-If the node already exists it will be overwritten.

Parameters:
- - - - -
parent  -The parent entity.
name  -Name of the child node.
value  -Scalar value to be written.
-
Examples:
-readexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadProcessor CCMIOError  err,
CCMIOID   processor,
CCMIOID  vertices,
CCMIOID  topology,
CCMIOID  initialField,
CCMIOID  solution
-
- - - - - -
-   - - -

-Reads the processor information. -

-The returned entities may be in a a different file and this will need to be closed with CCMIOClose, but since the node might be the root of the current file, they should not be closed until the end. 'positions' and 'solution' may be NULL if the information is not desired.

Examples:
-readexample.cpp, and rewriteexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadRestartInfo CCMIOError  err,
CCMIOID   restartInfo,
char *   solverName,
int *   iteration,
float *   time,
char *   timeUnits,
float *   startAngle
-
- - - - - -
-   - - -

-Reads the solver restart entity. -

-Any pointer may be NULL if the information is not desired.

Examples:
-readexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadVerticesd CCMIOError  err,
CCMIOID   id,
int *   dims,
float *   scale,
CCMIOID  mapID,
double *   vertices,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Reads the vertex data. -

-

Parameters:
- - - - - - - - -
id  -The CCMIOID of the vertices.
dims  -Returns the dimensionality of the vertex (i.e. 2 or 3). May be NULL if the information is not desired.
scale  -Returns the scaling factor. May be NULL if the information is not desired.
mapID  -Returns the CCMIOID of the map corresponding to this entity. May be NULL if the information is not desired.
vertices  -A two dimensional array of size [nVerts][dims]. Must be pre-allocated to the correct size. May be NULL if the information is not desired.
start  -The offset (in units of vertices) of the starting vertex.
end  -The offset (in units of vertices) of the ending vertex. Data from start to end - 1 will be read. If end is kCCMIOEnd, data will be read from 'start' to the end of the data.
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOReadVerticesf CCMIOError  err,
CCMIOID   id,
int *   dims,
float *   scale,
CCMIOID  mapID,
float *   vertices,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Reads the vertex data. -

-

Parameters:
- - - - - - - - -
id  -The CCMIOID of the vertices.
dims  -Returns the dimensionality of the vertex (i.e. 2 or 3). May be NULL if the information is not desired.
scale  -Returns the scaling factor. May be NULL if the information is not desired.
mapID  -Returns the CCMIOID of the map corresponding to this entity. May be NULL if the information is not desired.
vertices  -A two dimensional array of size [nVerts][dims]. Must be pre-allocated to the correct size. May be NULL if the information is not desired.
start  -The offset (in units of vertices) of the starting vertex.
end  -The offset (in units of vertices) of the ending vertex. Data from start to end - 1 will be read. If end is kCCMIOEnd, data will be read from 'start' to the end of the data.
-
Examples:
-readexample.cpp, and rewriteexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOSetTitle CCMIOError  err,
CCMIONode   root,
char const *   title
-
- - - - - -
-   - - -

-Sets the title of the file. -

-The string must be null-terminated.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOSetVersion CCMIOError  err,
CCMIONode   root,
int   version
-
- - - - - -
-   - - -

-Sets the version number of the file. -

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOV2WriteFaceCells CCMIOError  err,
CCMIOID   entity,
CCMIOEntity   which,
CCMIOSize   nFace,
int const *   cells,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

- -

-For internal use only. -

- Writes the face data. See CCMIOReadFaces() for a description of the parameters. -

-Note: When writing partial arrays, the first block of the array you write must have start equal to zero.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteCells CCMIOError  err,
CCMIOID   id,
CCMIOID   mapID,
int *   cellTypes,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Writes the cell data. -

-

Parameters:
- - - - - - -
id  -The CCMIOID of the cell entity.
mapID  -The CCMIOID of the map corresponding to this entity.
cellTypes  -Returns an array of cell type information.
start  -The beginning cell.
end  -The ending cell. Data from 'start' to 'end' -1 will be read. If end is zero, data will be written from 'start' to the end of the data. Note: When writing partial arrays, the first block of the array you write must have start equal to kCCMIOStart.
-
Examples:
-rewriteexample.cpp, and writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteConstantFieldDatad CCMIOError  err,
CCMIOID   fieldData,
CCMIOID   mapID,
CCMIODataLocation   loc,
double   value
-
- - - - - -
-   - - -

-Writes data for a field that is constant. -

-See CCMIOWriteConstantFieldDataf() for a description of the parameters.

Examples:
-rewriteexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteConstantFieldDataf CCMIOError  err,
CCMIOID   fieldData,
CCMIOID   mapID,
CCMIODataLocation   loc,
float   value
-
- - - - - -
-   - - -

-Writes data for a field that is constant. -

-Note that it is possible for one type of data (e.g. kCCMIOCellValues) to be constant and another type to be specified. (Whether this is meaningful is another issue.)

Parameters:
- - - - - -
fieldData  -The CCMIOID of the field entity.
mapID  -The CCMIOID of the map corresponding to this field.
loc  -What type of data this node is (cell, vertex, face)
value  -The constant value.
-
Examples:
-rewriteexample.cpp, and writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteConstantFieldDatai CCMIOError  err,
CCMIOID   fieldData,
CCMIOID   mapID,
CCMIODataLocation   loc,
int   value
-
- - - - - -
-   - - -

-Writes data for a field that is constant. -

-See CCMIOWriteConstantFieldDataf() for a description of the parameters.

Examples:
-rewriteexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteFaceCells CCMIOError  err,
CCMIOID   entity,
CCMIOEntity   which,
CCMIOID   mapID,
int const *   cells,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Writes the face data. -

-See CCMIOReadFaces() for a description of the parameters. -

-Note: When writing partial arrays, the first block of the array you write must have start equal to zero.

Examples:
-rewriteexample.cpp, and writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteFaces CCMIOError  err,
CCMIOID   entity,
CCMIOEntity   which,
CCMIOID   mapID,
CCMIOSize   streamSize,
int const *   vertexStream,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Writes the face data. -

-See CCMIOReadFaces() for a description of the parameters.

Parameters:
- - - -
streamSize  -The total number of integers in the vertex stream.
vertexStream  -The stream of vertices that compose a face. This should be in the form:
- nVerts v1 v2 ... vn
- nVerts v1 v2 ... vn
-    ...

-
-
Note: When writing partial arrays, the first block of the array you write must have start equal to zero.
Examples:
-rewriteexample.cpp, and writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteFieldDatad CCMIOError  err,
CCMIOID   fieldData,
CCMIOID   mapID,
CCMIODataLocation   loc,
double *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Writes the data for a field. -

-See CCMIOWriteFieldDataf() for a description of the paramaters.

Examples:
-rewriteexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteFieldDataf CCMIOError  err,
CCMIOID   fieldData,
CCMIOID   mapID,
CCMIODataLocation   loc,
float *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Writes scalar data for a field. -

-Vector or tensor data should be written as individual components and each component written with CCMIOWriteMultiDimensionalFieldData(). Note that if CCMIOWriteMultiDimensionalFieldData() returns a kCCMIOVersionErr, this function will read an old-style field, which will return all components of the array at once, so the 'data' array will need to be 3 or 9 (depending on whether vector or tensor data is being read) times longer.

Parameters:
- - - - - - - -
fieldData  -The CCMIOID of the field entity.
mapID  -The CCMIOID of the map corresponding to this field.
loc  -What type of data this node is (cell, vertex, face)
data  -The data.
start  -The offset of the element pointed to by 'data'. Must Be in units of of the first element; so if float data[10][3][3]; then start can be in the range [0, 9].
end  -The element one beyond the end. So to write from [2, 5], start = 2, end = 6, which writes from data[2][0][0] to data[5][3][3].
-
Note: When writing partial arrays, the first block of the array you write must have start equal to kCCMIOStart.
Examples:
-rewriteexample.cpp, and writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteFieldDatai CCMIOError  err,
CCMIOID   fieldData,
CCMIOID   mapID,
CCMIODataLocation   loc,
int *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Writes the data for a field. -

-See CCMIOWriteFieldDataf() for a description of the paramaters.

Examples:
-rewriteexample.cpp, and writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteLagrangianData CCMIOError  err,
CCMIOID   lagrangian,
char const *   positionsFile,
CCMIOID  positions,
char const *   solutionFile,
CCMIOID  solution
-
- - - - - -
-   - - -

-Writes Lagrangian data. -

-

Parameters:
- - - - - -
positionsFile  -The file that contains the positions node, NULL for this file.
positions  -The node that contains the positions. This node must be a kCCMIOVertices node. (Vertices and positions ultimately store the same data) This node may be NULL if no position data is to be written.
solutionFile  -The file containing the solution node, or NULL for this file.
solution  -The solution node (field set entity). May be NULL if not solution data is to be written.
-
Examples:
-rewriteexample.cpp, and writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteMap CCMIOError  err,
CCMIOID   id,
CCMIOSize   n,
CCMIOSize   max,
int const *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Writes the map data. -

-

Parameters:
- - - - - - - -
id  -The CCMIOID of the map.
n  -The total number of elements to be written.
max  -The maximum element value.
data  -The map data.
start  -The offset of the starting data.
end  -The offset of the ending data. Data from start to end - 1 will be written. If end is kCCMIOEnd, data will be writen from 'start' to the end of the data.
-
To write the whole array, set start to kCCMIOStart and end to kCCMIOEnd. -

-Note: When writing partial arrays, the first block of the array you write must have start equal to kCCMIOStart.

Examples:
-rewriteexample.cpp, and writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteMultiDimensionalFieldData CCMIOError  err,
CCMIOID   fieldID,
CCMIOComponent   component,
CCMIOID   componentField
-
- - - - - -
-   - - -

-Writes one component of a vector or tensor data field. -

-

Parameters:
- - - - -
fieldID  -The postdata field.
component  -The component (kCCMIOVectorX to kCCMIOVectorZ and kCCMIOTensorXX to kCCMIOTensorZZ). All components should be specified. If a component is not specified, the application is free to use whatever default value it feels is correct.
componentField  -The component field ID.
-
Examples:
-rewriteexample.cpp, and writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteOpt1d CCMIOError  err,
CCMIOID   parent,
char const *   name,
CCMIOSize   n,
double const *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Writes a one-dimensional array to a child node of 'parent' with name 'name'. -

-See CCMIOWriteOpt1f() for a complete description.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteOpt1f CCMIOError  err,
CCMIOID   parent,
char const *   name,
CCMIOSize   n,
float const *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Writes a one-dimensional array to a child node of 'parent' with name 'name'. -

-If the child node does not exist it will be created and in either case its size and data type will be automatically set to the proper values.

Parameters:
- - - - - - - -
parent  -The parent entity.
name  -Name of the child node.
n  -The total number of elements to be written. If not writing the entire array this is the number of elements that will be ultmately be written.
data  -The data to be written.
start  -When writing partial arrays, where to start writing.
end  -When writing partial arrays, where to stop writing. (The write will be from data[start] to data[start-1]) Note: When writing partial arrays, the first block of the array you write must have start equal to kCCMIOStart.
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteOpt1i CCMIOError  err,
CCMIOID const   parent,
char const *   name,
CCMIOSize const   n,
int const *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Writes a one-dimensional array to a child node of 'parent' with name 'name'. -

-See CCMIOWriteOpt1f() for a complete description.

Examples:
-rewriteexample.cpp, and writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteOpt2d CCMIOError  err,
CCMIOID   parent,
char const *   name,
CCMIOIndex   x,
CCMIOIndex   y,
double const *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Writes a two-dimensional array to a child node of 'parent' with name 'name'. -

-See CCMIOWriteOpt2f() for a complete description.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteOpt2f CCMIOError  err,
CCMIOID   parent,
char const *   name,
CCMIOIndex   x,
CCMIOIndex   y,
float const *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Writes a two-dimensional array to a child node of 'parent' with name 'name'. -

-If the child node does not exist it will be created and in either case its size and data type will be automatically set to the proper values. 'data' is expected to be an array of data[x][y] elements. Note that although the CCM specification specifies dimension in FORTRAN ordering, the API expects C ordering. Thus a C array data[x][y] must be called as CCMIOWriteOpt2f(..., x, y, ...), even though the dimensions will be reversed on disk.

Parameters:
- - - - - - - - -
parent  -The parent node.
name  -Name of the child entity.
x  -The size of the first C dimension.
y  -The size of the second C dimension.
data  -The data to be written.
start  -The offset of the element pointed to by 'data'. Must Be in units of of the first element; so if float data[10][3]; then start can be in the range [0, 9].
end  -The element one beyond the end. So to write from [2, 5], start = 2, end = 6, which writes from data[2][0] to data[5][3]. Note: When writing partial arrays, the first block of the array you write must have start equal to kCCMIOStart.
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteOpt2i CCMIOError  err,
CCMIOID const   parent,
char const *   name,
CCMIOIndex   x,
CCMIOIndex   y,
int const *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Writes a two-dimensional array to a child node of 'parent' with name 'name'. -

-See CCMIOWriteOpt2f() for a complete description.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteOpt3d CCMIOError  err,
CCMIOID   parent,
char const *   name,
CCMIOIndex   x,
CCMIOIndex   y,
CCMIOIndex   z,
double const *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Writes a three-dimensional array to a child node of 'parent' with name 'name'. -

-See CCMIOWriteOpt3f() for a complete description.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteOpt3f CCMIOError  err,
CCMIOID   parent,
char const *   name,
CCMIOIndex   x,
CCMIOIndex   y,
CCMIOIndex   z,
float const *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Writes a three-dimensional array to a child node of 'parent' with name 'name'. -

-If the child node does not exist it will be created and in either case its size and data type will be automatically set to the proper values. 'data' is expected to be an array of data[x][y] elements. Note that although the CCM specification specifies dimension in FORTRAN ordering, the API expects C ordering. Thus a C array data[x][y] must be called as CCMIOWriteOpt3f(..., x, y, z, ...), even though the dimensions will be reversed on disk.

Parameters:
- - - - - - - - - - -
parent  -The parent node.
name  -Name of the child entity.
isC  -TRUE if 'data' is in C array order, FALSE if in Fortran array order.
x  -The size of the first dimension.
y  -The size of the second dimension.
z  -The size of the third dimension.
data  -The data to be written.
start  -The offset of the element pointed to by 'data'. Must be in units of of the first element; so if float data[10][3][3]; then start can be in the range [0, 9].
end  -The element one beyond the end. So to write from [2, 5], start = 2, end = 6, which writes from data[2][0][0] to data[5][3][3]. Note: When writing partial arrays, the first block of the array you write must have start equal to kCCMIOStart.
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteOpt3i CCMIOError  err,
CCMIOID   parent,
char const *   name,
CCMIOIndex   x,
CCMIOIndex   y,
CCMIOIndex   z,
int const *   data,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Writes a three-dimensional array to a child node of 'parent' with name 'name'. -

-See CCMIOWriteOpt3f() for a complete description.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteOptd CCMIOError  err,
CCMIOID   parent,
char const *   name,
double   value
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and scalar value. -

-If the node already exists it will be overwritten.

Parameters:
- - - - -
parent  -The parent entity.
name  -Name of the child node.
value  -Scalar value to be written.
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteOptf CCMIOError  err,
CCMIOID   parent,
char const *   name,
float   value
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and scalar value. -

-If the node already exists it will be overwritten.

Parameters:
- - - - -
parent  -The parent entity.
name  -Name of the child node.
value  -Scalar value to be written.
-
Examples:
-rewriteexample.cpp, and writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteOpti CCMIOError  err,
CCMIOID   parent,
char const *   name,
int   value
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and scalar value. -

-If the node already exists it will be overwritten.

Parameters:
- - - - -
parent  -The parent entity.
name  -Name of the child node.
value  -Scalar value to be written.
-
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteOptstr CCMIOError  err,
CCMIOID   parent,
char const *   name,
char const *   value
-
- - - - - -
-   - - -

-Creates a child node of parent with given name and string value. -

-If the node already exists it will be overwritten.

Parameters:
- - - - -
parent  -The parent entity.
name  -Name of the child node.
value  -Null-terminated string.
-
Examples:
-rewriteexample.cpp, and writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteProcessor CCMIOError  err,
CCMIOID   processor,
char const *   verticesFile,
CCMIOID  vertices,
char const *   topologyFile,
CCMIOID  topology,
char const *   initialFieldFile,
CCMIOID  initialField,
char const *   solutionFile,
CCMIOID  solution
-
- - - - - -
-   - - -

-Writes the processor information. -

-

Parameters:
- - - - - - - - - - -
processor  -The CCMIOID of the processor entity.
verticesFile  -The name of the file that the vertices are stored in. NULL indicates the current file.
vertices  -The CCMIOID of the vertices entity. If NULL, vertices information will be unchanged.
topologyFile  -The name of the file that the mesh is stored in. NULL indicates the current file.
topology  -The CCMIOID of the mesh entity. If NULL, mesh information will be unchanged.
initialFieldFile  -The name of the file that the inital field is stored in. NULL indicates the current file.
initialField  -The CCMIOID of the initial field set entity. If NULL, the initial field information will be unchanged.
solutionFile  -The name of the file that the solution data is stored in. NULL indicates the current file.
vertices  -The CCMIOID of the solution data field set entity. If NULL, vertices information will be unchanged.
-
Examples:
-rewriteexample.cpp, and writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteRestartInfo CCMIOError  err,
CCMIOID   restartInfo,
char const *   solverName,
int   iteration,
float   time,
char const *   timeUnits,
float   startAngle
-
- - - - - -
-   - - -

-Writes the solver restart entity. -

-

Parameters:
- - - - - - - -
restartInfo  -The restart entity.
solverName  -The name of the solver that is writing this node. only the first kCCMIOMaxStringLength characters are meaningful.
iteration  -The iteration number.
time  -The time (in solver units, with 0.0 being the initial time).
timeUnits  -A string describing the units of time. If NULL, the units default to "s".
startAngle  -The starting angle of the mesh. Should be 0.0 if the mesh is not rotating.
-
Examples:
-rewriteexample.cpp, and writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteState CCMIOError  err,
CCMIOID   state,
CCMIOID   problemDescription,
char const *   description
-
- - - - - -
-   - - -

-Writes the problem description node to the state. -

-Note that there is not an CCMIOReadState(); this functionality is incorporated in CCMIOGetState().

Parameters:
- - -
description  -Optional character string describing the state. Pass NULL for no description (note that this will remove any existing description).
-
Examples:
-rewriteexample.cpp, and writeexample.cpp.
-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteVerticesd CCMIOError  err,
CCMIOID   id,
int   dims,
float   scale,
CCMIOID   mapID,
double const *   vertices,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Writes the vertex data. -

-

Parameters:
- - - - - - - - -
id  -The CCMIOID of the vertices.
dims  -Returns the dimensionality of the vertex (i.e. 2 or 3).
scale  -Returns the scaling factor.
mapID  -Returns the CCMIOID of the map corresponding to this entity.
vertices  -A two dimensional array of size [nVerts][dims].
start  -The offset (in units of vertices) of the starting vertex.
end  -The offset (in units of vertices) of the ending vertex. Data from start to end - 1 will be read. If end is kCCMIOEnd, data will be written from 'start' to the end of the data.
-
To write the whole array, set start to kCCMIOStart and end to kCCMIOEnd. -

-Note: When writing partial arrays, the first block of the array you write must have start equal to zero.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCMIOError CCMIOWriteVerticesf CCMIOError  err,
CCMIOID   id,
int   dims,
float   scale,
CCMIOID   mapID,
float const *   vertices,
CCMIOIndex   start,
CCMIOIndex   end
-
- - - - - -
-   - - -

-Writes the vertex data. -

-

Parameters:
- - - - - - - - -
id  -The CCMIOID of the vertices.
dims  -Returns the dimensionality of the vertex (i.e. 2 or 3).
scale  -Returns the scaling factor.
mapID  -Returns the CCMIOID of the map corresponding to this entity.
vertices  -A two dimensional array of size [nVerts][dims].
start  -The offset (in units of vertices) of the starting vertex.
end  -The offset (in units of vertices) of the ending vertex. Data from start to end - 1 will be read. If end is kCCMIOEnd, data will be written from 'start' to the end of the data.
-
To write the whole array, set start to kCCMIOStart and end to kCCMIOEnd. -

-Note: When writing partial arrays, the first block of the array you write must have start equal to zero.

Examples:
-rewriteexample.cpp, and writeexample.cpp.
-


Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00027.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00027.html deleted file mode 100644 index 6b4d0acfeb..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00027.html +++ /dev/null @@ -1,408 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

/u/xeona04/people/prewett/src/libccmio/libccmio/ccmio.h

Go to the documentation of this file.
00001 #ifndef CCMIO_H
-00002 #define CCMIO_H
-00003 
-00004 /*@@
-00005  *  Program: Star File Format Library  - $RCSfile: ccmio.h,v $
-00006  *  Author:  Geoff Prewett
-00007  *  Date:    July 28, 2003
-00008  *
-00009  *
-00010  *  Star File Format Library - Copyright (C) 2003 by adapco, Ltd.
-00011  *
-00012  *  This program is the property of adapco, Ltd. and contains
-00013  *  confidential and proprietary information.  The unauthorized use,
-00014  *  distribution, or duplication of this program is prohibited.
-00015  *  All rights reserved.
-00016  *
-00017  *  $Id: ccmio.h,v 1.18 2006/06/05 21:12:16 geoffp Exp $
-00018  */
-00019 
-00020 #ifdef __cplusplus
-00021 extern "C" {
-00022 #endif
-00023 
-00024 #include "libccmio/ccmiotypes.h"
-00025 
-00026 /* \{ \name Basic functions
-00027       \ingroup intermediate */
-00028 
-00032 extern CCMIOError CCMIOOpenFile( CCMIOError *err, char const *file,
-00033                                  CCMIOIOType mode, CCMIOID *root );
-00034 
-00037 extern CCMIOError CCMIOCloseFile( CCMIOError *err, CCMIOID root );
-00038 
-00040 extern CCMIOError CCMIOGetVersion( CCMIOError *err, CCMIONode root,
-00041                                    int *version );
-00042 
-00044 extern CCMIOError CCMIOSetVersion( CCMIOError *err, CCMIONode root,
-00045                                    int version );
-00046 
-00049 extern CCMIOError CCMIOGetTitle( CCMIOError *err, CCMIONode root, char **title );
-00050 
-00052 extern CCMIOError CCMIOSetTitle( CCMIOError *err, CCMIONode root,
-00053                                  char const *title );
-00054 
-00055 /* \} */
-00056 /* \{ \name Functions for Optional Nodes
-00057       \ingroup intermediate */
-00058 
-00064 extern CCMIOError CCMIOWriteOpti( CCMIOError *err, CCMIOID parent,
-00065                                   char const *name, int value );
-00066 
-00072 extern CCMIOError CCMIOWriteOptf( CCMIOError *err, CCMIOID parent,
-00073                                   char const *name, float value );
-00074 
-00080 extern CCMIOError CCMIOWriteOptd( CCMIOError *err, CCMIOID parent,
-00081                                   char const *name, double value );
-00082 
-00088 extern CCMIOError CCMIOWriteOptstr( CCMIOError *err, CCMIOID parent,
-00089                                     char const *name, char const *value );
-00090 
-00096 extern CCMIOError CCMIOReadOpti( CCMIOError *err, CCMIOID parent,
-00097                                  char const *name, int *value );
-00098 
-00104 extern CCMIOError CCMIOReadOptf( CCMIOError *err, CCMIOID parent,
-00105                                  char const *name, float *value );
-00106 
-00112 extern CCMIOError CCMIOReadOptd( CCMIOError *err, CCMIOID parent,
-00113                                  char const *name, double *value );
-00114 
-00120 extern CCMIOError CCMIOReadOptstr( CCMIOError *err, CCMIOID parent,
-00121                                    char const *name, int *size, char *value );
-00122 
-00126 extern CCMIOError CCMIOReadOpt1i( CCMIOError *err, CCMIOID parent,
-00127                                   char const *name, int *data,
-00128                                   CCMIOIndex start, CCMIOIndex end );
-00137 extern CCMIOError CCMIOReadOpt1f( CCMIOError *err, CCMIOID parent,
-00138                                   char const *name, float *data,
-00139                                   CCMIOIndex start, CCMIOIndex end );
-00143 extern CCMIOError CCMIOReadOpt1d( CCMIOError *err, CCMIOID parent,
-00144                                   char const *name, double *data,
-00145                                   CCMIOIndex start, CCMIOIndex end );
-00149 extern CCMIOError CCMIOReadOpt2i( CCMIOError *err, CCMIOID parent,
-00150                                   char const *name, int *data,
-00151                                   CCMIOIndex start, CCMIOIndex end );
-00167 extern CCMIOError CCMIOReadOpt2f( CCMIOError *err, CCMIOID parent,
-00168                                   char const *name, float *data,
-00169                                   CCMIOIndex start, CCMIOIndex end );
-00173 extern CCMIOError CCMIOReadOpt2d( CCMIOError *err, CCMIOID parent,
-00174                                   char const *name, double *data,
-00175                                   CCMIOIndex start, CCMIOIndex end );
-00179 extern CCMIOError CCMIOReadOpt3i( CCMIOError *err, CCMIOID parent,
-00180                                   char const *name, int *data,
-00181                                   CCMIOIndex start, CCMIOIndex end );
-00197 extern CCMIOError CCMIOReadOpt3f( CCMIOError *err, CCMIOID parent,
-00198                                   char const *name, float *data,
-00199                                   CCMIOIndex start, CCMIOIndex end );
-00203 extern CCMIOError CCMIOReadOpt3d( CCMIOError *err, CCMIOID parent,
-00204                                   char const *name, double *data,
-00205                                   CCMIOIndex start, CCMIOIndex end );
-00206 
-00209 extern CCMIOError CCMIOWriteOpt1i( CCMIOError *err, CCMIOID const parent,
-00210                                    char const *name, CCMIOSize const n,
-00211                                    int const *data,
-00212                                    CCMIOIndex start, CCMIOIndex end );
-00227 extern CCMIOError CCMIOWriteOpt1f( CCMIOError *err, CCMIOID parent,
-00228                                    char const *name, CCMIOSize n,
-00229                                    float const *data,
-00230                                    CCMIOIndex start, CCMIOIndex end );
-00233 extern CCMIOError CCMIOWriteOpt1d( CCMIOError *err, CCMIOID parent,
-00234                                    char const *name, CCMIOSize n,
-00235                                    double const *data,
-00236                                    CCMIOIndex start, CCMIOIndex end );
-00239 extern CCMIOError CCMIOWriteOpt2i( CCMIOError *err, CCMIOID const parent,
-00240                                    char const *name, CCMIOIndex x, CCMIOIndex y,
-00241                                    int const *data,
-00242                                    CCMIOIndex start, CCMIOIndex end );
-00265 extern CCMIOError CCMIOWriteOpt2f( CCMIOError *err, CCMIOID parent,
-00266                                    char const *name, CCMIOIndex x, CCMIOIndex y,
-00267                                    float const *data,
-00268                                    CCMIOIndex start, CCMIOIndex end );
-00271 extern CCMIOError CCMIOWriteOpt2d( CCMIOError *err, CCMIOID parent,
-00272                                    char const *name, CCMIOIndex x, CCMIOIndex y,
-00273                                    double const *data,
-00274                                    CCMIOIndex start, CCMIOIndex end );
-00277 extern CCMIOError CCMIOWriteOpt3i( CCMIOError *err, CCMIOID parent,
-00278                                    char const *name,
-00279                                    CCMIOIndex x, CCMIOIndex y, CCMIOIndex z,
-00280                                    int const *data,
-00281                                    CCMIOIndex start, CCMIOIndex end );
-00307 extern CCMIOError CCMIOWriteOpt3f( CCMIOError *err, CCMIOID parent,
-00308                                    char const *name,
-00309                                    CCMIOIndex x, CCMIOIndex y, CCMIOIndex z,
-00310                                    float const *data, CCMIOIndex start,
-00311                                    CCMIOIndex end );
-00314 extern CCMIOError CCMIOWriteOpt3d( CCMIOError *err, CCMIOID parent,
-00315                                    char const *name,
-00316                                    CCMIOIndex x, CCMIOIndex y, CCMIOIndex z,
-00317                                    double const *data, CCMIOIndex start,
-00318                                    CCMIOIndex end );
-00319 
-00331 extern CCMIOError CCMIOGetOptInfo( CCMIOError *err, CCMIOID parent,
-00332                                    char const *name, CCMIODataType *type,
-00333                                    CCMIOIndex *x, CCMIOIndex *y,
-00334                                    CCMIOIndex *z );
-00335 
-00336 /* \} */
-00337 /* \{ \name Intermediate API
-00338       \ingroup intermediate */
-00339 
-00342 extern void CCMIOInvalidateEntity( CCMIOID *entity );
-00343 
-00347 extern int CCMIOIsValidEntity( CCMIOID entity );
-00348 
-00351 extern int CCMIOIsFromSameFile( CCMIOID entity1, CCMIOID entity2 );
-00352 
-00361 extern CCMIOError CCMIONewEntity( CCMIOError *err, CCMIOID parent,
-00362                                   CCMIOEntity type, char const *description,
-00363                                   CCMIOID *id );
-00364 
-00376 extern CCMIOError CCMIOGetEntity( CCMIOError *err, CCMIOID parent,
-00377                                   CCMIOEntity type, int idVal, CCMIOID *id );
-00378 
-00392 extern CCMIOError CCMIONewIndexedEntity( CCMIOError *err, CCMIOID parent,
-00393                                      CCMIOEntity which, int idVal,
-00394                                      char const *description, CCMIOID *id );
-00395 
-00398 extern CCMIOError CCMIOGetEntityIndex( CCMIOError *err, CCMIOID id , int *n );
-00399 
-00411 extern CCMIOError CCMIONewState( CCMIOError *err, CCMIOID root,
-00412                                  char const *name, CCMIOID *problemDescription,
-00413                                  char const *description, CCMIOID *state );
-00414 
-00426 extern CCMIOError CCMIOGetState( CCMIOError *err, CCMIOID root,
-00427                                  char const *name, CCMIOID *problemDescription,
-00428                                  CCMIOID *state );
-00429 
-00436 extern CCMIOError CCMIOWriteState( CCMIOError *err, CCMIOID state,
-00437                                    CCMIOID problemDescription,
-00438                                    char const *description );
-00439 
-00452 extern CCMIOError CCMIONewField( CCMIOError *err, CCMIOID phase,
-00453                                  char const *name, char const *shortName,
-00454                                  CCMIODimensionality dim, CCMIOID *field );
-00455 
-00464 extern CCMIOError CCMIOGetField( CCMIOError *err, CCMIOID phase,
-00465                                  char const *name, CCMIODimensionality *dim,
-00466                                  CCMIOID *field );
-00467 
-00482 extern CCMIOError CCMIOReadField( CCMIOError *err, CCMIOID field, char *name,
-00483                                   char *shortName, CCMIODimensionality *dim,
-00484                                   CCMIODataType *datatype );
-00485 
-00496 CCMIOError CCMIONewProstarSet( CCMIOError *err, CCMIOID root, const char *name,
-00497                                const char *longName, CCMIOID *setID );
-00498 
-00509 CCMIOError CCMIOGetProstarSet( CCMIOError *err, CCMIOID root, const char *name,
-00510                                int *longNameSize, char *longName,
-00511                                unsigned int *setsAvailableFlag,
-00512                                CCMIOID *setID );
-00513 
-00519 extern CCMIOError CCMIODeleteEntity( CCMIOError *err, CCMIOID id );
-00520 
-00531 extern CCMIOError CCMIONextEntity( CCMIOError *err, CCMIOID parent,
-00532                                    CCMIOEntity type, int *i, CCMIOID *next );
-00533 
-00537 extern CCMIOError CCMIOEntitySize( CCMIOError *err, CCMIOID id, CCMIOSize *n,
-00538                                    CCMIOIndex *max );
-00539 
-00544 extern CCMIOError CCMIOEntityName( CCMIOError *err, CCMIOID id, char *name );
-00545 
-00554 extern CCMIOError CCMIOEntityLabel( CCMIOError *err, CCMIOID id,
-00555                                     CCMIOSize *size, char *label );
-00556 
-00563 extern CCMIOError CCMIOEntityDescription( CCMIOError *err, CCMIOID id,
-00564                                           CCMIOSize *size, char *desc );
-00565 
-00567 extern CCMIOError CCMIOGetEntityNode( CCMIOError *err, CCMIOID id,
-00568                                       CCMIONode *node );
-00569 
-00572 extern CCMIOError CCMIOEntityDataType( CCMIOError *err, CCMIOID id,
-00573                                        CCMIODataType *type );
-00574 
-00589 extern CCMIOError CCMIOWriteMap( CCMIOError *err, CCMIOID id,
-00590                                  CCMIOSize n, CCMIOSize max,
-00591                                  int const *data,
-00592                                  CCMIOIndex start, CCMIOIndex end );
-00593 
-00598 extern CCMIOError CCMIOReadMap( CCMIOError *err, CCMIOID id, int *data,
-00599                                 CCMIOIndex start, CCMIOIndex end );
-00600 
-00618 extern CCMIOError CCMIOReadVerticesf( CCMIOError *err, CCMIOID id,
-00619                                       int *dims, float *scale,
-00620                                       CCMIOID *mapID, float  *vertices,
-00621                                       CCMIOIndex start, CCMIOIndex end );
-00639 extern CCMIOError CCMIOReadVerticesd( CCMIOError *err, CCMIOID id,
-00640                                       int *dims, float *scale,
-00641                                       CCMIOID *mapID, double *vertices,
-00642                                       CCMIOIndex start, CCMIOIndex end );
-00661 extern CCMIOError CCMIOWriteVerticesf( CCMIOError *err, CCMIOID id,
-00662                                        int dims, float scale,
-00663                                        CCMIOID mapID, float const *vertices,
-00664                                        CCMIOIndex start, CCMIOIndex end );
-00683 extern CCMIOError CCMIOWriteVerticesd( CCMIOError *err, CCMIOID id,
-00684                                        int dims, float scale,
-00685                                        CCMIOID mapID, double const *vertices,
-00686                                        CCMIOIndex start, CCMIOIndex end );
-00687 
-00698 extern CCMIOError CCMIOReadCells( CCMIOError *err, CCMIOID id, CCMIOID *mapID,
-00699                                   int *cellTypes, CCMIOIndex start,
-00700                                   CCMIOIndex end );
-00701 
-00712 extern CCMIOError CCMIOWriteCells( CCMIOError *err, CCMIOID id, CCMIOID mapID,
-00713                                    int *cellTypes, CCMIOIndex start,
-00714                                    CCMIOIndex end );
-00715 
-00737 extern CCMIOError CCMIOReadFaces( CCMIOError *err, CCMIOID entity,
-00738                                   CCMIOEntity which, CCMIOID *mapID,
-00739                                   CCMIOSize *streamSize, int *vertexStream,
-00740                                   CCMIOIndex start, CCMIOIndex end );
-00741 
-00753 extern CCMIOError CCMIOWriteFaces( CCMIOError *err, CCMIOID entity,
-00754                                    CCMIOEntity which, CCMIOID mapID,
-00755                                    CCMIOSize streamSize,
-00756                                    int const *vertexStream,
-00757                                    CCMIOIndex start, CCMIOIndex end );
-00758 
-00778 CCMIOError CCMIOReadFaceCells( CCMIOError *err, CCMIOID entity,
-00779                                CCMIOEntity which, int *cells,
-00780                                CCMIOIndex start, CCMIOIndex end );
-00781 
-00787 CCMIOError CCMIOWriteFaceCells( CCMIOError *err, CCMIOID entity,
-00788                                 CCMIOEntity which, CCMIOID mapID,
-00789                                 int const *cells, CCMIOIndex start,
-00790                                 CCMIOIndex end );
-00791 
-00812 extern CCMIOError CCMIOWriteProcessor( CCMIOError *err, CCMIOID processor,
-00813                                    char const *verticesFile, CCMIOID *vertices,
-00814                                    char const *topologyFile, CCMIOID *topology,
-00815                                    char const *initialFieldFile, CCMIOID *initialField,
-00816                                    char const *solutionFile, CCMIOID *solution);
-00817 
-00823 extern CCMIOError CCMIOReadProcessor( CCMIOError *err, CCMIOID processor,
-00824                                       CCMIOID *vertices, CCMIOID *topology,
-00825                                       CCMIOID *initialField, CCMIOID *solution);
-00826 
-00841 extern CCMIOError CCMIOClearProcessor( CCMIOError *err, CCMIOID state,
-00842                                        CCMIOID processor,
-00843                                        int clearVertices, int clearTopology,
-00844                                        int clearInitialField, int clearSolution,
-00845                                        int clearLagrangian );
-00846 
-00859 extern CCMIOError CCMIOWriteLagrangianData( CCMIOError *err, CCMIOID lagrangian,
-00860                                             char const *positionsFile,
-00861                                             CCMIOID *positions,
-00862                                             char const *solutionFile,
-00863                                             CCMIOID *solution );
-00864 
-00870 extern CCMIOError CCMIOReadLagrangianData( CCMIOError *err, CCMIOID lagrangian,
-00871                                            CCMIOID *positions,
-00872                                            CCMIOID *solution );
-00873 
-00884 extern CCMIOError CCMIOWriteMultiDimensionalFieldData( CCMIOError *err,
-00885                                                        CCMIOID fieldID,
-00886                                                        CCMIOComponent component,
-00887                                                        CCMIOID componentField );
-00888 
-00903 extern CCMIOError CCMIOReadMultiDimensionalFieldData( CCMIOError *err,
-00904                                                       CCMIOID fieldID,
-00905                                                       CCMIOComponent component,
-00906                                                       CCMIOID *componentField );
-00907 
-00929 extern CCMIOError CCMIOWriteFieldDataf( CCMIOError *err, CCMIOID fieldData,
-00930                                         CCMIOID mapID, CCMIODataLocation loc,
-00931                                         float *data, CCMIOIndex start,
-00932                                         CCMIOIndex end  );
-00935 extern CCMIOError CCMIOWriteFieldDatad( CCMIOError *err, CCMIOID fieldData,
-00936                                         CCMIOID mapID, CCMIODataLocation loc,
-00937                                         double *data, CCMIOIndex start,
-00938                                         CCMIOIndex end  );
-00939 
-00942 extern CCMIOError CCMIOWriteFieldDatai( CCMIOError *err, CCMIOID fieldData,
-00943                                         CCMIOID mapID, CCMIODataLocation loc,
-00944                                         int *data, CCMIOIndex start,
-00945                                         CCMIOIndex end  );
-00946 
-00954 extern CCMIOError CCMIOWriteConstantFieldDataf( CCMIOError *err,
-00955                                                 CCMIOID fieldData,
-00956                                                 CCMIOID mapID,
-00957                                                 CCMIODataLocation loc,
-00958                                                 float value );
-00959 
-00962 extern CCMIOError CCMIOWriteConstantFieldDatad( CCMIOError *err,
-00963                                                 CCMIOID fieldData,
-00964                                                 CCMIOID mapID,
-00965                                                 CCMIODataLocation loc,
-00966                                                 double value );
-00967 
-00970 extern CCMIOError CCMIOWriteConstantFieldDatai( CCMIOError *err,
-00971                                                 CCMIOID fieldData,
-00972                                                 CCMIOID mapID,
-00973                                                 CCMIODataLocation loc,
-00974                                                 int value );
-00975 
-01003 extern CCMIOError CCMIOReadFieldDataf( CCMIOError *err, CCMIOID fieldData,
-01004                                        CCMIOID *mapID, CCMIODataLocation *loc,
-01005                                        float *data, CCMIOIndex start,
-01006                                        CCMIOIndex end  );
-01007 
-01011 extern CCMIOError CCMIOReadFieldDatad( CCMIOError *err, CCMIOID fieldData,
-01012                                        CCMIOID *mapID, CCMIODataLocation *loc,
-01013                                        double *data, CCMIOIndex start,
-01014                                        CCMIOIndex end  );
-01015 
-01019 extern CCMIOError CCMIOReadFieldDatai( CCMIOError *err, CCMIOID fieldData,
-01020                                        CCMIOID *mapID, CCMIODataLocation *loc,
-01021                                        int *data, CCMIOIndex start,
-01022                                        CCMIOIndex end  );
-01023 
-01036 extern CCMIOError CCMIOWriteRestartInfo( CCMIOError *err, CCMIOID restartInfo,
-01037                                          char const *solverName, int iteration,
-01038                                          float time, char const *timeUnits,
-01039                                          float startAngle );
-01040 
-01043 extern CCMIOError CCMIOReadRestartInfo( CCMIOError *err, CCMIOID restartInfo,
-01044                                         char *solverName, int *iteration,
-01045                                         float *time, char *timeUnits,
-01046                                         float *startAngle );
-01047 
-01048 
-01049 
-01050 
-01051   /* I changed this routine to include a parameter for the number of faces to
-01052    * speed it up so that there isn't a database read for every buffer write.
-01053    * WRO 22-Oct-2004 */
-01054 
-01061 extern CCMIOError CCMIOV2WriteFaceCells(
-01062                                   CCMIOError *err, CCMIOID entity,
-01063                                   CCMIOEntity which,
-01064                                   CCMIOSize nFace, int const *cells,
-01065                                   CCMIOIndex start, CCMIOIndex end );
-01066 
-01067 /* \} */
-01068 
-01069 #ifdef __cplusplus
-01070 }
-01071 #endif
-01072 #endif /* CCMIO_H */
-01073 
-01074 
-01075 /* Automatic setting of emacs local variables. */
-01076 /* Local Variables: */
-01077 /* mode: C++ */
-01078 /* tab-width: 8 */
-01079 /* End: */
-

Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00028.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00028.html deleted file mode 100644 index c942c77066..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00028.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

/u/xeona04/people/prewett/src/libccmio/libccmio/ccmiocore.h

Go to the documentation of this file.
00001 #ifndef CCMIO_CORE_H
-00002 #define CCMIO_CORE_H
-00003 
-00004 /*@@
-00005  *  Program: Star File Format Library  - $RCSfile: ccmiocore.h,v $
-00006  *  Author:  Geoff Prewett
-00007  *  Date:    July 28, 2003
-00008  *
-00009  *
-00010  *  Star File Format Library - Copyright (C) 2003 by adapco, Ltd.
-00011  *
-00012  *  This program is the property of adapco, Ltd. and contains
-00013  *  confidential and proprietary information.  The unauthorized use,
-00014  *  distribution, or duplication of this program is prohibited.
-00015  *  All rights reserved.
-00016  *
-00017  *  $Id: ccmiocore.h,v 1.7 2006/06/05 21:12:16 geoffp Exp $
-00018  */
-00019 
-00020 #ifdef __cplusplus
-00021 extern "C" {
-00022 #endif
-00023 
-00024 #define kCCMIOBadNode 0.0
-00025 
-00026 #ifndef MAKEDEPEND
-00027 #include <stdarg.h>
-00028 #endif
-00029 
-00030 #include "libccmio/ccmiotypes.h"
-00031 
-00032 /* \{
-00033    \name Core functions
-00034    \brief The minimal set of functions.
-00035    \ingroup core */
-00036 
-00041 extern CCMIOError CCMIOOpen( char const *filename, CCMIOIOType mode,
-00042                              CCMIONode *root );
-00043 
-00046 extern CCMIOError CCMIOClose( CCMIONode root );
-00047 
-00058 extern CCMIOError CCMIOGetNode( CCMIOError *err, CCMIONode parent,
-00059                                 char const *path, CCMIONode *node );
-00060 
-00062 extern CCMIOError CCMIOGetNumberOfChildren( CCMIOError *err, CCMIONode parent,
-00063                                             int *n );
-00064 
-00077 extern CCMIOError CCMIOGetNextChild( CCMIOError *err, CCMIONode parent, int *n,
-00078                                      CCMIONode *child );
-00079 
-00087 extern CCMIOError CCMIOGetName( CCMIOError *err, CCMIONode node, char *name );
-00088 
-00096 extern CCMIOError CCMIOSetName( CCMIOError *err, CCMIONode node,
-00097                                 char const *name );
-00098 
-00106 extern CCMIOError CCMIOGetLabel( CCMIOError *err, CCMIONode node, char *label );
-00107 
-00109 extern CCMIOError CCMIOSetLabel( CCMIOError *err, CCMIONode node,
-00110                                  char const *label );
-00111 
-00128 extern CCMIOError CCMIOCreateNode( CCMIOError *err, CCMIONode parent,
-00129                                    int openDup, char const *name,
-00130                                    char const *label, CCMIONode *node );
-00131 
-00143 extern CCMIOError CCMIOCreateLink( CCMIOError *err, CCMIONode parent,
-00144                                    char const *name, char const *filename,
-00145                                    char const *destName, CCMIONode *node );
-00146 
-00148 extern CCMIOError CCMIODeleteNode( CCMIOError *err, CCMIONode node );
-00149 
-00151 extern CCMIOError CCMIODeleteAllChildren( CCMIOError *err, CCMIONode node );
-00152 
-00154 extern CCMIOError CCMIOMoveNode( CCMIOError *err, CCMIONode node,
-00155                                  CCMIONode newParent );
-00156 
-00166 extern CCMIOError CCMIOGetDimensions( CCMIOError *err, CCMIONode node,
-00167                                       int *nDims, CCMIOIndex **dims );
-00168 
-00170 extern CCMIOError CCMIOGetDataSize( CCMIOError *err, CCMIONode node,
-00171                                     CCMIOSize *bytes );
-00172 
-00174 extern CCMIOError CCMIOGetDataType( CCMIOError *err, CCMIONode node,
-00175                                     CCMIODataType *type);
-00176 
-00189 extern CCMIOError CCMIOSetDataType( CCMIOError *err, CCMIONode node,
-00190                                     CCMIODataType type, ... );
-00191 extern CCMIOError CCMIOvSetDataType( CCMIOError *err, CCMIONode node,
-00192                                      CCMIODataType type, va_list args );
-00193 extern CCMIOError CCMIOSetDataTypev( CCMIOError *err, CCMIONode node,
-00194                                      CCMIODataType type,
-00195                                      int nDims, CCMIOIndex const *dims );
-00196 
-00247 
-00250 
-00253 
-00258 
-00260 
-00261 
-00262 
-00263 
-

Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00029.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00029.html deleted file mode 100644 index 3c1ea3439c..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00029.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

/u/xeona04/people/prewett/src/libccmio/libccmio/ccmioprivate.h

Go to the documentation of this file.
00001 #ifndef CCMIO_PRIVATE_H
-00002 #define CCMIO_PRIVATE_H
-00003 
-00004 /*@@
-00005  *  Program: Star File Format Library  - $RCSfile: ccmioprivate.h,v $
-00006  *  Author:  Geoff Prewett
-00007  *  Date:    July 31, 2003
-00008  *
-00009  *
-00010  *  Star File Format Library - Copyright (C) 2003 by adapco, Ltd.
-00011  *
-00012  *  This program is the property of adapco, Ltd. and contains
-00013  *  confidential and proprietary information.  The unauthorized use,
-00014  *  distribution, or duplication of this program is prohibited.
-00015  *  All rights reserved.
-00016  *
-00017  *  $Id: ccmioprivate.h,v 1.7 2006/06/05 21:12:16 geoffp Exp $
-00018  */
-00019 
-00020 #ifndef MAKEDEPEND
-00021 #include <stdarg.h>
-00022 #endif
-00023 
-00024 #include "libccmio/ccmio.h"
-00025 
-00026 #ifdef __cplusplus
-00027 extern "C" {
-00028 #endif
-00029 
-00030 #define StoreCStyleArrays       0       /* If set to 1, stores arrays in the
-00031                                            ADF file in C order (by reversing
-00032                                            the dimensions) */
-00033 
-00034 #define kCCMIOMaxADFNodeSize    2147479552  /* 2 GB - 4096 (1 ADF block size)*/
-00035 /* Test the extended ADF feature with these sizes (keep the node size small!) */
-00036 /*#define kCCMIOMaxADFNodeSize  100000000 */
-00037 /*#define kCCMIOMaxADFNodeSize  7000000 */
-00038 /*#define kCCMIOMaxADFNodeSize  6000000 */
-00039 /*#define kCCMIOMaxADFNodeSize  128 */
-00040 /*#define kCCMIOMaxADFNodeSize  110 */
-00041 /*#define kCCMIOMaxADFNodeSize  36 */
-00042 /*#define kCCMIOMaxADFNodeSize  24 */  /* Use this for the ccmtest test also */
-00043 /*#define kCCMIOMaxADFNodeSize  100000 */
-00044 #define kCCMIOExtendedDataSize  "ExtendedSize"
-00045 #define kCCMIOExtendedDataName  "ExtendedData"
-00046 #define kCCMIOExtendedDataLabel "extendedData"
-00047 
-00048 typedef int ADFError;
-00049 
-00051 void MakeInvalidNode( CCMIONode *node );
-00052 
-00054 int IsRootNode( CCMIONode node );
-00055 
-00057 unsigned int CCMIOGetDataTypeSize( CCMIODataType type );
-00058 
-00060 char const* CCMIOGetDataTypeADFName( CCMIODataType type );
-00061 
-00063 CCMIODataType CCMIOGetCCMIODataType( char const *dataStr );
-00064 
-00067 CCMIOError IsSameFormat( CCMIONode node, CCMIODataType type, int dimSize );
-00068 
-00070 int ParseArgs( va_list args, CCMIOIndex *out );
-00071 
-00072 #if StoreCStyleArrays
-00073 
-00075 void FortranToCArray( int size, int *ary );
-00076 #endif /* StoreCStyleArrays */
-00077 
-00082 int CalcOffset( int n, int coord[], int dimWidth[] );
-00083 
-00086 CCMIOError GetADFNodeDimensions( CCMIOError *err, CCMIONode node,
-00087                                  int *nDims, int *dims );
-00088 
-00091 CCMIOSize GetADFNodeDataSize( CCMIOError *err, CCMIONode node );
-00092 
-00094 int IsADFError( int adfErr );
-00095 
-00097 CCMIOError ADFToCCMIOError( int adfErr );
-00098 
-00099 /* This is defined in ccmioread.c */
-00100 CCMIOError CCMIOExtendedADFIO( CCMIOError *err, CCMIONode node, 
-00101                                CCMIOIOType ioType, CCMIODataType dataType,
-00102                                int nDims, CCMIOIndex const *dims,
-00103                                char *data, CCMIOIndex start, CCMIOIndex end );
-00104 
-00105 
-00106 #ifdef __cplusplus
-00107 }
-00108 #endif
-00109 #endif /* CCMIO_PRIVATE_H */
-00110 
-00111 
-00112 /* Automatic setting of emacs local variables. */
-00113 /* Local Variables: */
-00114 /* mode: C++ */
-00115 /* tab-width: 8 */
-00116 /* End: */
-

Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00030.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00030.html deleted file mode 100644 index 0a6029710e..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00030.html +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

/u/xeona04/people/prewett/src/libccmio/libccmio/ccmiotypes.h

Go to the documentation of this file.
00001 #ifndef CCMIO_TYPES_H
-00002 #define CCMIO_TYPES_H
-00003 
-00004 /*@@
-00005  *  Program: Star File Format Library  - $RCSfile: ccmiotypes.h,v $
-00006  *  Author:  Geoff Prewett
-00007  *  Date:    July 28, 2003
-00008  *
-00009  *
-00010  *  Star File Format Library - Copyright (C) 2003 by adapco, Ltd.
-00011  *
-00012  *  This program is the property of adapco, Ltd. and contains
-00013  *  confidential and proprietary information.  The unauthorized use,
-00014  *  distribution, or duplication of this program is prohibited.
-00015  *  All rights reserved.
-00016  *
-00017  *  $Id: ccmiotypes.h,v 1.11 2006/06/05 21:12:16 geoffp Exp $
-00018  */
-00019 
-00020 #ifdef __cplusplus
-00021 extern "C" {
-00022 #endif
-00023 
-00024 #ifdef DEBUG
-00025     #define Debugging   1
-00026 #else
-00027     #define Debugging   0
-00028 #endif
-00029 
-00030 #ifndef TRUE
-00031     #define TRUE        1
-00032     #define FALSE       0
-00033 #endif
-00034 
-00036 typedef enum {
-00037     kCCMIONoErr = 0,
-00038     kCCMIONoFileErr,
-00039     kCCMIOPermissionErr,
-00040     kCCMIOCorruptFileErr,
-00041     kCCMIOBadLinkErr,
-00042     kCCMIONoNodeErr,
-00043     kCCMIODuplicateNodeErr,
-00044     kCCMIOWrongDataTypeErr,
-00045     kCCMIONoDataErr,
-00046     kCCMIOWrongParentErr,
-00047     kCCMIOBadParameterErr,
-00048     kCCMIONoMemoryErr,
-00049     kCCMIOIOErr,
-00050     kCCMIOTooManyFacesErr,
-00051     kCCMIOVersionErr,
-00052     kCCMIOArrayDimensionToLargeErr,
-00053     kCCMIOInternalErr
-00054     } CCMIOError;
-00055 
-00056 typedef enum { kCCMIOFloat32 = 0, kCCMIOFloat64, kCCMIOInt32,
-00057                kCCMIOInt64 /* Internal use only */,
-00058                kCCMIOString, kCCMIOUnknownType, kCCMIOBadType,
-00059                kCCMIOLastType } CCMIODataType;
-00060 
-00061 struct _CCMIONode {
-00062     double node;
-00063     double parent;
-00064 };
-00065 
-00066 #define kCCMIOEndArgs   -1
-00067 
-00068 /*typedef unsigned long long CCMIOIndex;
-00069   typedef unsigned long long CCMIOSize; */
-00070 typedef unsigned int CCMIOIndex;
-00071 typedef unsigned int CCMIOSize;
-00072 
-00073 typedef enum { kCCMIORead, kCCMIOWrite } CCMIOBufferType;
-00074 typedef CCMIOBufferType CCMIOIOType;
-00075 
-00076 typedef enum { kCCMIOReadData, kCCMIONewData, kCCMIOAddData } CCMIOOpenType;
-00077 
-00078 typedef struct _CCMIONode CCMIONode;
-00079 
-00080 #define IGNORE_ERROR(err)               \
-00081         CCMIOError dummyErr = kCCMIONoErr;      \
-00082         if (!err) err = &dummyErr;
-00083 
-00084 #define CHECK_ERROR(err)                \
-00085         CCMIOError dummyErr = kCCMIONoErr;      \
-00086         if (!err) err = &dummyErr;      \
-00087         if (*err != kCCMIONoErr) return(*err);
-00088 
-00089 #define CHECK_ERROR_AND_CLEAR_PTR(err, ptr, null)       \
-00090         CCMIOError dummyErr = kCCMIONoErr;              \
-00091         if (!err) err = &dummyErr;                      \
-00092         if (!ptr) return(*err = kCCMIOBadParameterErr); \
-00093         else    *ptr = null;                            \
-00094         if (*err != kCCMIONoErr) return(*err);
-00095         
-00096 #ifdef _WIN32
-00097         #ifndef snprintf
-00098                 #if !defined(__NUTC__)
-00099                         #define snprintf _snprintf
-00100                 #endif
-00101         #endif
-00102 #endif
-00103 #if defined(__hpux__) || defined(__hpux) || defined(hpux) || defined(__alpha) || defined(__alpha__)
-00104         #define kHasSNPrintf    0
-00105 #else
-00106         #define kHasSNPrintf    1
-00107 #endif
-00108 
-00109 typedef enum { kCCMIODimNull = 0, kCCMIOScalar = 1, kCCMIOVector, kCCMIOTensor } CCMIODimensionality;
-00110 typedef enum { kCCMIOVertex = 0, kCCMIOCell, kCCMIOFace } CCMIODataLocation;
-00111 
-00112 /* Defines for CCMIOGetProstarSet() */
-00113 #define kCCMIOCellSet           (1 << 0)
-00114 #define kCCMIOVertexSet         (1 << 1)
-00115 #define kCCMIOBoundarySet       (1 << 2)
-00116 #define kCCMIOBlockSet          (1 << 3)
-00117 #define kCCMIOSplineSet         (1 << 4)
-00118 #define kCCMIOCoupleSet         (1 << 5)
-00119 
-00120 /* Keep in sync with gEntityNames and gTypeNames in ccmio.c */
-00121 typedef enum { kCCMIONull = -1, kCCMIOMap = 0, kCCMIOVertices, kCCMIOTopology,
-00122                kCCMIOInternalFaces, kCCMIOBoundaryFaces, kCCMIOCells,
-00123                kCCMIOProblemDescription, kCCMIOFieldSet, kCCMIOField,
-00124                kCCMIOFieldData, kCCMIOState, kCCMIOProcessor, kCCMIOCellType,
-00125                kCCMIOBoundaryRegion, kCCMIOLagrangianData, kCCMIOInterfaces,
-00126                kCCMIOFieldPhase, kCCMIORestart, kCCMIORestartData,
-00127                kCCMIOReferenceData, kCCMIOModelConstants, kCCMIOProstarSet,
-00128                kCCMIOMaxEntity } CCMIOEntity;
-00129 
-00130 typedef enum { kCCMIOVectorX = 0, kCCMIOVectorY, kCCMIOVectorZ,
-00131                kCCMIOTensorXX = 0, kCCMIOTensorXY, kCCMIOTensorXZ,
-00132                kCCMIOTensorYX, kCCMIOTensorYY, kCCMIOTensorYZ,
-00133                kCCMIOTensorZX, kCCMIOTensorZY, kCCMIOTensorZZ } CCMIOComponent;
-00134                
-00135 typedef struct {
-00136     CCMIONode root;
-00137     CCMIONode node;
-00138     int id;
-00139     CCMIOEntity type;
-00140     int version;
-00141 } CCMIOID;
-00142 
-00143 #define kCCMIOMaxDimension      4
-00144 #define kCCMIOMaxStringLength   32
-00145 #define kCCMIOProstarShortNameLength    8
-00146 #define kCCMIOStart             0ul
-00147 #define kCCMIOEnd               0ul
-00148 
-00149 #ifdef __cplusplus
-00150     }
-00151 #endif
-00152 #endif /* CCMIO_TYPES_H */
-00153 
-00154 
-00155 /* Automatic setting of emacs local variables. */
-00156 /* Local Variables: */
-00157 /* mode: C++ */
-00158 /* tab-width: 8 */
-00159 /* End: */
-

Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00031.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00031.html deleted file mode 100644 index 5c31819c68..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00031.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

/u/xeona04/people/prewett/src/libccmio/libccmio/ccmioutility.h

Go to the documentation of this file.
00001 #ifndef CCMIO_UTILITY_H
-00002 #define CCMIO_UTILITY_H
-00003 
-00004 /*@@
-00005  *  Program: Star File Format Library  - $RCSfile: ccmioutility.h,v $
-00006  *  Author:  Geoff Prewett
-00007  *  Date:    August 28, 2003
-00008  *
-00009  *
-00010  *  Star File Format Library - Copyright (C) 2003 by adapco, Ltd.
-00011  *
-00012  *  This program is the property of adapco, Ltd. and contains
-00013  *  confidential and proprietary information.  The unauthorized use,
-00014  *  distribution, or duplication of this program is prohibited.
-00015  *  All rights reserved.
-00016  *
-00017  *  $Id: ccmioutility.h,v 1.9 2006/06/05 21:12:16 geoffp Exp $
-00018  */
-00019 
-00020 #ifdef __cplusplus
-00021 extern "C" {
-00022 #endif
-00023 
-00024 #include "libccmio/ccmiotypes.h"
-00025 
-00026 /* \{
-00027    \name Utility functions
-00028    \brief Condenses common tasks
-00029    \ingroup core */
-00030 
-00032 extern CCMIOError CCMIOWriteNodei( CCMIOError *err, CCMIONode parent,
-00033                                    char const *name, int value );
-00034 
-00036 extern CCMIOError CCMIOWriteNodef( CCMIOError *err, CCMIONode parent,
-00037                                    char const *name, float value );
-00038 
-00040 extern CCMIOError CCMIOWriteNoded( CCMIOError *err, CCMIONode parent,
-00041                                    char const *name, double value );
-00042 
-00044 extern CCMIOError CCMIOWriteNodestr( CCMIOError *err, CCMIONode parent,
-00045                                      char const *name, char const *value );
-00046 
-00049 extern CCMIOError CCMIOReadNodei( CCMIOError *err, CCMIONode parent,
-00050                                   char const *name, int *value );
-00051 
-00054 extern CCMIOError CCMIOReadNodef( CCMIOError *err, CCMIONode parent,
-00055                                   char const *name, float *value );
-00056 
-00059 extern CCMIOError CCMIOReadNoded( CCMIOError *err, CCMIONode parent,
-00060                                   char const *name, double *value );
-00061 
-00065 extern CCMIOError CCMIOReadNodestr( CCMIOError *err, CCMIONode parent,
-00066                                     char const *name, char **value );
-00067 
-00068 /* CCMIORead*() and CCMIOWrite*() are actually included in ccmio.c, in order
-00069    to limit the amount of fake templating. */
-00070 
-00078 extern CCMIOError CCMIORead1i( CCMIOError *err, CCMIONode node, int *data,
-00079                                CCMIOIndex start, CCMIOIndex end );
-00080 extern CCMIOError CCMIORead1f( CCMIOError *err, CCMIONode node, float *data,
-00081                                CCMIOIndex start, CCMIOIndex end );
-00082 extern CCMIOError CCMIORead1d( CCMIOError *err, CCMIONode node, double *data,
-00083                                CCMIOIndex start, CCMIOIndex end );
-00084 extern CCMIOError CCMIORead2i( CCMIOError *err, CCMIONode node, int *data,
-00085                                CCMIOIndex start, CCMIOIndex end );
-00086 extern CCMIOError CCMIORead2f( CCMIOError *err, CCMIONode node, float *data,
-00087                                CCMIOIndex start, CCMIOIndex end );
-00088 extern CCMIOError CCMIORead2d( CCMIOError *err, CCMIONode node, double *data,
-00089                                CCMIOIndex start, CCMIOIndex end );
-00090 extern CCMIOError CCMIORead3i( CCMIOError *err, CCMIONode node, int *data,
-00091                                CCMIOIndex start, CCMIOIndex end );
-00092 extern CCMIOError CCMIORead3f( CCMIOError *err, CCMIONode node, float *data,
-00093                                CCMIOIndex start, CCMIOIndex end );
-00094 extern CCMIOError CCMIORead3d( CCMIOError *err, CCMIONode node, double *data,
-00095                                CCMIOIndex start, CCMIOIndex end );
-00096 
-00100 extern CCMIOError CCMIOWrite1i( CCMIOError *err, CCMIONode node, CCMIOIndex n,
-00101                                 int const *data, CCMIOIndex start,
-00102                                 CCMIOIndex end );
-00103 extern CCMIOError CCMIOWrite1f( CCMIOError *err, CCMIONode node, CCMIOIndex n,
-00104                                 float const *data, CCMIOIndex start,
-00105                                 CCMIOIndex end );
-00106 extern CCMIOError CCMIOWrite1d( CCMIOError *err, CCMIONode node, CCMIOIndex n,
-00107                                 double const *data, CCMIOIndex start,
-00108                                 CCMIOIndex end );
-00109 extern CCMIOError CCMIOWrite2i( CCMIOError *err, CCMIONode node,
-00110                                 CCMIOIndex x, CCMIOIndex y,
-00111                                 int const *data,
-00112                                 CCMIOIndex start, CCMIOIndex end );
-00113 extern CCMIOError CCMIOWrite2f( CCMIOError *err, CCMIONode node,
-00114                                 CCMIOIndex x, CCMIOIndex y,
-00115                                 float const *data,
-00116                                 CCMIOIndex start, CCMIOIndex end );
-00117 extern CCMIOError CCMIOWrite2d( CCMIOError *err, CCMIONode node,
-00118                                 CCMIOIndex x, CCMIOIndex y,
-00119                                 double const *data,
-00120                                 CCMIOIndex start, CCMIOIndex end );
-00121 extern CCMIOError CCMIOWrite3i( CCMIOError *err, CCMIONode node,
-00122                                 CCMIOIndex x, CCMIOIndex y,
-00123                                 CCMIOIndex z, int const *data,
-00124                                 CCMIOIndex start, CCMIOIndex end );
-00125 extern CCMIOError CCMIOWrite3f( CCMIOError *err, CCMIONode node,
-00126                                 CCMIOIndex x, CCMIOIndex y,
-00127                                 CCMIOIndex z, float const *data,
-00128                                 CCMIOIndex start, CCMIOIndex end );
-00129 extern CCMIOError CCMIOWrite3d( CCMIOError *err, CCMIONode node,
-00130                                 CCMIOIndex x, CCMIOIndex y,
-00131                                 CCMIOIndex z, double const *data,
-00132                                 CCMIOIndex start, CCMIOIndex end );
-00133 
-00135 CCMIOError CCMIOOldReadf( CCMIOError *err, CCMIONode node, int dimension,
-00136                           int swapDims, float *data, CCMIOIndex start,
-00137                           CCMIOIndex end );
-00139 CCMIOError CCMIOOldReadd( CCMIOError *err, CCMIONode node, int dimension,
-00140                           int swapDims, double *data, CCMIOIndex start,
-00141                           CCMIOIndex end );
-00143 CCMIOError CCMIOOldReadi( CCMIOError *err, CCMIONode node, int dimension,
-00144                           int swapDims, int *data, CCMIOIndex start,
-00145                           CCMIOIndex end );
-00146 
-00155 extern CCMIOError CCMIOCopyNode( CCMIOError *err, CCMIONode origNode,
-00156                                  CCMIONode copyNode, int copyExists );
-00159 extern CCMIOError CCMIOGetNextChildWithLabel( CCMIOError *err, CCMIONode parent,
-00160                                               char const *label, int *n,
-00161                                               CCMIONode *child );
-00162 
-00173 CCMIOError CCMIOCompress( CCMIOError *err, char *filename );
-00174 
-00175 /* \} */
-00176 #ifdef __cplusplus
-00177 }
-00178 #endif
-00179 #endif /* CCMIO_UTILITY_H */
-00180 
-00181 
-00182 /* Automatic setting of emacs local variables. */
-00183 /* Local Variables: */
-00184 /* mode: C++ */
-00185 /* tab-width: 8 */
-00186 /* End: */
-

Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00032.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00032.html deleted file mode 100644 index a825015ed0..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00032.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

/u/xeona04/people/prewett/src/libccmio/libccmio/ccmioverifymesh.h

Go to the documentation of this file.
00001 #ifndef CCMIOMESH_VERIFY_H
-00002 #define CCMIOMESH_VERIFY_H
-00003 
-00004 /*@@
-00005  *  Program: Star File Format Library  - $RCSfile: ccmioverifymesh.h,v $
-00006  *  Author:  Geoff Prewett
-00007  *  Date:    Sept 18, 2003
-00008  *
-00009  *
-00010  *  Star File Format Library - Copyright (C) 2003 by adapco, Ltd.
-00011  *
-00012  *  This program is the property of adapco, Ltd. and contains
-00013  *  confidential and proprietary information.  The unauthorized use,
-00014  *  distribution, or duplication of this program is prohibited.
-00015  *  All rights reserved.
-00016  *
-00017  *  $Id: ccmioverifymesh.h,v 1.3 2004/10/25 19:11:55 wayne Exp $
-00018  */
-00019 
-00020 #ifdef __cplusplus
-00021 extern "C" {
-00022 #endif
-00023 
-00027 extern CCMIOError CCMIOCheckProcessorMesh( CCMIOError *err, CCMIOProcessor proc );
-00028 
-00029 #ifdef __cplusplus
-00030 }
-00031 #endif
-00032 #endif /* CCMIOMESH_VERIFY_H */
-00033 
-00034 
-00035 /* Automatic setting of emacs local variables. */
-00036 /* Local Variables: */
-00037 /* mode: C++ */
-00038 /* tab-width: 8 */
-00039 /* End: */
-

Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00033.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00033.html deleted file mode 100644 index 12a0e4ffc7..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00033.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

/u/xeona04/people/prewett/src/libccmio/libccmio/ccmioversion.h

Go to the documentation of this file.
00001 #define kCCMIOMajorVersion      2       /* Requires large-scale re-write */
-00002 #define kCCMIOMinorVersion      6       /* Changes to existing prototypes */
-00003 #define kCCMIORevision          0       /* Bug fixes, new functions */
-00004 
-00005 #define kCCMIOVersion 20600     /* mmnnrr (major, minor, rev) */
-00006 
-00007 #define Stringify(x)    StringifyImp(x)
-00008 #define StringifyImp(x) #x
-00009 
-00010 #define kCCMIOVersionStr        Stringify(kCCMIOMajorVersion)"."Stringify(kCCMIOMinorVersion)"."Stringify(kCCMIORevision)
-

Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00034.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00034.html deleted file mode 100644 index cb8a05fa91..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/a00034.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

/u/xeona04/people/prewett/src/libccmio/libccmio/vector.h

Go to the documentation of this file.
00001 #ifndef __VECTOR_H
-00002 #define __VECTOR_H
-00003 
-00004 /*@@
-00005  *  Program: Star File Format Library  - $RCSfile: vector.h,v $
-00006  *  Author:  Geoff Prewett
-00007  *  Date:    August 12, 2003
-00008  *
-00009  *
-00010  *  Star File Format Library - Copyright (C) 2003 by adapco, Ltd.
-00011  *
-00012  *  This program is the property of adapco, Ltd. and contains
-00013  *  confidential and proprietary information.  The unauthorized use,
-00014  *  distribution, or duplication of this program is prohibited.
-00015  *  All rights reserved.
-00016  *
-00017  *  $Id: vector.h,v 1.3 2004/10/25 19:11:55 wayne Exp $
-00018  */
-00019 
-00020 #ifdef __cplusplus
-00021 extern "C" {
-00022 #endif
-00023 
-00024 struct _Vector {
-00025     int size;
-00026     int alloc;
-00027     int typeSize;
-00028     int clear;          /* TRUE if need to clear memory when expanding */
-00029     void *buffer;
-00030     };
-00031 
-00032 typedef struct _Vector* Vector;
-00033 
-00036 extern Vector VCreate( int typeSize, int minSize, int clear );
-00037 
-00039 extern void VDestroy( Vector v );
-00040 
-00042 extern int VSize( Vector v );
-00043 
-00046 extern void* VIndex( Vector v, int i );
-00047 
-00048 #ifdef __cplusplus
-00049 }
-00050 #endif
-00051 
-00052 #endif /* __VECTOR_H */
-00053 
-00054 
-00055 /* Automatic setting of emacs local variables. */
-00056 /* Local Variables: */
-00057 /* mode: C++ */
-00058 /* tab-width: 8 */
-00059 /* End: */
-

Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/annotated.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/annotated.html deleted file mode 100644 index db6dbc5826..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/annotated.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

libccmio Data Structures

Here are the data structures with brief descriptions: - - - -
_CCMIONode
_Vector
CCMIOID
-
Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/compatpage.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/compatpage.html deleted file mode 100644 index fc214d54e8..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/compatpage.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

Backwards Compatibility -

As with all file formats, the CCM specification has undergone some changes in its history.  Where possible, backwards compatibility has been included within the library itself.  However, there have been a few hierarchical changes which the library cannot hide from the client.  If backwards compatibility with these files is desired, the client will need to handle the case appropriately.  These cases have been recorded below, along with sample code to handle it.  The readexample.cpp read example included contains appropriate handling for all cases.
-
-

Addition of Phase Node (2.2.0)

- In version 2.2.0 it became necessary to support different material phases, each with their own sets of (possibly different) fields.  The Phase entity was inserted between the FieldSet and the Field, so clients must be aware that there may be no Phase entity under FieldSet in older files.
-
- Code:
-
-    ...
-    bool oldFile = (CCMIONextEntity(NULL, solution, kCCMIOFieldPhase, &i, &phase) != kCCMIONoErr);
-    i = 0;
-    while (oldFile ||
-           CCMIONextEntity(NULL, solution, kCCMIOFieldPhase, &i, &phase)== kCCMIONoErr)
-    {
-        if (oldFile)
-            phase = solution;
        ... read data ...
        oldFile = false;
-    }
-    ...
-

Multidimensional data stored as scalar components (2.4.0)
-

- Some clients noted that often multidimensional data (i.e. vector data) was needed one component at a time.  Since this can reduce the memory needed to compute secondary quantities, an important consideration for large data, the file format was changed to store multidimensional data as components.  Previously all field data was read using CCMIOReadFieldData*().  With this change only scalar data can be read with CCMIOReadFieldData*() and all multidimensional data must be read with CCMIOReadMultiDimensionalFieldData*().  (The extra function was added to be consistent with prefering extra functions to extra parameters)  However, CCMIOReadFieldData*() is still required to read older data.
-
- Code:
-
-    ...
-    CCMIOReadField(&err, field, name, shortName, &dims, &datatype);
-    CCMIOEntitySize(&err, fieldData, &n, &max);
-    CCMIOReadMultiDimensionalFieldData(&err, field, kCCMIOVectorX, scalarID);
-    if (err == kCCMIOVersionErr)
-        data.size(n * dims);
-    else
-        data.size(n);
-    ...
-    while (CCMIONextEntity(NULL, field, kCCMIOFieldData, &j, &fieldData) == kCCMIONoErr)
-        ...
-        CCMIOReadFieldDataf(...);
-    ...
-
-

-


Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/deprecated.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/deprecated.html deleted file mode 100644 index e42c1dbcf4..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/deprecated.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

Deprecated List -

-
-
Global CCMIOEntityLabel(CCMIOError *err, CCMIOID id, CCMIOSize *size, char *label)
Use CCMIOEntityDescription() instead. -
-
Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/diagram.png b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/diagram.png deleted file mode 100644 index 8da5b73416..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/diagram.png and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/doxygen.css b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/doxygen.css deleted file mode 100644 index e527a57c4f..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/doxygen.css +++ /dev/null @@ -1,49 +0,0 @@ -H1 { text-align: center; } -CAPTION { font-weight: bold } -A.qindex {} -A.qindexRef {} -A.el { text-decoration: none; font-weight: bold } -A.elRef { font-weight: bold } -A.code { text-decoration: none; font-weight: normal; color: #4444ee } -A.codeRef { font-weight: normal; color: #4444ee } -A:hover { text-decoration: none; background-color: #f2f2ff } -DL.el { margin-left: -1cm } -DIV.fragment { width: 100%; border: none; background-color: #eeeeee } -DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } -TD.md { background-color: #f2f2ff; font-weight: bold; } -TD.mdname1 { background-color: #f2f2ff; font-weight: bold; color: #602020; } -TD.mdname { background-color: #f2f2ff; font-weight: bold; color: #602020; width: 600px; } -DIV.groupHeader { margin-left: 16px; margin-top: 12px; margin-bottom: 6px; font-weight: bold } -DIV.groupText { margin-left: 16px; font-style: italic; font-size: smaller } -BODY { background: white } -TD.indexkey { - background-color: #eeeeff; - font-weight: bold; - padding-right : 10px; - padding-top : 2px; - padding-left : 10px; - padding-bottom : 2px; - margin-left : 0px; - margin-right : 0px; - margin-top : 2px; - margin-bottom : 2px -} -TD.indexvalue { - background-color: #eeeeff; - font-style: italic; - padding-right : 10px; - padding-top : 2px; - padding-left : 10px; - padding-bottom : 2px; - margin-left : 0px; - margin-right : 0px; - margin-top : 2px; - margin-bottom : 2px -} -span.keyword { color: #008000 } -span.keywordtype { color: #604020 } -span.keywordflow { color: #e08000 } -span.comment { color: #800000 } -span.preprocessor { color: #806020 } -span.stringliteral { color: #002080 } -span.charliteral { color: #008080 } diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/doxygen.png b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/doxygen.png deleted file mode 100644 index 96ae72c297..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/doxygen.png and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/errorpage.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/errorpage.html deleted file mode 100644 index 6b2a535782..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/errorpage.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

CCMIO Error Handling -

-

- -

- Error handling in C APIs is fairly cumbersome if you need to check for errors frequently, as you either need to check return values (or parameters) or a global error after each function call to ensure that the next one does not go bad. However, most of the time you would like to call API routines if there has been no error, otherwise skip until the end. libccmio has appropriated error handling ideas from dataflow programming in an attempt to make error handling less cumbersome for the API user. All functions return an error, in case it is convenient, but most functions also take an error pointer, the value of which will be set to the error returned. Should the value of this pointer be an error upon entrance to the function, the function will do nothing. Occasionally you will want to test whether an function call will succeed. In this case, NULL, which is always interpreted as kCCMIONoErr, should be passed to the function and the return value checked for success, otherwise an anticipated failure would cause succeeding functions to do nothing. -

- -

- Dataflow error handling allows the API user to write code that opens a file, does some reading or writing, and then closes it, without checking for errors until the end. The API guarantees that any return parameters of the function will be usable (i.e not cause a crash when used), unless otherwise documented, and that, should an error occur early on, all memory allocated internally will be properly deallocated. For instance: -

-     err = CCMIOOpenFile(NULL, argv[1], kCCMIORead, &root);
-     CCMIOGetState(&err, root, kDefaultState, &problem, &state);
-         ... read stuff
-     CCMIOCloseFile(&err, root);
-     if (err != kCCMIONoErr)
-         alert user of error
-
-

- -

- There are several things to keep in mind when using errors:

    -
  • Because this is a C, not C++ API, it is of paramount importance to initialize the error when it is created. Thus, an error should always be declared:
    -
                    CCMIOError err = kCCMIONoErr;
    unless it is being assigned as a result of an API call (e.g. CCMIOOpenFile).
  • Although kCCMIONoErr should always have a value of 0 (zero), it is preferable to compare errors to kCCMIONoErr to avoid confusion, since while !err is a correct test for an error, !CCMIOOpenFile reads like it checks for the failure of the function, but in reality returns true only if there was not an error. Thus
    -
                    if (CCMIOOpenFile(...) != kCCMIONoErr)
    should be the canonical test.
  • Either pass NULL for the error when looping through nodes or reset the error afterwards, because the terminal condition is the kCCMIONoNodeErr error:
    -
    -       i = 0;
    -       while (CCMIONextEntity(NULL, parentID, kCCMIOField, &i, &child) == kCCMIONoErr)
    -            ... do stuff ...
    -
-
Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/examples.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/examples.html deleted file mode 100644 index a3a3e71b3e..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/examples.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

libccmio Examples

Here is a list of all examples: -
Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/files.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/files.html deleted file mode 100644 index db3c44b264..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/files.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

libccmio File List

Here is a list of all files with brief descriptions: - - - - - - - - - - - - - - - -
/u/xeona04/people/prewett/src/libccmio/docs/compatibility.dox
/u/xeona04/people/prewett/src/libccmio/docs/errors.dox
/u/xeona04/people/prewett/src/libccmio/docs/examples.dox
/u/xeona04/people/prewett/src/libccmio/docs/groups.dox
/u/xeona04/people/prewett/src/libccmio/docs/hierarchy.dox
/u/xeona04/people/prewett/src/libccmio/docs/intropage.dox
/u/xeona04/people/prewett/src/libccmio/docs/mainpage.dox
/u/xeona04/people/prewett/src/libccmio/libccmio/ccmio.h [code]
/u/xeona04/people/prewett/src/libccmio/libccmio/ccmiocore.h [code]
/u/xeona04/people/prewett/src/libccmio/libccmio/ccmioprivate.h [code]
/u/xeona04/people/prewett/src/libccmio/libccmio/ccmiotypes.h [code]
/u/xeona04/people/prewett/src/libccmio/libccmio/ccmioutility.h [code]
/u/xeona04/people/prewett/src/libccmio/libccmio/ccmioverifymesh.h [code]
/u/xeona04/people/prewett/src/libccmio/libccmio/ccmioversion.h [code]
/u/xeona04/people/prewett/src/libccmio/libccmio/vector.h [code]
-
Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/functions.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/functions.html deleted file mode 100644 index aef2cb2e01..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/functions.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

libccmio Data Fields

Here is a list of all struct and union fields with links to the struct/union documentation for each field: -
Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/globals.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/globals.html deleted file mode 100644 index a1e7123af1..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/globals.html +++ /dev/null @@ -1,263 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

libccmio Globals

Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to: -
Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/hierarchy.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/hierarchy.html deleted file mode 100644 index 490b8222e9..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/hierarchy.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

CCMIO Hierarchy -


- The CCMIO API presupposes a certain conceptual layout of the data.  This layout is consists of a hierarchical collection of entities. Each entity stores a particular type of information and is decribed below:
-
-hierarchy.png -
-
-
- All entities are conceptually of the same nature and are often interchangeable. Ideally the API would provide one general set of functions for handling entities. However some entities must be referred to by a specific name or number. Because of C's strict typing system it is necessary to divide entities into several types: regular entities, indexed entities, and special entities. Regular entities do not have any identifying information visible outside the API. For instance, each map is indistiguishable (but not interchangeable!) from another map as far as the API is concerned. Indexed entities are referred to by a user-specified ID. They are marked with a blue number on the diagram. Indexed entities are created with CCMIONewIndexedEntity() and are retrieved with CCMIOGetEntity() or, probably more commonly, with CCMIONextEntity(). The special entities contain information that is conceptually part of the entity itself and they are created and retrieved with special functions CCMIONew*(), CCMIOGet*(), where * is the entity type name. Special entities are marked with thick borders.
-
- Some entities contain references to other entities. The border of the referrer is colored the color as the text of the referree.
-
- The entity type names are taken from the CCMIO specification. Although they are largely self-explanatory, a more complete description of several entities follows:
- <table cellpadding="2" cellspacing="0" border="0" style="text-align: left; width: 100%; margin-left: 40px;"> State Each state describes everything necessary to solve a mesh at a given instant in time.  Multiple states will be required for moving or morphing meshes.
- Processor Contains the mesh, solution, and initial conditions for the state.
- Field Set A field set is the collection of post data. It may (and probably will) contain many fields.
- Field One post data variable (e.g. "Pressure").
- Field Data Either the cell, vertex, or face values for a particular post data variable.
- Map The map converts a data index into an ID. For instance given vertex data { (0, 0, 0), (0, 1, 0), (1, 1, 0) } and the map { 3, 1, 4 }, we know that
-
-       Vertex 1    (0, 1, 0)
-       Vertex 3    (0, 0, 0)
-       Vertex 4    (1, 1, 0)
- -

-


Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/hierarchy.png b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/hierarchy.png deleted file mode 100644 index be51822811..0000000000 Binary files a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/hierarchy.png and /dev/null differ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/index.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/index.html deleted file mode 100644 index bbdfbac030..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/index.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

libccmio Documentation

-

- -

-This is the documentation for the CCM file I/O library. -

-

-Please contact geoffrey.prewett@us.cd-adapco.com if you have any questions. -

-


Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/intropage.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/intropage.html deleted file mode 100644 index db97eabcf1..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/intropage.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

Introduction -

-

-The CCM specification is a loose specification where data is stored in pieces, rather than in a strict domain-subdomain hierarchy. This allows the flexibility for future changes. Similarly, the CCMIO API is also fairly loose. It has a knowledge of different entities and a defined hierarchy, but the functions are not strongly hierarchical. This puts part of the burden of following the hierarchy on the user of the API. Thus it is helpful to refer to the CCM specification while using the CCMIO API. -

-The API is divided into three sections: the Intermediate API, the Core API, and utility functions. The Intermediate API is the main API for reading and writing CCM files. The Core API is the lowest-level API, and is mostly a wrapper around the ADF library. This API is intended for use in writing the Intermediate API, but is provided in case the Intermediate API is not sufficient. There are also some strictly unnecessary but helpful functions in both the Intermediate and Core APIs that are classified as utility functions. The functions for optional nodes in the Intermediate API are provided to avoid the need to use the Core API, and the Core API has some utility functions to do standard tasks more quickly. -

-The CCMIO API has been written in C to avoid incompatibilities and differing standards between C++ compilers and libraries on the many platforms that CD-adapco supports. Unfortunately, this means that some internal data structures are exposed in the header files. These should not be be used; all CCMIO structures should be treated as opaque objects. In the rare case that you need to drop down to the Core API, the function CCMIOGetEntityNode() should be used to get the CCMIONode corresponding to the CCMIOEntity. -

-

Design Considerations

- The API makes certain assumptions about the nature of usability;  these are:
-
    -
  • Compile-time checking: more type-safe functions are better than fewer functions that take structures and switch parameters to determine behavior. Unfortunately, because C does not have polymorphic functions or inheritance, this leads to more functions than are desirable. We feel that although the function count may be larger, the API will be easier to use (and debug) than if a few functions each did many somewhat related tasks.
  • No dynamic data:  the API will not create arrays for the caller;  the caller is responsible for determining the size of any array passed to the API.  (The API will, of course, provide access to the necessary sizes.) There is one exception: some functions in the Core API will allocate memory which must be then freed by the caller. These, however, should really only be used within the library itself.
  • Easy error handling:  error handling requires one check at the end of all the function calls to the API; it is not necessary to check errors after every library call.  This is accomplished by means of passing the error to each function (or NULL, if the check is to be avoided);  if an error has already occurred, the function will do nothing, and if an error does occur, the value of the error parameter will be updated.  Return values of all functions will be the value of the error parameter, for convenience of the caller.  Of course, error handling may be performed as often as desired, however it need not be done after every call. (Please see the CCMIO Error Handling section for more details)
    -
-

Caveats

-
    -
  • The CCMIO library currently uses ADF as the underlying file format. Unfortunately, deleting ADF nodes, as is necessary when rewriting mesh and post results, leads to fragmentation and loss of usable file space. This means that the ADF file will usually grow each time data is changed. A function, CCMIOCompress(), has been provided to compress the file to its minimum size, and should be called judiciously.
  • The ADF format is particularly slow for large numbers of nodes. Deleting 300 nodes, for instance, can take tens of seconds. So unless it is absolutely necessary, we recommend each entity or node having less than 100 children. (This is mostly likely to be an issue with boundary face nodes)
  • You may wish to use an ADF viewer to assist in debugging. A Tcl/Tk tool is available at the CGNS website. This requires Tcl/Tk 8.3. Download both cgnslib and cgnstools.
-
Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/modules.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/modules.html deleted file mode 100644 index 3513774307..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/modules.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

libccmio Modules

Here is a list of all modules: -
Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/pages.html b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/pages.html deleted file mode 100644 index 5e194669e4..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/html/pages.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - -

libccmio

HomeModulesExamples
- -

libccmio Related Pages

Here is a list of all related documentation pages: -
Generated on Mon Jun 5 17:16:02 2006 for libccmio by - -doxygen1.2.18
- - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/intropage.dox b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/intropage.dox deleted file mode 100644 index 91fe024e44..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/intropage.dox +++ /dev/null @@ -1,80 +0,0 @@ -/** \page intropage Introduction - -The CCM specification is a loose specification where data is stored in pieces, -rather than in a strict domain-subdomain hierarchy. This allows the flexibility -for future changes. Similarly, the CCMIO API is also fairly loose. It has -a knowledge of different entities and a defined hierarchy, but the functions -are not strongly hierarchical. This puts part of the burden of following the -hierarchy on the user of the API. Thus it is helpful to refer to the CCM -specification while using the CCMIO API. - -The API is divided into three sections: the \ref intermediate, the -\ref core, and utility functions. The Intermediate API is the main API for -reading and writing CCM files. The Core API is the lowest-level API, -and is mostly a wrapper around the ADF library. This API is intended for -use in writing the Intermediate API, but is provided in case the Intermediate -API is not sufficient. There are also some strictly unnecessary but helpful -functions in both the Intermediate and Core APIs that are classified as -utility functions. The functions for optional nodes in the Intermediate API -are provided to avoid the need to use the Core API, and the Core API has -some utility functions to do standard tasks more quickly. - -The CCMIO API has been written in C to avoid incompatibilities and differing -standards between C++ compilers and libraries on the many platforms that -CD-adapco supports. Unfortunately, this means that some internal data -structures are exposed in the header files. These should not be -be used; all CCMIO structures should be treated as opaque objects. In the -rare case that you need to drop down to the Core API, the function -CCMIOGetEntityNode() should be used to get the CCMIONode corresponding to the -CCMIOEntity. - -

Design Considerations

-The API makes certain assumptions about -the nature of usability;  these are:
-
    -
  • Compile-time checking: more type-safe functions are better than -fewer functions that take structures and switch parameters to determine -behavior. Unfortunately, because C does not have polymorphic functions -or inheritance, this leads to more functions than are desirable. We feel -that although the function count may be larger, the API will be easier to -use (and debug) than if a few functions each did many somewhat related -tasks. -
  • No dynamic data:  the API will not create arrays for the -caller;  the caller is responsible for determining the size of any -array passed to the API.  (The API will, of course, provide access -to the necessary sizes.) There is one exception: some functions in the -Core API will allocate memory which must be then freed by the caller. These, -however, should really only be used within the library itself.
  • -
  • Easy error handling:  error handling requires one check -at the end of all the function calls to the API; it is not necessary -to check errors after every library call.  This is -accomplished by means of passing the error to each function (or NULL, if -the check is to be avoided);  if an error has already occurred, the -function will do nothing, and if an error does occur, the value of the -error parameter will be updated.  Return values of all functions -will be the value of the error parameter, for convenience of the -caller.  Of course, error handling may be performed as often as -desired, however it need not be done after every call. (Please see the -\ref errorpage section for more details)
    -
  • -
-

Caveats

-
    -
  • The CCMIO library currently uses -ADF as the -underlying file format. Unfortunately, deleting ADF nodes, as is necessary -when rewriting mesh and post results, leads to fragmentation and loss of -usable file space. This means that the ADF file will usually grow each -time data is changed. A function, CCMIOCompress(), has been provided to -compress the file to its minimum size, and should be called judiciously.
  • -
  • The ADF format is particularly slow for large numbers of nodes. Deleting -300 nodes, for instance, can take tens of seconds. So unless -it is absolutely necessary, we recommend each entity or node having less than -100 children. (This is mostly likely to be an issue with boundary face nodes) -
  • -
  • You may wish to use an ADF viewer to assist in debugging. A Tcl/Tk tool -is available at the -CGNS website. -This requires Tcl/Tk 8.3. Download both cgnslib and cgnstools. -
-*/ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/mainpage.dox b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/mainpage.dox deleted file mode 100644 index 85853b02be..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/docs/mainpage.dox +++ /dev/null @@ -1,16 +0,0 @@ -/** \mainpage libccmio Documentation - -This is the documentation for the CCM file I/O library. - - - -Please contact geoffrey.prewett@us.cd-adapco.com if you have any questions. -*/ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/.cvsignore b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/.cvsignore deleted file mode 100644 index 67d896ff99..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*~ -.#* -\#* -make.*.list -make.*.list.batch -make.*.list.qlogerr diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF.h deleted file mode 100644 index 6f1ad2f3dd..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF.h +++ /dev/null @@ -1,342 +0,0 @@ -/** -File: ADF.h - ---------------------------------------------------------------------- - BOEING - ---------------------------------------------------------------------- - Project: CGNS - Author: Tom Dickens 865-6122 tpd6908@yak.ca.boeing.com - Date: 3/2/1995 - Purpose: Provide prototype declarations for the ADF-Core routines. - ---------------------------------------------------------------------- - ---------------------------------------------------------------------- - -**/ - -#ifndef ADF_INCLUDE -#define ADF_INCLUDE - -/*********************************************************************** - Defines: These defines are used within the ADF core routines - to specify the size in bytes of varoius items. - Caution: Simply changing a define here may not correctly adjust the - ADF core code. These sizes are provided for reference only! -***********************************************************************/ -#define ADF_DATA_TYPE_LENGTH 32 -#define ADF_DATE_LENGTH 32 -#define ADF_FILENAME_LENGTH 1024 -#define ADF_FORMAT_LENGTH 20 -#define ADF_LABEL_LENGTH 32 -#define ADF_MAXIMUM_LINK_DEPTH 100 -#define ADF_MAX_DIMENSIONS 12 -#define ADF_MAX_ERROR_STR_LENGTH 80 -#define ADF_MAX_LINK_DATA_SIZE 4096 -#define ADF_NAME_LENGTH 32 -#define ADF_STATUS_LENGTH 32 -#define ADF_VERSION_LENGTH 32 - -/*********************************************************************** - Prototypes for Interface Routines -***********************************************************************/ - -#if defined (_WIN32) && ! defined(ADFLIB) - #define DllExport __declspec(dllexport) -#else - #define DllExport extern -#endif - -#if defined (__cplusplus) - extern "C" { -#endif - -DllExport void ADF_Children_Names( - const double PID, - const int istart, - const int ilen, - const int name_length, - int *ilen_ret, - char *names, - int *error_return ) ; - -DllExport void ADF_Children_IDs( - const double PID, - const int istart, - const int ilen, - int *ilen_ret, - double *IDs, - int *error_return ) ; - -DllExport void ADF_Create( - const double PID, - const char *name, - double *ID, - int *error_return ) ; - -DllExport void ADF_Database_Close( - const double ID, - int *error_return ) ; - -DllExport void ADF_Database_Delete( - const char *filename, - int *error_return ) ; - -DllExport void ADF_Database_Garbage_Collection( - const double ID, - int *error_return ) ; - -DllExport void ADF_Database_Get_Format( - const double Root_ID, - char *format, - int *error_return ) ; - -DllExport void ADF_Database_Open( - const char *filename, - const char *status, - const char *format, - double *root_ID, - int *error_return ) ; - -DllExport void ADF_Database_Set_Format( - const double Root_ID, - const char *format, - int *error_return ) ; - -DllExport void ADF_Database_Version( - const double Root_ID, - char *version, - char *creation_date, - char *modification_date, - int *error_return ) ; - -DllExport void ADF_Delete( - const double PID, - const double ID, - int *error_return ) ; - -DllExport void ADF_Error_Message( - const int error_return_input, - char *error_string ) ; - -DllExport void ADF_Flush_to_Disk( - const double ID, - int *error_return ) ; - -DllExport void ADF_Get_Data_Type( - const double ID, - char *data_type, - int *error_return ) ; - -DllExport void ADF_Get_Dimension_Values( - const double ID, - int dim_vals[], - int *error_return ) ; - -DllExport void ADF_Get_Error_State( - int *error_state, - int *error_return ) ; - -DllExport void ADF_Get_Label( - const double ID, - char *label, - int *error_return ) ; - -DllExport void ADF_Get_Link_Path( - const double ID, - char *filename, - char *link_path, - int *error_return ) ; - -DllExport void ADF_Get_Name( - const double ID, - char *name, - int *error_return ) ; - -DllExport void ADF_Get_Node_ID( - const double PID, - const char *name, - double *ID, - int *error_return ) ; - -DllExport void ADF_Get_Number_of_Dimensions( - const double ID, - int *num_dims, - int *error_return ) ; - -DllExport void ADF_Get_Root_ID( - const double ID, - double *Root_ID, - int *error_return ) ; - -DllExport void ADF_Is_Link( - const double ID, - int *link_path_length, - int *error_return ) ; - -DllExport void ADF_Library_Version( - char *version, - int *error_return ) ; - -DllExport void ADF_Link( - const double PID, - const char *name, - const char *file, - const char *name_in_file, - double *ID, - int *error_return ) ; - -DllExport void ADF_Move_Child( - const double PID, - const double ID, - const double NPID, - int *error_return ) ; - -DllExport void ADF_Number_of_Children( - const double ID, - int *num_children, - int *error_return ) ; - -DllExport void ADF_Put_Dimension_Information( - const double ID, - const char *data_type, - const int dims, - const int dim_vals[], - int *error_return ) ; - -DllExport void ADF_Put_Name( - const double PID, - const double ID, - const char *name, - int *error_return ) ; - -DllExport void ADF_Read_All_Data( - const double ID, - char *data, - int *error_return ) ; - -DllExport void ADF_Read_Block_Data( - const double ID, - const long b_start, - const long b_end, - char *data, - int *error_return ) ; - -DllExport void ADF_Read_Data( - const double ID, - const int s_start[], - const int s_end[], - const int s_stride[], - const int m_num_dims, - const int m_dims[], - const int m_start[], - const int m_end[], - const int m_stride[], - char *data, - int *error_return ) ; - -DllExport void ADF_Set_Error_State( - const int error_state, - int *error_return ) ; - -DllExport void ADF_Set_Label( - const double ID, - const char *label, - int *error_return ) ; - -DllExport void ADF_Write_All_Data( - const double ID, - const char *data, - int *error_return ) ; - -DllExport void ADF_Write_Block_Data( - const double ID, - const long b_start, - const long b_end, - char *data, - int *error_return ) ; - -DllExport void ADF_Write_Data( - const double ID, - const int s_start[], - const int s_end[], - const int s_stride[], - const int m_num_dims, - const int m_dims[], - const int m_start[], - const int m_end[], - const int m_stride[], - const char *data, - int *error_return ) ; - -#if defined (__cplusplus) - } -#endif - -/*********************************************************************** - Error-return values - These values need to be kept in sync with the error strings in - file ADF_interface.c -***********************************************************************/ - /** Don't use zero since you can assign zero to a pointer **/ -#define NO_ERROR -1 -#define NUMBER_LESS_THAN_MINIMUM 1 -#define NUMBER_GREATER_THAN_MAXIMUM 2 -#define STRING_LENGTH_ZERO 3 -#define STRING_LENGTH_TOO_BIG 4 -#define STRING_NOT_A_HEX_STRING 5 -#define TOO_MANY_ADF_FILES_OPENED 6 -#define ADF_FILE_STATUS_NOT_RECOGNIZED 7 -#define FILE_OPEN_ERROR 8 -#define ADF_FILE_NOT_OPENED 9 -#define FILE_INDEX_OUT_OF_RANGE 10 -#define BLOCK_OFFSET_OUT_OF_RANGE 11 -#define NULL_STRING_POINTER 12 -#define FSEEK_ERROR 13 -#define FWRITE_ERROR 14 -#define FREAD_ERROR 15 -#define ADF_MEMORY_TAG_ERROR 16 -#define ADF_DISK_TAG_ERROR 17 -#define REQUESTED_NEW_FILE_EXISTS 18 -#define ADF_FILE_FORMAT_NOT_RECOGNIZED 19 -#define FREE_OF_ROOT_NODE 20 -#define FREE_OF_FREE_CHUNK_TABLE 21 -#define REQUESTED_OLD_FILE_NOT_FOUND 22 -#define UNIMPLEMENTED_CODE 23 -#define SUB_NODE_TABLE_ENTRIES_BAD 24 -#define MEMORY_ALLOCATION_FAILED 25 -#define DUPLICATE_CHILD_NAME 26 -#define ZERO_DIMENSIONS 27 -#define BAD_NUMBER_OF_DIMENSIONS 28 -#define CHILD_NOT_OF_GIVEN_PARENT 29 -#define DATA_TYPE_TOO_LONG 30 -#define INVALID_DATA_TYPE 31 -#define NULL_POINTER 32 -#define NO_DATA 33 -#define ERROR_ZEROING_OUT_MEMORY 34 -#define REQUESTED_DATA_TOO_LONG 35 -#define END_OUT_OF_DEFINED_RANGE 36 -#define BAD_STRIDE_VALUE 37 -#define MINIMUM_GT_MAXIMUM 38 -#define MACHINE_FORMAT_NOT_RECOGNIZED 39 -#define CANNOT_CONVERT_NATIVE_FORMAT 40 -#define CONVERSION_FORMATS_EQUAL 41 -#define DATA_TYPE_NOT_SUPPORTED 42 -#define FILE_CLOSE_ERROR 43 -#define NUMERIC_OVERFLOW 44 -#define START_OUT_OF_DEFINED_RANGE 45 -#define ZERO_LENGTH_VALUE 46 -#define BAD_DIMENSION_VALUE 47 -#define BAD_ERROR_STATE 48 -#define UNEQUAL_MEMORY_AND_DISK_DIMS 49 -#define LINKS_TOO_DEEP 50 -#define NODE_IS_NOT_A_LINK 51 -#define LINK_TARGET_NOT_THERE 52 -#define LINKED_TO_FILE_NOT_THERE 53 -#define NODE_ID_ZERO 54 -#define INCOMPLETE_DATA 55 -#define INVALID_NODE_NAME 56 -#define INVALID_VERSION 57 -#define NODES_NOT_IN_SAME_FILE 58 -#define PRISTK_NOT_FOUND 59 -#define MACHINE_FILE_INCOMPATABLE 60 -#define FFLUSH_ERROR 61 -#define NULL_NODEID_POINTER 62 -#endif diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF.inc b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF.inc deleted file mode 100644 index 5c81dd7d3b..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF.inc +++ /dev/null @@ -1,181 +0,0 @@ -C -C File: ADF.inc -C ---------------------------------------------------------------------- -C BOEING -C ---------------------------------------------------------------------- -C Project: CGNS -C Authors: Tom Dickens 865-6122 tpd6908@yak.ca.boeing.com -C Chuck Keagle 234-0990 keagle@cfdd38.cfd.ca.boeing.com -C Date: 2/7/96 -C Purpose: Provide FORTRAN definitions for the ADF-Core routines. -C ---------------------------------------------------------------------- -C ---------------------------------------------------------------------- - - implicit none - -C*********************************************************************** -C Defines: These defines are used within the ADF core routines -C to specify the size in bytes of varoius items. -C Caution: Simply changing a define here may not correctly adjust the -C ADF core code. These sizes are provided for reference only! -C***********************************************************************/ - integer ADF_DATA_TYPE_LENGTH - integer ADF_DATE_LENGTH - integer ADF_FILENAME_LENGTH - integer ADF_FORMAT_LENGTH - integer ADF_LABEL_LENGTH - integer ADF_MAXIMUM_LINK_DEPTH - integer ADF_MAX_DIMENSIONS - integer ADF_MAX_ERROR_STR_LENGTH - integer ADF_MAX_LINK_DATA_SIZE - integer ADF_NAME_LENGTH - integer ADF_STATUS_LENGTH - integer ADF_VERSION_LENGTH - - parameter (ADF_DATA_TYPE_LENGTH = 32) - parameter (ADF_DATE_LENGTH = 32 ) - parameter (ADF_FILENAME_LENGTH = 1024) - parameter (ADF_FORMAT_LENGTH = 20) - parameter (ADF_LABEL_LENGTH = 32) - parameter (ADF_MAXIMUM_LINK_DEPTH = 100) - parameter (ADF_MAX_DIMENSIONS = 12) - parameter (ADF_MAX_ERROR_STR_LENGTH = 80) - parameter (ADF_MAX_LINK_DATA_SIZE = 4096) - parameter (ADF_NAME_LENGTH = 32) - parameter (ADF_STATUS_LENGTH = 32) - parameter (ADF_VERSION_LENGTH = 32 ) - -!*********************************************************************** -! Error-return values -! These values need to be kept in sync with the error strings in -! file ADF_interface.c -!*********************************************************************** -! Don't use zero since you can assign zero to a pointer - - integer NO_ERROR - integer NUMBER_LESS_THAN_MINIMUM - integer NUMBER_GREATER_THAN_MAXIMUM - integer STRING_LENGTH_ZERO - integer STRING_LENGTH_TOO_BIG - integer STRING_NOT_A_HEX_STRING - integer TOO_MANY_ADF_FILES_OPENED - integer ADF_FILE_STATUS_NOT_RECOGNIZED - integer FILE_OPEN_ERROR - integer ADF_FILE_NOT_OPENED - integer FILE_INDEX_OUT_OF_RANGE - integer BLOCK_OFFSET_OUT_OF_RANGE - integer NULL_STRING_POINTER - integer FSEEK_ERROR - integer FWRITE_ERROR - integer FREAD_ERROR - integer ADF_MEMORY_TAG_ERROR - integer ADF_DISK_TAG_ERROR - integer REQUESTED_NEW_FILE_EXISTS - integer ADF_FILE_FORMAT_NOT_RECOGNIZED - integer FREE_OF_ROOT_NODE - integer FREE_OF_FREE_CHUNK_TABLE - integer REQUESTED_OLD_FILE_NOT_FOUND - integer UNIMPLEMENTED_CODE - integer SUB_NODE_TABLE_ENTRIES_BAD - integer MEMORY_ALLOCATION_FAILED - integer DUPLICATE_CHILD_NAME - integer ZERO_DIMENSIONS - integer BAD_NUMBER_OF_DIMENSIONS - integer CHILD_NOT_OF_GIVEN_PARENT - integer DATA_TYPE_TOO_LONG - integer INVALID_DATA_TYPE - integer NULL_POINTER - integer NO_DATA - integer ERROR_ZEROING_OUT_MEMORY - integer REQUESTED_DATA_TOO_LONG - integer END_OUT_OF_DEFINED_RANGE - integer BAD_STRIDE_VALUE - integer MINIMUM_GT_MAXIMUM - integer MACHINE_FORMAT_NOT_RECOGNIZED - integer CANNOT_CONVERT_NATIVE_FORMAT - integer CONVERSION_FORMATS_EQUAL - integer DATA_TYPE_NOT_SUPPORTED - integer FILE_CLOSE_ERROR - integer NUMERIC_OVERFLOW - integer START_OUT_OF_DEFINED_RANGE - integer ZERO_LENGTH_VALUE - integer BAD_DIMENSION_VALUE - integer BAD_ERROR_STATE - integer UNEQUAL_MEMORY_AND_DISK_DIMS - integer LINKS_TOO_DEEP - integer NODE_IS_NOT_A_LINK - integer LINK_TARGET_NOT_THERE - integer LINKED_TO_FILE_NOT_THERE - integer NODE_ID_ZERO - integer INCOMPLETE_DATA - integer INVALID_NODE_NAME - integer INVALID_VERSION - integer NODES_NOT_IN_SAME_FILE - integer PRISTK_NOT_FOUND - integer MACHINE_FILE_INCOMPATABLE - integer FFLUSH_ERROR - integer NULL_NODEID_POINTER - - parameter (NO_ERROR = -1) - parameter (NUMBER_LESS_THAN_MINIMUM = 1) - parameter (NUMBER_GREATER_THAN_MAXIMUM = 2) - parameter (STRING_LENGTH_ZERO = 3) - parameter (STRING_LENGTH_TOO_BIG = 4) - parameter (STRING_NOT_A_HEX_STRING = 5) - parameter (TOO_MANY_ADF_FILES_OPENED = 6) - parameter (ADF_FILE_STATUS_NOT_RECOGNIZED= 7) - parameter (FILE_OPEN_ERROR = 8) - parameter (ADF_FILE_NOT_OPENED = 9) - parameter (FILE_INDEX_OUT_OF_RANGE = 10) - parameter (BLOCK_OFFSET_OUT_OF_RANGE = 11) - parameter (NULL_STRING_POINTER = 12) - parameter (FSEEK_ERROR = 13) - parameter (FWRITE_ERROR = 14) - parameter (FREAD_ERROR = 15) - parameter (ADF_MEMORY_TAG_ERROR = 16) - parameter (ADF_DISK_TAG_ERROR = 17) - parameter (REQUESTED_NEW_FILE_EXISTS = 18) - parameter (ADF_FILE_FORMAT_NOT_RECOGNIZED= 19) - parameter (FREE_OF_ROOT_NODE = 20) - parameter (FREE_OF_FREE_CHUNK_TABLE = 21) - parameter (REQUESTED_OLD_FILE_NOT_FOUND = 22) - parameter (UNIMPLEMENTED_CODE = 23) - parameter (SUB_NODE_TABLE_ENTRIES_BAD = 24) - parameter (MEMORY_ALLOCATION_FAILED = 25) - parameter (DUPLICATE_CHILD_NAME = 26) - parameter (ZERO_DIMENSIONS = 27) - parameter (BAD_NUMBER_OF_DIMENSIONS = 28) - parameter (CHILD_NOT_OF_GIVEN_PARENT = 29) - parameter (DATA_TYPE_TOO_LONG = 30) - parameter (INVALID_DATA_TYPE = 31) - parameter (NULL_POINTER = 32) - parameter (NO_DATA = 33) - parameter (ERROR_ZEROING_OUT_MEMORY = 34) - parameter (REQUESTED_DATA_TOO_LONG = 35) - parameter (END_OUT_OF_DEFINED_RANGE = 36) - parameter (BAD_STRIDE_VALUE = 37) - parameter (MINIMUM_GT_MAXIMUM = 38) - parameter (MACHINE_FORMAT_NOT_RECOGNIZED = 39) - parameter (CANNOT_CONVERT_NATIVE_FORMAT = 40) - parameter (CONVERSION_FORMATS_EQUAL = 41) - parameter (DATA_TYPE_NOT_SUPPORTED = 42) - parameter (FILE_CLOSE_ERROR = 43) - parameter (NUMERIC_OVERFLOW = 44) - parameter (START_OUT_OF_DEFINED_RANGE = 45) - parameter (ZERO_LENGTH_VALUE = 46) - parameter (BAD_DIMENSION_VALUE = 47) - parameter (BAD_ERROR_STATE = 48) - parameter (UNEQUAL_MEMORY_AND_DISK_DIMS = 49) - parameter (LINKS_TOO_DEEP = 50) - parameter (NODE_IS_NOT_A_LINK = 51) - parameter (LINK_TARGET_NOT_THERE = 52) - parameter (LINKED_TO_FILE_NOT_THERE = 53) - parameter (NODE_ID_ZERO = 54) - parameter (INCOMPLETE_DATA = 55) - parameter (INVALID_NODE_NAME = 56) - parameter (INVALID_VERSION = 57) - parameter (NODES_NOT_IN_SAME_FILE = 58) - parameter (PRISTK_NOT_FOUND = 59) - parameter (MACHINE_FILE_INCOMPATABLE = 60) - parameter (FFLUSH_ERROR = 61) - parameter (NULL_NODEID_POINTER = 62) diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_fbind.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_fbind.h deleted file mode 100644 index d99f33720d..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_fbind.h +++ /dev/null @@ -1,173 +0,0 @@ -/*****************************************************************************/ -/* McDonnell Douglas Corporation */ -/*****************************************************************************/ -/* */ -/*****************************************************************************/ -/* 'typedefs' and macro definitions for interfacing FORTRAN and C */ -/*****************************************************************************/ - -#if defined(SYSTYPE) -#undef SYSTYPE -#endif - -#if defined(USE_CGNS_MACROS) -/* use the CGNS Fortran macros */ -#include "fortran_macros.h" -#define SYSTYPE -typedef VINTEGER Fint; -typedef VFLOAT Freal; -typedef VREAL Fdouble; -typedef VCHARACTER *Fchar; -#define F2CP(FCHAR) STR_PTR(FCHAR) -#define FNAME(A,B) FMNAME(A,B) - -#elif defined(__convexc__) -/* Convex */ -#define SYSTYPE -typedef int Fint; -typedef float Freal; -typedef double Fdouble; -typedef char *Fchar; -#define F2CP(FCHAR) (FCHAR) -#define FNAME(A,B) A ## _ - -#elif defined(cray) -/* Cray */ -#define SYSTYPE -#include -typedef int Fint; -typedef float Freal; -typedef double Fdouble; -typedef _fcd Fchar; -#define F2CP(FCHAR) (_fcdtocp(FCHAR)) -#define FNAME(A,B) B - -#elif defined(__hpux) -/* Hewlett Packard HP-UX */ -#define SYSTYPE -typedef int Fint; -typedef float Freal; -typedef double Fdouble; -typedef char *Fchar; -#define F2CP(FCHAR) (FCHAR) -#define FNAME(A,B) A - -#elif defined(_AIX) -/* IBM RS/6000 */ -#define SYSTYPE -typedef int Fint; -typedef float Freal; -typedef double Fdouble; -typedef char *Fchar; -#define F2CP(FCHAR) (FCHAR) -#define FNAME(A,B) A - -#elif defined(__PARAGON__) -/* Intel Paragon */ -#define SYSTYPE -typedef int Fint; -typedef float Freal; -typedef double Fdouble; -typedef char *Fchar; -#define F2CP(FCHAR) (FCHAR) -#define FNAME(A,B) A ## _ - -#elif defined(sgi) -/* Silicon Graphics */ -#define SYSTYPE -typedef int Fint; -typedef float Freal; -typedef double Fdouble; -typedef char *Fchar; -#define F2CP(FCHAR) (FCHAR) -#define FNAME(A,B) A ## _ - -#elif defined(VMS) -/* DEC VAX/VMS */ -#define SYSTYPE -typedef int Fint; -typedef float Freal; -typedef double Fdouble; -typedef struct dsc$descriptor_s *Fchar; -#define F2CP(FCHAR) ((FCHAR)->dsc$a_pointer) -#define FNAME(A,B) A -#include - -#elif defined(__alpha) -/* DEC ALPHA OSF/1 */ -#define SYSTYPE -typedef int Fint; -typedef float Freal; -typedef double Fdouble; -typedef char *Fchar; -#define F2CP(FCHAR) (FCHAR) -#define FNAME(A,B) A ## _ - -#elif defined(PPRO) -/* Pentium Pro (P6) using the Intel Reference Compiler */ -#define SYSTYPE -typedef int Fint; -typedef float Freal; -typedef double Fdouble; -typedef char *Fchar; -#define F2CP(FCHAR) (FCHAR) -#define FNAME(A,B) A - -#elif defined(sun) -/* Sun */ -#define SYSTYPE -typedef int Fint; -typedef float Freal; -typedef double Fdouble; -typedef char *Fchar; -#define F2CP(FCHAR) (FCHAR) -#define FNAME(A,B) A ## _ - -#elif defined(_WIN32) -/* WIN32 */ -#define SYSTYPE -typedef int Fint; -typedef float Freal; -typedef double Fdouble; -typedef char *Fchar; -#define F2CP(FCHAR) (FCHAR) -#define FNAME(A,B) B - -#elif defined(_CX_UX) -/* Harris Nighthawk */ -#define SYSTYPE -typedef int Fint; -typedef float Freal; -typedef double Fdouble; -typedef char *Fchar; -#define F2CP(FCHAR) (FCHAR) -#define FNAME(A,B) A ## _ - -#elif defined(m88k) -#define SYSTYPE -typedef int Fint; -typedef float Freal; -typedef double Fdouble; -typedef char *Fchar; -#define F2CP(FCHAR) (FCHAR) -#define FNAME(A,B) A/**/_ - -#elif defined(__linux__) -/* LINUX on Intel */ -#define SYSTYPE -typedef int Fint; -typedef float Freal; -typedef double Fdouble; -typedef char *Fchar; -#define F2CP(FCHAR) (FCHAR) -#define FNAME(A,B) A ## _ - -#else -typedef int Fint; -typedef float Freal; -typedef double Fdouble; -typedef char *Fchar; -#define F2CP(FCHAR) (FCHAR) -#define FNAME(A,B) A -#endif - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_fortran.f b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_fortran.f deleted file mode 100644 index c86a3242dc..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_fortran.f +++ /dev/null @@ -1,704 +0,0 @@ -c -c*********************************************************************** -c R1: Get Children names of a Node. Return the name of children nodes -c directly associated with a parent node. The names of the children -c are NOT guaranteed to be returned in any particular order. If a -c new child is added, it is NOT guaranteed to be returned as the last -c child. Note: To start with the first child, use an istart value of 1. -c -c f77: ADFCNAM( ID, istart, inum, inamlen, inumret, names, ierr ) -c input: real*8 ID. The ID of the Node to use. -c input: integer istart. The Nth child's name to start with (first=1). -c input: integer inum. Maximum number of names to return. -c input: integer inamlen. Length of names. -c output: integer inumret. The number of names returned. -c output: character*(*) names Array of names. -c output: integer ierr. -c*********************************************************************** - subroutine ADFCNAM( ID, istart, inum, inamlen, inumret, names, - 1 ierr ) - IMPLICIT NONE - real*8 ID - integer istart - integer inum - integer inamlen - integer inumret - character*(*) names - integer ierr - - call ADFCNA2( ID, istart, inum, inamlen, len(names), inumret, - 1 names, ierr ) - return - end - -c*********************************************************************** -c R1: Create a Node. Create a new node (not a link-node) as a child -c of a given parent. Default values in this new node are: label=blank, -c number of sub-nodes = 0, data-type = "MT", number of dimensions -c = 0, data = NULL. -c -c f77: ADFCRE( PID, name, ID, ierr ) -c input: real*8 PID. The ID of the parent node, to whom we are -c creating a new child node. -c input: character*(*) name. -c output: real*8 ID. The ID of the newly created node. -c output: integer ierr. -c*********************************************************************** - subroutine ADFCRE( PID, name, ID, ierr ) - IMPLICIT NONE - real*8 PID - character*(*) name - real*8 ID - integer ierr - - call ADFCRE2( PID, name, LEN( name ), ID, ierr ) - return - end - -c*********************************************************************** -c R1: Close an opened database. If the ADF database spans multiple -c files then all files used will also be closed. If an ADF file which -c is linked to by this database is also opened through another -c database, only the opened file stream associated with this database -c will be closed. -c -c f77: ADFDCLO( RootID, ierr ) -c input: real*8 RootID Root ID of the database. -c output: integer ierr. -c*********************************************************************** - subroutine ADFDCLO( RootID, ierr ) - IMPLICIT NONE - real*8 RootID - integer ierr - - call ADFDCL2( RootID, ierr ) - return - end - -c*********************************************************************** -c Rn: Delete an existing database. This will delete one or more ADF -c files which are linked together under file top ADF file named -c "filename". -c -c f77: ADFDDEL( filename, ierr ) -c input: character*(*) filename -c output: integer ierr. -c*********************************************************************** - subroutine ADFDDEL( filename, ierr ) - IMPLICIT NONE - character*(*) filename - integer ierr - - call ADFDDE2( filename, LEN( filename ), ierr ) - return - end - -c*********************************************************************** -c R2: Delete a Node. If the node is NOT a link, then the specified -c node and all -c sub-nodes anywhere under it are also deleted. For a link, and also -c for links farther down in the tree, the link-node will be deleted, -c but the node which the link is linked to is not affected. When a -c node is deleted, other link-nodes which point to it are left -c dangling. For example, if N13 is deleted, then L1 and L2 point to a -c non-existing node. This is OK until L1 and L2 are used. -c -c f77: ADFDEL( PID, ID, ierr ) -c input: real*8 PID. The ID of the node's parent. -c input: real*8 ID. The ID of the node to use. -c output: integer ierr. -c*********************************************************************** - subroutine ADFDEL( PID, ID, ierr ) - IMPLICIT NONE - real*8 PID - real*8 ID - integer ierr - - call ADFDEL2( PID, ID, ierr ) - return - end - -c*********************************************************************** -c Rn: Garbage Collection. Redistribute data in the file to use free- -c space which is not located at the end of the file. Neighboring free -c spaces will be merged. Note: For better file compaction a utility -c could be written to copy an ADF file, creating a new ADF file -c without any wasted space. -c -c f77: ADFDGC( ID, ierr ) -c input: real*8 ID. The ID of a node in the ADF file in which to do -c garbage collection. -c output: integer ierr. -c*********************************************************************** - subroutine ADFDGC( ID, ierr ) - IMPLICIT NONE - real*8 ID - integer ierr - - call ADFDGC2( ID, ierr ) - return - end - -c*********************************************************************** -c R1: Get the data format used in an existing database. -c -c f77: ADFDGF( RootID, format, ierr ) -c input: real*8 RootID The rootID of the ADF file. -c output: character*20 format. See format for ADFDOPN. -c output: integer ierr. -c*********************************************************************** - subroutine ADFDGF( RootID, format, ierr ) - IMPLICIT NONE - real*8 RootID - character*(*) format - integer ierr - - call ADFDGF2( RootID, format, LEN( format ), ierr ) - return - end - -c*********************************************************************** -c R1: Open a database. Open either a new or an existing ADF file. -c If links to other ADF files are used, these additional files will be -c opened automatically as required. -c -c f77: ADFDOPN( filename, status, format, rootID, ierr) -c input: character*(*) filename. Not used if status SCRATCH is -c used. Filename must be a legal name and may -c include a relative or absolute path. It must be -c directly usable by the C fopen() system -c routine (no environment expansion is done). -c input: character*(*) status. Like FORTRAN OPEN() status. -c This field is required. Allowable values are: -c READ_ONLY - File must exist. Writing NOT allowed. -c OLD - File must exist. Reading and writing allowed. -c NEW - File must not exist. -c SCRATCH - New file. Filename is ignored. -c UNKNOWN - OLD if file exists, else NEW is used. -c input: character*(*) format. Specifies the numeric format for -c the file. If blank, the machine's native -c format is used. This field is only used when a -c file is created. -c NATIVE - Determine the format on the machine. If the -c native format is not one of the formats -c supported, the created file cannot be used on -c other machines. -c IEEE_BIG - Use the IEEE big ENDIAN format. -c IEEE_LITTLE - Use the IEEE little ENDIAN format. -c CRAY - Use the native Cray format. -c output: real*8 rootID -c output: integer ierr. -c*********************************************************************** - subroutine ADFDOPN( filename, status, format, rootID, ierr) - IMPLICIT NONE - character*(*) filename - character*(*) status - character*(*) format - real*8 rootID - integer ierr - - call ADFDOP2( filename, len( filename ), status, len( status ), - 1 format, len( format ), rootID, ierr ) - return - end - -c*********************************************************************** -c R1: Set the data format used in an existing database. -c Note: Use with extreme caution. Needed only -c for data conversion utilities and NOT intended -c for the general user!!! -c -c f77: ADFDSF( RootID, format, ierr ) -c input: real*8 RootID The rootID if the ADF file. -c input: character*(*) format. See format for ADFDOPN. -c output: integer ierr. -c*********************************************************************** - subroutine ADFDSF( RootID, format, ierr ) - IMPLICIT NONE - real*8 RootID - character*(*) format - integer ierr - - call ADFDSF2( RootID, format, len( format ), ierr ) - return - end - -c*********************************************************************** -c R1: Get ADF File Version ID. This is the version number of the ADF -c library routines which created an ADF database. Modified ADF databases -c will take on the version ID of the current ADF library version if -c it is higher than the version indicated in the file. -c The format of the version ID is: "ADF Database Version 000.01" -c -c f77: ADFDVER( RootID, version, cdate, mdate, ierr ) -c input: real*8 RootID. The ID of the root node in the ADF file. -c output: character(32) version. A 32-byte character string -c containing the version ID. -c output: character(32) cdate. A 32-byte character string -c containing the creation date of the file. -c output: character(32) mdate. A 32-byte character -c string containing the last modification date of the file. -c output: integer ierr. -c*********************************************************************** - subroutine ADFDVER( RootID, version, cdate, mdate, ierr ) - IMPLICIT NONE - real*8 RootID - character*(*) version - character*(*) cdate - character*(*) mdate - integer ierr - - call ADFDVE2( RootID, version, cdate, mdate, - 1 len( version ), len( cdate ), len( mdate ), ierr ) - return - end - -c*********************************************************************** -c R1: Return Error Message. Given an ierr from an ADF routine, -c get a textual description of the error. -c -c f77: ADFERR( ierr, errstr ) -c input: integer ierr. -c output: character(80) errstr. An 80-byte description of -c the specified error. If the number is bad, the -c string "Unknown error #nnn" is returned. -c*********************************************************************** - subroutine ADFERR( ierr, errstr ) - IMPLICIT NONE - integer ierr - character*(*) errstr - - call ADFERR2( ierr, errstr, len( errstr ) ) - return - end - -c*********************************************************************** -c R1: Flush data to disk. This routine is used to force any modified -c information to be flushed to the physical disk. This ensures that -c data will not be lost if a program aborts. This control of when to -c flush all data to disk is provided to the user rather than to flush -c the data every time it is modified, which would result in reduced -c performance. -c -c f77: ADFFTD( ID, ierr ) -c input: real*8 ID. The ID of a node in the ADF file in which to flush. -c output: integer ierr. -c*********************************************************************** - subroutine ADFFTD( ID, ierr ) - IMPLICIT NONE - real*8 ID - integer ierr - - call ADFFTD2( ID, ierr ) - return - end - -c*********************************************************************** -c R1: Get Data Type. Return the 32 character string in a node's data- -c type field. In C, the data-type will be null terminated after the last -c non-blank character. A maximum of 33 characters may be used -c (32 for the data-type plus 1 for the null). -c -c f77: ADFGDT( ID, dtype, ierr ) -c input: real*8 ID. The ID of the node to use. -c output: character*(*) dtype. The 32-character data-type of the node. -c output: integer ierr. -c*********************************************************************** - subroutine ADFGDT( ID, dtype, ierr ) - IMPLICIT NONE - real*8 ID - character*(*) dtype - integer ierr - - call ADFGDT2( ID, dtype, len( dtype ), ierr ) - return - end - -c*********************************************************************** -c R1: Get Dimension Values. Return the dimension values for a node. -c Values will only be returned for the number of dimensions defined in -c the node. If the number of dimensions for the node is zero, an -c error is returned. -c -c f77: ADFGDV( ID, dvals, ierr ) -c input: real*8 ID. The ID of the node to use. -c output: integer dvals(12). -c output: integer ierr. -c*********************************************************************** - subroutine ADFGDV( ID, dvals, ierr ) - IMPLICIT NONE - real*8 ID - integer dvals(12) - integer ierr - - call ADFGDV2( ID, dvals, ierr ) - return - end - -c*********************************************************************** -c R1 Get Error State. Return the active error state. -c -c f77: ADFGES( estate, ierr ) -c output: integer estate. Flag for ABORT on error (1) or return -c error status (0). Set on a per database basis. -c output: integer ierr. -c*********************************************************************** - subroutine ADFGES( estate, ierr ) - IMPLICIT NONE - integer estate - integer ierr - - call ADFGES2( estate, ierr ) - return - end - -c*********************************************************************** -c R1: Get Label. Return the 32 character string in a node's label field. -c In C, the label will be null terminated after the last non-blank -c character. A maximum of 33 characters may be used (32 for the -c label plus 1 for the null). -c -c f77: ADFGLB( ID, label, ierr ) -c input: real*8 ID. The ID of the node to use. -c output: character*(*) label. The 32-character label of the node. -c output: integer ierr. -c*********************************************************************** - subroutine ADFGLB( ID, label, ierr ) - IMPLICIT NONE - real*8 ID - character*(*) label - integer ierr - - call ADFGLB2( ID, label, len( label ), ierr ) - return - end - -c*********************************************************************** -c R1: Get path information from a link. If the node is a link-node, -c return the path information. Else, return an error. -c If the link is in the same file, then a blank filename is returned. -c -c f77: ADFGLKP( ID, file, name, ierr ) -c input: real*8 ID. The ID of the node to use. -c output: character*(*) file. The filename. -c output: character*(*) name. The name of node. -c output: integer ierr. -c*********************************************************************** - subroutine ADFGLKP( ID, file, name, ierr ) - IMPLICIT NONE - real*8 ID - character*(*) file - character*(*) name - integer ierr - - call ADFGLK2( ID, file, len( file ), name, len( name ), ierr ) - return - end - -c*********************************************************************** -c R1: Get Name of a Node. Given a node's ID, return the 32 character -c name of that node. In C, the name will be null terminated after the -c last non-blank character. A maximum of 33 characters may be used -c (32 for the name plus 1 for the null). -c -c f77: ADFGNAM( ID, name, ierr ) -c input: real*8 ID. The ID of the node to use. -c output: character*(*) name. The simple name of the node. -c output: integer ierr. -c*********************************************************************** - subroutine ADFGNAM( ID, name, ierr ) - IMPLICIT NONE - real*8 ID - character*(*) name - integer ierr - - call ADFGNA2( ID, name, len( name ), ierr ) - return - end - -c*********************************************************************** -c R1: Get Number of Dimensions. Return the number of data dimensions -c used in a node. Valid values are from 0 to 12. -c -c f77: ADFGND( ID, ndims, ierr ) -c input: real*8 ID. The ID of the node to use. -c output: integer ndims. -c output: integer ierr. -c*********************************************************************** - subroutine ADFGND( ID, ndims, ierr ) - IMPLICIT NONE - real*8 ID - integer ndims - integer ierr - - call ADFGND2( ID, ndims, ierr ) - return - end - -c*********************************************************************** -c R1: Get Unique-Identifier of a Node. Given a parent node ID and a -c a name of child node, return the ID of the child. To return the ID -c of the root-node in an ADF file, use any known ID in the ADF file -c and a name of "/". -c -c f77: ADFGNID( PID, name, ID, ierr ) -c input: real*8 PID. The ID of the Node's parent. -c input: character*(*) name. The name of the node. Compound -c names including path information use a slash -c "/" notation between node names. If a -c leading slash is used, then PID can be any -c valid node ID in the ADF database. -c output: real*8 ID. The ID of the named node. -c output: integer ierr. -c*********************************************************************** - subroutine ADFGNID( PID, name, ID, ierr ) - IMPLICIT NONE - real*8 PID - character*(*) name - real*8 ID - integer ierr - - call ADFGNI2( PID, name, len( name ), ID, ierr ) - return - end - -c*********************************************************************** -c R1: Get root-ID for an ADF system from any ID in the system. -c -c f77: ADFGRID( ID, RootID, ierr ) -c input: real*8 ID. The ID of the node to use. -c output: real*8 RootID. The ID of the root node. -c output: integer ierr. -c*********************************************************************** - subroutine ADFGRID( ID, RootID, ierr ) - IMPLICIT NONE - real*8 ID - real*8 RootID - integer ierr - - call ADFGRI2( ID, RootID, ierr ) - return - end - -c*********************************************************************** -c R1: Test if a Node is a link. If the actual data-type of the node -c is "LK" (created with ADF_Link), return the link path length. -c Otherwise, return 0. -c -c f77: ADFISLK( ID, lplen, ierr ) -c input: real*8 ID. The ID of the node to use. -c input: integer lplen. 0 if the node is NOT a link. If -c the node is a link, the length of the path string is returned. -c output: integer ierr. -c*********************************************************************** - subroutine ADFISLK( ID, lplen, ierr ) - IMPLICIT NONE - real*8 ID - integer lplen - integer ierr - - call ADFISL2( ID, lplen, ierr ) - return - end - -c*********************************************************************** -c R1: Create a link. Note: The Node linked to does not have to exist -c when the link is created (but it may exist and that is OK). However, -c when the link is used, an error will occur if the linked to node does -c not exist. -c -c f77: ADFLINK( PID, name, file, nfile, ID, ierr ) -c input: real*8 PID. The ID of the Node's parent. -c input: character*(*) name. The name of the link node. -c input: character*(*) file. The filename to use for the link -c (directly usable by a C open() routine). If -c blank (null), the link will be within the same file. -c input: character*(*) nfile. The name of the node which -c the link will point to. This can be a simple or -c compound name. -c output: real*8 ID. The ID of the link-node. -c output: integer ierr. -c*********************************************************************** - subroutine ADFLINK( PID, name, file, nfile, ID, ierr ) - IMPLICIT NONE - real*8 PID - character*(*) name - character*(*) file - character*(*) nfile - real*8 ID - integer ierr - - call ADFLIN2( PID, name, file, nfile, len( name ), - 1 len( file ), len( nfile ), ID, ierr ) - return - end - -c*********************************************************************** -c R1: Get ADF Library Version ID. This is the version number of the -c ADF library routines which your program is currently using. -c The format of the version ID is: "ADF Library Version 000.01" -c Note: There is a double space between Library and Version. This -c lines up the number with the Database Version string. -c -c f77: ADFLVER( version, ierr ) -c output: character(32) version. A 32-byte character string -c containing the ADF Library version ID information. -c output: integer ierr. -c*********************************************************************** - subroutine ADFLVER( version, ierr ) - IMPLICIT NONE - character*(*) version - integer ierr - - call ADFLVE2( version, len( version ), ierr ) - return - end - -c*********************************************************************** -c R2: Change Parent (move a Child Node). The node and the 2 parents -c must all exist within a single ADF file. If the node is pointed to -c by a link-node, changing the node's parent will break the link. -c -c f77: ADFMOVE( PID, ID, NPID, ierr ) -c input: real*8 PID. The ID of the Node's parent. -c input: real*8 ID. The ID of the node to use. -c input: real*8 NPID. The ID of the Node's New Parent -c output: integer ierr. -c*********************************************************************** - subroutine ADFMOVE( PID, ID, NPID, ierr ) - IMPLICIT NONE - real*8 PID - real*8 ID - real*8 NPID - integer ierr - - call ADFMOV2( PID, ID, NPID, ierr ) - return - end - -c*********************************************************************** -c R1: Get Number of Children of a Node. Return the number of children -c nodes directly associated with a parent node. -c -c f77: ADFNCLD( ID, numcld, ierr ) -c input: real*8 ID. The ID of the node to use. -c output: integer numcld. The number of children directly -c associated with this node. -c output: integer ierr. -c*********************************************************************** - subroutine ADFNCLD( ID, numcld, ierr ) - IMPLICIT NONE - real*8 ID - integer numcld - integer ierr - - call ADFNCL2( ID, numcld, ierr ) - return - end - -c*********************************************************************** -c R1: Set/change the data-type and Dimension Information of a Node. -c Valid user-definable data-types are: -c -c No data MT -c Integer 32 I4 -c Integer 64 I8 -c Unsigned Int 32 U4 -c Unsigned Int 64 U8 -c Real 32 R4 -c Real 64 R8 -c Complex 64 X4 -c Complex 128 X8 -c Character (unsigned byte) C1 -c Byte (unsigned byte) B1 -c Compound data-types can be used which combine types -c ("I4,I4,R8"), define an array ("I4[25]"), or a combination of these -c ("I4,C1[20],R8[3]"). -c dims can be a number from 0 to 12. -c dim_vals is an array of integers. The number of integers used is -c determined by the dims argument. If dims is zero, the dim_values -c are not used. Valid range for dim_values are from 1 to -c 2,147,483,648. The total data size, calculated by the data-type-size -c times the dimension value(s), cannot exceed 2,147,483,648. -c Note: When this routine is called and the data-type or the -c number of dimensions changes, any data currently associated -c with the node is lost!! The dimension values can be changed and -c the data space will be extended as needed. -c- -c f77: ADFPDIM( ID, dtype, dims, dvals, ierr) -c input: real*8 ID. The ID of the node. -c input: character*(*) dtype. -c input: integer dims. The number of dimensions this node has. -c input: integer dvals(12). The dimension values for this node. -c output: integer ierr. -c*********************************************************************** - subroutine ADFPDIM( ID, dtype, dims, dvals, ierr) - IMPLICIT NONE - real*8 ID - character*(*) dtype - integer dims - integer dvals(12) - integer ierr - - call ADFPDI2( ID, dtype, len( dtype ), dims, dvals, ierr) - return - end - -c*********************************************************************** -c R2: Put (change) Name of a Node. Warning: If the node is pointed -c to by a link-node, changing the node's name will break the link. -c -c f77: ADFPNAM( PID, ID, name, ierr ) -c input: real*8 PID. The ID of the Node's parent. -c input: real*8 ID. The ID of the node to use. -c input: character*(*) name. The new name of the node. -c output: integer ierr. -c*********************************************************************** - subroutine ADFPNAM( PID, ID, name, ierr ) - IMPLICIT NONE - real*8 PID - real*8 ID - character*(*) name - integer ierr - - call ADFPNA2( PID, ID, name, len( name ), ierr ) - return - end - -c*********************************************************************** -c R1 Set Error State. For all ADF calls, set the error handling -c convention; either return error codes, or abort the program on an error. -c The default state for the ADF interface is to return error codes and NOT -c abort. -c -c f77: ADFSES( estate, ierr ) -c input: integer estate. Flag for ABORT on error (1) or return -c error status (0). Set on a per database basis. -c output: integer ierr. -c*********************************************************************** - subroutine ADFSES( estate, ierr ) - IMPLICIT NONE - integer estate - integer ierr - - call ADFSES2( estate, ierr ) - return - end - -c*********************************************************************** -c R1: Set Label. Set the 32 character string in a node's label field. -c -c f77: ADFSLB( ID, label, ierr ) -c input: real*8 ID. The ID of the node to use. -c input: character*(*) label. The 32-character label of the node. -c output: integer ierr. -c*********************************************************************** - subroutine ADFSLB( ID, label, ierr ) - IMPLICIT NONE - real*8 ID - character*(*) label - integer ierr - - call ADFSLB2( ID, label, len( label ), ierr ) - return - end diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_fortran_2_c.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_fortran_2_c.c deleted file mode 100644 index d8e30edf36..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_fortran_2_c.c +++ /dev/null @@ -1,1061 +0,0 @@ -/* created by combine 2.0 */ -/* file ADFAAA2.c */ -/*********************************************************************** - ADF Core: - Glue routines between the FORTRAN interface and the C interface. - -***********************************************************************/ - -#ifndef MAKEDEPEND -#include -#include -#include -#endif - -#include "libadf/ADF.h" -#include "libadf/ADF_internals.h" -/* end of file ADFAAA2.c */ -/* file ADFCNA2.c */ -/*********************************************************************** -ADFCNAM ADF_Children_Names: -***********************************************************************/ -void FNAME(adfcna2,ADFCNA2)( - const Fdouble *PID, - const Fint *istart, - const Fint *imaxnum, - const Fint *idim, - const Fint *name_length, - Fint *inum_ret, - Fchar names, - Fint *error_return ) -{ -int i; -char *pstr, *tmp_names; - -if( *idim != *name_length ) { /** inconsistency **/ - *error_return = BAD_DIMENSION_VALUE ; /** not really what this error code - was meant for but it might do **/ - return ; - } /* end if */ - -pstr = F2CP(names); - -tmp_names = (char *) malloc( (*imaxnum) * (*name_length + 1) * (sizeof(char)) ) ; -if( tmp_names == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - return ; - } /* end if */ - -ADF_Children_Names( *PID, *istart, *imaxnum, *name_length, inum_ret, - tmp_names, error_return ) ; -if( *error_return != NO_ERROR ) { - free( tmp_names ) ; - return ; - } /* end if */ - -for( i=0; i<*inum_ret; i++ ) { /* Blank-fill the names */ - if( strlen( &tmp_names[ i * (*name_length+1) ]) == (unsigned)*name_length) { -/** string is maximum length, do not null terminate or blank fill **/ - strncpy( &pstr[ i * (*name_length) ], &tmp_names[ i * (*name_length+1) ], - *name_length ) ; - } - else { -/** string is short enough, blank fill remainder **/ - strcpy( &pstr[ i * (*name_length) ], &tmp_names[ i * (*name_length+1) ] ) ; - ADFI_blank_fill_string( &pstr[ i * (*name_length) ], *name_length ) ; - } /* end if */ - } /* end for */ - -free( tmp_names ) ; -} -/* end of file ADFCNA2.c */ -/* file ADFCID2.c */ -/*********************************************************************** -ADFCNAM ADF_Children_IDs: -***********************************************************************/ -void FNAME(adfcid2,ADFCID2)( - const Fdouble *PID, - const Fint *istart, - const Fint *imaxnum, - Fint *inum_ret, - Fdouble *CIDs, - Fint *error_return ) -{ -ADF_Children_IDs( *PID, *istart, *imaxnum, inum_ret, CIDs, error_return ) ; -} -/* end of file ADFCID2.c */ -/* file ADFCRE2.c */ -/*********************************************************************** -ADFCRE ADF_Create: -***********************************************************************/ -void FNAME(adfcre2,ADFCRE2)( - const Fdouble *PID, - const Fchar name, - const Fint *name_length, - Fdouble *ID, - Fint *error_return ) -{ -char c_name[ ADF_NAME_LENGTH + 1 ] ; - -ADFI_string_2_C_string( F2CP(name), MIN(ADF_NAME_LENGTH, *name_length), c_name, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADF_Create( *PID, c_name, ID, error_return ) ; -} -/* end of file ADFCRE2.c */ -/* file ADFDCL2.c */ -/*********************************************************************** -ADFDCLO ADF_Database_Close: -***********************************************************************/ -void FNAME(adfdcl2,ADFDCL2)( - const Fdouble *Root_ID, - Fint *error_return ) -{ -ADF_Database_Close( *Root_ID, error_return ) ; -} -/* end of file ADFDCL2.c */ -/* file ADFDDE2.c */ -/*********************************************************************** -ADFDDEL ADF_Database_Delete: -***********************************************************************/ -void FNAME(adfdde2,ADFDDE2)( - const Fchar filename, - const Fint *name_length, - Fint *error_return ) -{ -char c_name[ ADF_FILENAME_LENGTH + 1 ] ; - -ADFI_string_2_C_string( F2CP(filename), MIN(ADF_FILENAME_LENGTH, *name_length), - c_name, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADF_Database_Delete( c_name, error_return ) ; -} -/* end of file ADFDDE2.c */ -/* file ADFDEL2.c */ -/*********************************************************************** -ADFDEL ADF_Delete: -***********************************************************************/ -void FNAME(adfdel2,ADFDEL2)( - const Fdouble *PID, - const Fdouble *ID, - Fint *error_return ) -{ -ADF_Delete( *PID, *ID, error_return ) ; -} -/* end of file ADFDEL2.c */ -/* file ADFDGC2.c */ -/*********************************************************************** -ADFDGC ADF_Database_Garbage_Collection: -***********************************************************************/ -void FNAME(adfdgc2,ADFDGC2)( - const Fdouble *ID, - Fint *error_return ) -{ -ADF_Database_Garbage_Collection( *ID, error_return ) ; -} -/* end of file ADFDGC2.c */ -/* file ADFDGF2.c */ -/*********************************************************************** -ADFDGF ADF_Database_Get_Format: -***********************************************************************/ -void FNAME(adfdgf2,ADFDGF2)( - const Fdouble *Root_ID, - Fchar format, - const Fint *format_length, - Fint *error_return ) -{ -ADF_Database_Get_Format( *Root_ID, F2CP(format), error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_blank_fill_string( F2CP(format), *format_length ) ; -} -/* end of file ADFDGF2.c */ -/* file ADFDOP2.c */ -/*********************************************************************** -ADFDOPN ADF_Database_Open: -***********************************************************************/ -void FNAME(adfdop2,ADFDOP2)( - const Fchar filename, - const Fint *filename_length, - Fchar status_in, - const Fint *status_length, - const Fchar format, - const Fint *format_length, - Fdouble *Root_ID, - Fint *error_return ) -{ -char c_filename[ ADF_FILENAME_LENGTH + 1 ], - c_status[ ADF_NAME_LENGTH+1 ], - c_format[ ADF_NAME_LENGTH+1 ] ; - -ADFI_string_2_C_string( F2CP(filename), - MIN(ADF_FILENAME_LENGTH, *filename_length), - c_filename, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_string_2_C_string( F2CP(status_in), - MIN(ADF_NAME_LENGTH, *status_length), - c_status, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_string_2_C_string( F2CP(format), - MIN(ADF_NAME_LENGTH, *format_length), c_format, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADF_Database_Open( c_filename, c_status, c_format, - Root_ID, error_return ) ; -} -/* end of file ADFDOP2.c */ -/* file ADFDSF2.c */ -/*********************************************************************** -ADFDSF ADF_Database_Set_Format: -***********************************************************************/ -void FNAME(adfdsf2,ADFDSF2)( - const Fdouble *Root_ID, - const Fchar format, - const Fint *format_length, - Fint *error_return ) -{ -char c_format[ ADF_NAME_LENGTH + 1 ] ; - -ADFI_string_2_C_string( F2CP(format), - MIN(ADF_NAME_LENGTH, *format_length), c_format, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADF_Database_Set_Format( *Root_ID, c_format, error_return ) ; -} -/* end of file ADFDSF2.c */ -/* file ADFDVE2.c */ -/*********************************************************************** -ADVDVER ADF_Database_Version: -***********************************************************************/ -void FNAME(adfdve2,ADFDVE2)( - const Fdouble *Root_ID, - Fchar version, - Fchar creation_date, - Fchar modification_date, - const Fint *v_length, - const Fint *c_length, - const Fint *m_length, - Fint *error_return ) -{ -ADF_Database_Version( *Root_ID, F2CP(version), F2CP(creation_date), - F2CP(modification_date), error_return ) ; - -ADFI_blank_fill_string( F2CP(version), *v_length ) ; -ADFI_blank_fill_string( F2CP(creation_date), *c_length ) ; -ADFI_blank_fill_string( F2CP(modification_date), *m_length ) ; -} -/* end of file ADFDVE2.c */ -/* file ADFERR2.c */ -/*********************************************************************** -ADFERR ADF_Error_Message: -***********************************************************************/ -void FNAME(adferr2,ADFERR2)( - const Fint *error_return_input, - Fchar error_string, - const Fint *str_length ) -{ -char msg_buf[ADF_MAX_ERROR_STR_LENGTH+1] ; - -ADF_Error_Message( *error_return_input, msg_buf ) ; -strncpy( F2CP(error_string), msg_buf, *str_length ) ; -ADFI_blank_fill_string( F2CP(error_string), *str_length ) ; -} -/* end of file ADFERR2.c */ -/* file ADFFTD2.c */ -/*********************************************************************** -ADFFTD ADF_Flush_to_Disk: -***********************************************************************/ -void FNAME(adfftd2,ADFFTD2)( - const Fdouble *ID, - Fint *error_return ) -{ -ADF_Flush_to_Disk( *ID, error_return ) ; -} -/* end of file ADFFTD2.c */ -/* file ADFGDT2.c */ -/*********************************************************************** -ADFGDT ADF_Get_Data_Type: -***********************************************************************/ -void FNAME(adfgdt2,ADFGDT2)( - const Fdouble *ID, - Fchar data_type, - const Fint *data_type_length, - Fint *error_return ) -{ -char ctype[ ADF_DATA_TYPE_LENGTH + 1 ] ; - -ADF_Get_Data_Type( *ID, ctype, error_return ) ; -if( *error_return == NO_ERROR ) { - if( strlen( ctype ) < (unsigned)*data_type_length ) { - strcpy( F2CP(data_type), ctype ) ; - ADFI_blank_fill_string( F2CP(data_type), *data_type_length ) ; - } - else { - strncpy( F2CP(data_type), ctype, *data_type_length ) ; - } /* end if */ - } /* end if */ -} -/* end of file ADFGDT2.c */ -/* file ADFGDV2.c */ -/*********************************************************************** -ADFGDV ADF_Get_Dimension_Values: -***********************************************************************/ -void FNAME(adfgdv2,ADFGDV2)( - const Fdouble *ID, - Fint dim_vals[], - Fint *error_return ) -{ -ADF_Get_Dimension_Values( *ID, dim_vals, error_return ) ; -} -/* end of file ADFGDV2.c */ -/* file ADFGES2.c */ -/*********************************************************************** -ADFGES ADF_Get_Error_State: -***********************************************************************/ -void FNAME(adfges2,ADFGES2)( - Fint *error_state, - Fint *error_return ) -{ -ADF_Get_Error_State( error_state, error_return ) ; -} -/* end of file ADFGES2.c */ -/* file ADFGLB2.c */ -/*********************************************************************** -ADFGLB ADF_Get_Label: -***********************************************************************/ -void FNAME(adfglb2,ADFGLB2)( - const Fdouble *ID, - Fchar label, - const Fint *label_length, - Fint *error_return ) -{ -char clabel[ ADF_LABEL_LENGTH + 1 ] ; - -ADF_Get_Label( *ID, clabel, error_return ) ; -if( *error_return == NO_ERROR ) { - if( strlen( clabel ) < (unsigned)*label_length ) { - strcpy( F2CP(label), clabel ) ; - ADFI_blank_fill_string( F2CP(label), *label_length ) ; - } - else { - strncpy( F2CP(label), clabel, *label_length ) ; - } /* end if */ - } /* end if */ -} -/* end of file ADFGLB2.c */ -/* file ADFGLK2.c */ -/*********************************************************************** -ADFGLKP ADF_Get_Link_Path: -***********************************************************************/ -void FNAME(adfglk2,ADFGLK2)( - const Fdouble *ID, - Fchar filename, - const Fint *filename_length, - Fchar link_path, - const Fint *link_path_length, - Fint *error_return ) -{ -char cpath[ ADF_MAX_LINK_DATA_SIZE + 1 ], - cfilename[ ADF_FILENAME_LENGTH + 1 ] ; - -ADF_Get_Link_Path( *ID, cfilename, cpath, error_return ) ; -if( *error_return == NO_ERROR ) { - if( strlen(cfilename) < (unsigned)*filename_length ) { - strcpy( F2CP(filename), cfilename ) ; - ADFI_blank_fill_string( F2CP(filename), *filename_length ) ; - } - else { - strncpy( F2CP(filename), cfilename, *filename_length ) ; - } /* end if */ - - if( strlen(cpath) < (unsigned)*link_path_length ) { - strcpy( F2CP(link_path), cpath ) ; - ADFI_blank_fill_string( F2CP(link_path), *link_path_length ) ; - } - else { - strncpy( F2CP(link_path), cpath, *link_path_length ) ; - } /* end if */ - } /* end if */ -} -/* end of file ADFGLK2.c */ -/* file ADFGNA2.c */ -/*********************************************************************** -ADFGNAM ADF_Get_Name: -***********************************************************************/ -void FNAME(adfgna2,ADFGNA2)( - const Fdouble *ID, - Fchar name, - const Fint *name_length, - Fint *error_return ) -{ -char cname[ ADF_NAME_LENGTH + 1 ] ; - -ADF_Get_Name( *ID, cname, error_return ) ; -if( *error_return == NO_ERROR ) { - if( strlen( cname ) < (unsigned)*name_length ) { - strcpy( F2CP(name), cname ) ; - ADFI_blank_fill_string( F2CP(name), *name_length ) ; - } - else { - strncpy( F2CP(name), cname, *name_length ) ; - } /* end if */ - } /* end if */ -} -/* end of file ADFGNA2.c */ -/* file ADFGND2.c */ -/*********************************************************************** -ADFGND ADF_Get_Number_of_Dimensions: -***********************************************************************/ -void FNAME(adfgnd2,ADFGND2)( - const Fdouble *ID, - Fint *num_dims, - Fint *error_return ) -{ -ADF_Get_Number_of_Dimensions( *ID, num_dims, error_return ) ; -} -/* end of file ADFGND2.c */ -/* file ADFGNI2.c */ -/*********************************************************************** -ADFGNID ADF_Get_Node_ID: -***********************************************************************/ -void FNAME(adfgni2,ADFGNI2)( - const Fdouble *PID, - const Fchar name, - const Fint *name_length, - Fdouble *ID, - Fint *error_return ) -{ -char c_name[ ADF_FILENAME_LENGTH + 1 ] ; - -ADFI_string_2_C_string( F2CP(name), MIN(ADF_FILENAME_LENGTH, *name_length), - c_name, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADF_Get_Node_ID( *PID, c_name, ID, error_return ) ; -} -/* end of file ADFGNI2.c */ -/* file ADFGRI2.c */ -/*********************************************************************** -ADFGRID ADF_Get_Root_ID: -***********************************************************************/ -void FNAME(adfgri2,ADFGRI2)( - const Fdouble *ID, - Fdouble *Root_ID, - Fint *error_return ) -{ -ADF_Get_Root_ID( *ID, Root_ID, error_return ) ; -} -/* end of file ADFGRI2.c */ -/* file ADFISL2.c */ -/*********************************************************************** -ADFISLK ADF_Is_Link: -***********************************************************************/ -void FNAME(adfisl2,ADFISL2)( - const Fdouble *ID, - Fint *link_path_length, - Fint *error_return ) -{ -ADF_Is_Link( *ID, link_path_length, error_return ) ; -} -/* end of file ADFISL2.c */ -/* file ADFLIN2.c */ -/*********************************************************************** -ADFLINK ADF_Link: -***********************************************************************/ -void FNAME(adflin2,ADFLIN2)( - const Fdouble *PID, - const Fchar name, - const Fchar file, - const Fchar name_in_file, - const Fint *name_length, - const Fint *file_length, - const Fint *nfile_length, - Fdouble *ID, - Fint *error_return ) -{ -char c_name[ ADF_FILENAME_LENGTH + 1 ], - c_file[ ADF_FILENAME_LENGTH + 1 ], - c_nfile[ ADF_MAX_LINK_DATA_SIZE + 1 ] ; - -ADFI_string_2_C_string( F2CP(name), - MIN(ADF_FILENAME_LENGTH, *name_length), - c_name, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_string_2_C_string( F2CP(file), - MIN(ADF_FILENAME_LENGTH, *file_length), - c_file, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_string_2_C_string( F2CP(name_in_file), - MIN(ADF_MAX_LINK_DATA_SIZE, *nfile_length), - c_nfile, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADF_Link( *PID, c_name, c_file, c_nfile, ID, error_return ) ; -} -/* end of file ADFLIN2.c */ -/* file ADFLVE2.c */ -/*********************************************************************** -ADFLVER ADF_Library_Version: -***********************************************************************/ -void FNAME(adflve2,ADFLVE2)( - Fchar version, - const Fint *version_length, - Fint *error_return ) -{ -ADF_Library_Version( F2CP(version), error_return ) ; -ADFI_blank_fill_string ( F2CP(version), *version_length ); -} -/* end of file ADFLVE2.c */ -/* file ADFMOV2.c */ -/*********************************************************************** -ADFMOVE ADF_Move_Child: -***********************************************************************/ -void FNAME(adfmov2,ADFMOV2)( - const Fdouble *PID, - const Fdouble *ID, - const Fdouble *NPID, - Fint *error_return ) -{ -ADF_Move_Child( *PID, *ID, *NPID, error_return ) ; -} -/* end of file ADFMOV2.c */ -/* file ADFNCL2.c */ -/*********************************************************************** -ADFNCLD ADF_Number_of_Children: -***********************************************************************/ -void FNAME(adfncl2,ADFNCL2)( - const Fdouble *ID, - Fint *num_children, - Fint *error_return ) -{ -ADF_Number_of_Children( *ID, num_children, error_return ) ; -} -/* end of file ADFNCL2.c */ -/* file ADFPDI2.c */ -/*********************************************************************** -ADFPDIM ADF_Put_Dimension_Information: -***********************************************************************/ -void FNAME(adfpdi2,ADFPDI2)( - const Fdouble *ID, - const Fchar data_type, - const Fint *data_type_length, - const Fint *dims, - const Fint dim_vals[], - Fint *error_return ) -{ -char c_data_type[ ADF_DATA_TYPE_LENGTH + 1 ] ; - -/* CMLU */ -int i; -for (i=0;i= 0 ) { -/** expecting character data type **/ - - ADF_Read_All_Data( *ID, F2CP(data), error_return ) ; - } - else { -/** expecting non-character data type **/ - - ADF_Read_All_Data( *ID, data.c_pointer, (int *)data.fcd_len ) ; - } - -#else - - ADF_Read_All_Data( *ID, F2CP(data), error_return ) ; - -#endif -} -/* end of file ADFRALL.c */ -/* file ADFRBLK.c */ -/*********************************************************************** -ADFRBLK ADF_Read_Block_Data: - Read block of data from a Node. Reads a block of the node's data and - returns it into a contiguous memory space. - - input: real*8 ID The ID of the node to use. - input: const int b_start The starting point in block in token space - input: const int b_end The ending point in block in token space - output: character *(*) data The start of the data in memory. - output: integer error_return Error flag. -***********************************************************************/ -void FNAME(adfrblk,ADFRBLK)( - const Fdouble *ID, - const Fint *b_start, - const Fint *b_end, - Fchar data, - Fint *error_return ) -{ - -#if defined(cray) && defined(_ADDR64) - -int local_error ; -char data_type[ ADF_DATA_TYPE_LENGTH + 1 ] ; -char errmsg[ ADF_MAX_ERROR_STR_LENGTH + 1 ] ; - -/** see ADFWALL() for more details **/ - - ADF_Get_Data_Type( *ID, data_type, &local_error ) ; - if( local_error != NO_ERROR ) { - ADF_Error_Message( local_error, errmsg ) ; - fprintf(stderr,"%s\n", errmsg ) ; - fprintf(stderr,"Unrecoverable ADF error. ADFRBLK\n" ) ; - fprintf(stderr,"Cannot determine data type, so cannot determine function\n" ) ; - fprintf(stderr,"argument list (character arrays are different than other\n" ) ; - fprintf(stderr,"types in this environemnt), so cannot set error_return.\n" ) ; - abort () ; - } /* end if */ - - if ( ADFI_stridx_c( data_type, "C1" ) >= 0 ) { -/** expecting character data type **/ - - ADF_Read_Block_Data( *ID, (long) *b_start, (long) *b_end, - F2CP(data), error_return ) ; - } - else { -/** expecting non-character data type **/ - - ADF_Read_Block_Data( *ID, (long) *b_start, (long) *b_end, - data.c_pointer, (int *)data.fcd_len ) ; - } - -#else - - ADF_Read_Block_Data( *ID, (long) *b_start, (long) *b_end, - F2CP(data), error_return ) ; - -#endif -} -/* end of file ADFRBLK.c */ -/* file ADFREA2.c */ -/* end of file ADFREA2.c */ -/* file ADFREAD.c */ -/*********************************************************************** -ADFREAD ADF_Read_Data: - - A 1-based system is used with all index values (the first element has - an index of 1, not 0). - R1: Read data from a node, with partial capabilities. The partial - capabilities are both in the node's data and also in memory. - Vectors of integers are used to indicate the data to be accessed - from the node, and another set of integer vectors is used to - describe the memory location for the data. - Note: If the data-type of the node is a compound data-type ("I4[3],R8") - for example, the partial capabilities will access one or more of - these 20-byte data entities. You cannot access a subset of an - occurrence of the data-type. - - f77: ADFREAD( ID, sstart[], send[], sstrid[], mnumd, - mdims[], mstart[], mend[], mstrid[], data, ierr ) - input: real*8 ID The ID of the node to use. - input: integer sstart(12) The starting dimension values to use - in the database (node). - input: integer send(12) The ending dimension values to use in - the database (node). - input: integer sstrid(12) The stride values to use in the - database (node). - input: integer mnumd The number of dimensions to use in memory. - input: integer mdims(mnumd) The dimensionality to use in memory. - input: integer mstart(mnumd) The starting dimension values - to use in memory. - input: integer mend(mnumd) The ending dimension values to - use in memory. - input: integer mstrid(mnumd) The stride values to use - in memory. - output: character*(*) data The start of the data in memory. - output: integer ierr - -***********************************************************************/ -void FNAME(adfread,ADFREAD)( - const Fdouble *ID, - const Fint s_start[], - const Fint s_end[], - const Fint s_stride[], - const Fint *m_num_dims, - const Fint m_dims[], - const Fint m_start[], - const Fint m_end[], - const Fint m_stride[], - Fchar data, - Fint *error_return ) -{ - -#if defined(cray) && defined(_ADDR64) - -int local_error ; -char data_type[ ADF_DATA_TYPE_LENGTH + 1 ] ; -char errmsg[ ADF_MAX_ERROR_STR_LENGTH + 1 ] ; - -/** see ADFWALL() for more details **/ - - ADF_Get_Data_Type( *ID, data_type, &local_error ) ; - if( local_error != NO_ERROR ) { - ADF_Error_Message( local_error, errmsg ) ; - fprintf(stderr,"%s\n", errmsg ) ; - fprintf(stderr,"Unrecoverable ADF error. ADFREAD\n" ) ; - fprintf(stderr,"Cannot determine data type, so cannot determine function\n" ) ; - fprintf(stderr,"argument list (character arrays are different than other\n" ) ; - fprintf(stderr,"types in this environemnt), so cannot set error_return.\n" ) ; - abort () ; - } /* end if */ - - if ( ADFI_stridx_c( data_type, "C1" ) >= 0 ) { -/** expecting character data type **/ - - ADF_Read_Data( *ID, s_start, s_end, s_stride, *m_num_dims, m_dims, - m_start, m_end, m_stride, F2CP(data), error_return ) ; - } - else { -/** expecting non-character data type **/ - - ADF_Read_Data( *ID, s_start, s_end, s_stride, *m_num_dims, m_dims, - m_start, m_end, m_stride, - data.c_pointer, (int *)data.fcd_len ) ; - } - -#else - - ADF_Read_Data( *ID, s_start, s_end, s_stride, *m_num_dims, m_dims, - m_start, m_end, m_stride, F2CP(data), error_return ) ; - -#endif -} -/* end of file ADFREAD.c */ -/* file ADFSES2.c */ -/*********************************************************************** -ADFSES ADF_Set_Error_State: -***********************************************************************/ -void FNAME(adfses2,ADFSES2)( - const Fint *error_state, - Fint *error_return ) -{ -ADF_Set_Error_State( *error_state, error_return ) ; -} -/* end of file ADFSES2.c */ -/* file ADFSLB2.c */ -/*********************************************************************** -ADFSLB ADF_Set_Label: -***********************************************************************/ -void FNAME(adfslb2,ADFSLB2)( - const Fdouble *ID, - const Fchar label, - const Fint *label_length, - Fint *error_return ) -{ -char c_label[ ADF_LABEL_LENGTH + 1 ] ; - -ADFI_string_2_C_string( F2CP(label), - MIN(ADF_LABEL_LENGTH, *label_length), - c_label, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADF_Set_Label( *ID, c_label, error_return ) ; -} -/* end of file ADFSLB2.c */ -/* file ADFWAL2.c */ -/* end of file ADFWAL2.c */ -/* file ADFWALL.c */ -/*********************************************************************** -ADFWALL ADF_Write_All_Data: - Write all data to a Node. Writes all the node's data from a - contiguous memory space. - - input: real*8 ID The node's id. - input: character *(*) data The start of data in memory. - output: integer error_return Error flag. -***********************************************************************/ -void FNAME(adfwall,ADFWALL)( - const Fdouble *ID, - const Fchar data, - Fint *error_return ) -{ - -#if defined(cray) && defined(_ADDR64) - -int local_error ; -char data_type[ ADF_DATA_TYPE_LENGTH + 1 ] ; -char errmsg[ ADF_MAX_ERROR_STR_LENGTH + 1 ] ; - -/** On Crays with 64 bit addresses (like Tritons), Fortran - character arrays occupy two 64 bit words on argument stacks - (see ). Other data (INTEGER, REAL, etc) occupy one word. - To accommodate both situations with one function, some tricks - need to be employed... **/ - -/** First, find the data type that ADF is expecting and assume the - function is being called with that kind of argument. This - function is defined with character data in mind and deviates - from that if necessary. **/ - - ADF_Get_Data_Type( *ID, data_type, &local_error ) ; - if( local_error != NO_ERROR ) { - ADF_Error_Message( local_error, errmsg ) ; - fprintf(stderr,"%s\n", errmsg ) ; - fprintf(stderr,"Unrecoverable ADF error. ADFWALL\n" ) ; - fprintf(stderr,"Cannot determine data type, so cannot determine function\n" ) ; - fprintf(stderr,"argument list (character arrays are different than other\n" ) ; - fprintf(stderr,"types in this environemnt), so cannot set error_return.\n" ) ; - abort () ; - } /* end if */ - - if ( ADFI_stridx_c( data_type, "C1" ) >= 0 ) { -/** expecting character data type **/ - - ADF_Write_All_Data( *ID, F2CP(data), error_return ) ; - } - else { - -/** expecting data type other than character - the stack is not as - long as is with character data and so "error_return" does not - correspond to anything valid. Since "data" is declared Fchar but - the actual argument is not, the second half of "data" contains - the error flag argument (the stack is assumed to be contiguous). **/ - - ADF_Write_All_Data( *ID, data.c_pointer, (int *)data.fcd_len ) ; - } - -#else - -/** In other CRAY environments the declared length is encoded in - unused portions of pointers and the F2CP macro handles its - conversion. - In other environments, the character array declared length - mystery argument is assumed to be on the end of the stack and - is ignored here (F2CP macro does nothing). **/ - - ADF_Write_All_Data( *ID, F2CP(data), error_return ) ; - -#endif -} -/* end of file ADFWALL.c */ -/* file ADFWBLK.c */ -/*********************************************************************** -ADFWBLK ADF_Write_Block_Data: - Write block of data from a Node. Writes a block of the node's data and - returns it into a contiguous memory space. - - input: real*8 ID The ID of the node to use. - input: const int b_start The starting point in block in token space - input: const int b_end The ending point in block in token space - output: character *(*) data The start of the data in memory. - output: integer error_return Error flag. -***********************************************************************/ -void FNAME(adfwblk,ADFWBLK)( - const Fdouble *ID, - const Fint *b_start, - const Fint *b_end, - Fchar data, - Fint *error_return ) -{ - -#if defined(cray) && defined(_ADDR64) - -int local_error ; -char data_type[ ADF_DATA_TYPE_LENGTH + 1 ] ; -char errmsg[ ADF_MAX_ERROR_STR_LENGTH + 1 ] ; - -/** see ADFWALL() for more details **/ - - ADF_Get_Data_Type( *ID, data_type, &local_error ) ; - if( local_error != NO_ERROR ) { - ADF_Error_Message( local_error, errmsg ) ; - fprintf(stderr,"%s\n", errmsg ) ; - fprintf(stderr,"Unrecoverable ADF error. ADFWBLK\n" ) ; - fprintf(stderr,"Cannot determine data type, so cannot determine function\n" ) ; - fprintf(stderr,"argument list (character arrays are different than other\n" ) ; - fprintf(stderr,"types in this environemnt), so cannot set error_return.\n" ) ; - abort () ; - } /* end if */ - - if ( ADFI_stridx_c( data_type, "C1" ) >= 0 ) { -/** expecting character data type **/ - - ADF_Write_Block_Data( *ID, (long) *b_start, (long) *b_end, - F2CP(data), error_return ) ; - } - else { -/** expecting non-character data type **/ - - ADF_Write_Block_Data( *ID, (long) *b_start, (long) *b_end, - data.c_pointer, (int *)data.fcd_len ) ; - } - -#else - - ADF_Write_Block_Data( *ID, (long) *b_start, (long) *b_end, - F2CP(data), error_return ) ; - -#endif -} -/* end of file ADFWBLK.c */ -/* file ADFWRI2.c */ -/* end of file ADFWRI2.c */ -/* file ADFWRIT.c */ -/*********************************************************************** -ADFWRIT ADF_Write_Data: - Write data to a Node, with partial capabilities. - See ADF_Read_Data for description. - - f77: ADFWRIT( ID, sstart[], send[], sstrid[], mnumd, - mdims[], mstart[], mend[], mstrid[], data, ierr ) - input: real*8 ID The ID of the node to use. - input: integer sstart(12) The starting dimension values to use - in the database (node). - input: integer send(12) The ending dimension values to use in - the database (node). - input: integer sstrid(12) The stride values to use in the - database (node). - input: integer mnumd The number of dimensions to use in memory. - input: integer mdims(mnumd) The dimensionality to use in memory. - input: integer mstart(mnumd) The starting dimension values to use - in memory. - input: integer mend(mnumd) The ending dimension values to use in - memory. - input: integer mstrid(mnumd) The stride values to use in memory. - input: character*(*) data The start of the data in memory. - output: integer ierr - - -***********************************************************************/ -void FNAME(adfwrit,ADFWRIT)( - const Fdouble *ID, - const Fint s_start[], - const Fint s_end[], - const Fint s_stride[], - const Fint *m_num_dims, - const Fint m_dims[], - const Fint m_start[], - const Fint m_end[], - const Fint m_stride[], - const Fchar data, - Fint *error_return ) -{ - -#if defined(cray) && defined(_ADDR64) - -int local_error ; -char data_type[ ADF_DATA_TYPE_LENGTH + 1 ] ; -char errmsg[ ADF_MAX_ERROR_STR_LENGTH + 1 ] ; - -/** see ADFWALL() for more details **/ - - ADF_Get_Data_Type( *ID, data_type, &local_error ) ; - if( local_error != NO_ERROR ) { - ADF_Error_Message( local_error, errmsg ) ; - fprintf(stderr,"%s\n", errmsg ) ; - fprintf(stderr,"Unrecoverable ADF error. ADFWRIT\n" ) ; - fprintf(stderr,"Cannot determine data type, so cannot determine function\n" ) ; - fprintf(stderr,"argument list (character arrays are different than other\n" ) ; - fprintf(stderr,"types in this environemnt), so cannot set error_return.\n" ) ; - abort () ; - } /* end if */ - - if ( ADFI_stridx_c( data_type, "C1" ) >= 0 ) { -/** expecting character data type **/ - - ADF_Write_Data( *ID, s_start, s_end, s_stride, *m_num_dims, m_dims, - m_start, m_end, m_stride, F2CP(data), error_return ) ; - } - else { -/** expecting non-character data type **/ - - ADF_Write_Data( *ID, s_start, s_end, s_stride, *m_num_dims, m_dims, - m_start, m_end, m_stride, - data.c_pointer, (int *)data.fcd_len ) ; - } - -#else - ADF_Write_Data( *ID, s_start, s_end, s_stride, *m_num_dims, m_dims, - m_start, m_end, m_stride, F2CP(data), error_return ) ; - -#endif -} -/* end of file ADFWRIT.c */ -/* end of combine 2.0 */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_interface.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_interface.c deleted file mode 100644 index c97877bc62..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_interface.c +++ /dev/null @@ -1,4183 +0,0 @@ -/* ADF write performance on Linux 2.4 NFS is very bad, largely due to - the fact that ADF does a lot of fseeks. Writing the modification - time all the time increases the problem; about a 10 - 20% performance - can be achieved by only writing the mod time when the file is closed. */ -#ifndef LINUX_NFS_OPT -#define LINUX_NFS_OPT 1 -#endif - -/* created by combine 2.0 */ -/* file ADF_AAA_var.c */ -/* file ADF_AAA_var.c */ -/*** -File: ADF_interface.c - ---------------------------------------------------------------------- - BOEING - ---------------------------------------------------------------------- - Project: CGNS - Author: Tom Dickens 234-1024 tpd6908@yak.ca.boeing.com - Date: 3/2/1995 - Purpose: The code which implements the ADF-Core capabilities. - ---------------------------------------------------------------------- - ---------------------------------------------------------------------- - -***/ - -/*********************************************************************** - Library and Database "what" strings. -***********************************************************************/ -/** Change the major revision letter in the Library Version for changes - to the API (new public functions, changes to public header files, - changes to existings functions or their defined behavior) - and/or changes to the internal file format resulting in - incompatibilites with previous library versions. Change the - internal revision number for internal changes and bug fixes; - reset to zero for major revision letter changes. **/ - -/** With the original ADF library, there is no binary data for at least - the first 560 bytes, which causes a lot of programs - (mailers, WinZip) to think that the file is text and try to do - a \n -> \n\r conversion. Since this string is only used for the - 'what' command, I am deciding that we don't need this functionality - and am putting binary characters here. Specifically, I am putting - control characters, because while some programs (Evolution/gnome-vfs) - look for unprintable characters, some look for a ratio (Mozilla). **/ - -static char ADF_L_identification[] = "@(#)ADF Library Version E01>\001\002\003\004"; - /* 01234567890123456789012345678901 = 32 */ - -/** Change version database version number every time the library - version changes according to the following philosophy. - -The format: - - AXXxxx - -where: - - A Major revision number. Major internal structure changes. - This number is not expected to change very often if at all - because backward compatibility is only available by explicit - policy decision. - - One alphabetic character. - Range of values: A-Za-z - In unlikely event of reaching z, then can use any other - unused printable ASCII character except blank or symbols - used by "what" command: @, (, #, ), ~, >, \. - - XX Minor revision number. New features and minor changes and - bug fixes. Files are backward but NOT forward compatible. - - Two digit hexadecimal number (uppercase letters). - Range of values: 00 - FF - Reset to 00 with changes in major revision number. - - xxx Incremental number. Incremented with every new version of - library (even if no changes are made to file format). - Files are forward AND backward compatible. - - Three digit hexadecimal number (lowercase letters) - Range of values: 000 to fff - Does not reset. - -Definitions: - - forward compatible Older versions of libraries can read and write - to files created by newer versions of libraries. - - backward compatible Newer versions of libraries can read and write - to files created by older versions of libraries. -**/ - - /* AXXxxx */ -static char ADF_D_identification[] = "@(#)ADF Database>\001\002\003\004\005\006\007\010A02011>"; - /* 01234567890123456789012345678901 = 32 */ - -/*********************************************************************** - Includes -***********************************************************************/ -#ifndef MAKEDEPEND -#include -#include -#include -#if !defined(_WIN32) || (defined(_WIN32) && defined(__NUTC__)) -#include -#else -#include -#endif -#include -#include -#endif - -#include "ADF.h" -#include "ADF_internals.h" -/* This was moved from ADF_internals.h since they are only used here - and leaving them here gives warning messages when the other .c files - are compiled. WRO 2005-Jan-11 */ -static char data_chunk_start_tag[] = "DaTa" ; - -#if defined(_WIN32) && !defined(__NUTC__) -#ifndef MAKEDEPEND -#include -#endif -#ifndef F_OK -#define R_OK 004 /* Test for Read permission */ -#define W_OK 002 /* Test for Write permission */ -#define X_OK 001 /* Test for eXecute permission */ -#define F_OK 000 /* Test for existence of File */ -#endif -#endif - - -/*********************************************************************** - Error strings - These strings must be kept in sync with the error defines in ADF.h. -***********************************************************************/ -const char *ADF_error_string[] = { - "ADF -1: No Error.", - "ADF 1: Integer number is less than given minimum value.", - "ADF 2: Integer number is greater than given maximum value.", - "ADF 3: String length of zero or blank string detected.", - "ADF 4: String length longer than maximum allowable length.", - "ADF 5: String is not an ASCII-HEX string.", - "ADF 6: Too many ADF files opened.", - "ADF 7: ADF file status was not recognized.", - "ADF 8: ADF file-open error.", - "ADF 9: ADF file not currently opened.", - "ADF 10: ADF file index out of legal range.", - "ADF 11: Block/offset out of legal range.", - "ADF 12: A string pointer is NULL.", - "ADF 13: FSEEK error.", - "ADF 14: FWRITE error.", - "ADF 15: FREAD error.", - "ADF 16: Internal error: Memory boundary tag bad.", - "ADF 17: Internal error: Disk boundary tag bad.", - "ADF 18: File Open Error: NEW - File already exists.", - "ADF 19: ADF file format was not recognized.", - "ADF 20: Attempt to free the RootNode disk information.", - "ADF 21: Attempt to free the FreeChunkTable disk information.", - "ADF 22: File Open Error: OLD - File does not exist.", - "ADF 23: Entered area of Unimplemented Code...", - "ADF 24: Sub-Node.entries is bad.", - "ADF 25: Memory allocation failed.", - "ADF 26: Duplicate child name under a parent node.", - "ADF 27: Node has no dimensions.", - "ADF 28: Node's number-of-dimensions is not in legal range.", - "ADF 29: Specified child is NOT a child of the specified parent.", - "ADF 30: Data-Type is too long.", - "ADF 31: Invalid Data-Type.", - "ADF 32: A pointer is NULL.", - "ADF 33: Node has no data associated with it.", - "ADF 34: Error zeroing out memory.", - "ADF 35: Requested data exceeds actual data available.", - "ADF 36: Bad end value.", - "ADF 37: Bad stride value.", - "ADF 38: Minimum values is greater than the maximum value.", - "ADF 39: The format of this machine does not match a known signature.", - "ADF 40: Cannot convert to or from an unknown Native format.", - "ADF 41: The two conversion formats are equal, no conversion done.", - "ADF 42: The data format is not support on a particular machine.", - "ADF 43: File Close error.", - "ADF 44: Numeric overflow/underflow in data conversion.", - "ADF 45: Bad start value.", - "ADF 46: A value of zero is not allowable.", - "ADF 47: Bad dimension value.", - "ADF 48: Error state must be either a 0 (zero) or a 1 (one).", - "ADF 49: Dimensional specifications for disk and memory are unequal.", - "ADF 50: Too many link level used. May be caused by a recursive link.", - "ADF 51: The node is not a link. It was expected to be a link.", - "ADF 52: The linked-to node does not exist.", - "ADF 53: The ADF file of a linked-node is not accessable.", - "ADF 54: A node-id of 0.0 is not valid.", - "ADF 55: Incomplete Data when reading multiple data blocks.", - "ADF 56: Node name contains invalid characters.", - "ADF 57: ADF file version incompatible with this library version.", - "ADF 58: Nodes are not from the same file.", - "ADF 59: Priority Stack Error.", - "ADF 60: Machine format and file format are incompatable.", - "ADF 61: FFLUSH error", - "ADF 62: The node ID pointer is NULL.", - "ADF x: Last error mesage" - } ; - -/*********************************************************************** - Global Variables: -***********************************************************************/ -static int ADF_abort_on_error = FALSE ; -static char link_separator[MAXIMUM_FILES][2] ; - -#define CHECK_ADF_ABORT( error_flag ) if( error_flag != NO_ERROR ) { \ - if( ADF_abort_on_error == TRUE ) { \ - ADF_Error_Message( error_flag, 0L );\ - ADFI_Abort( error_flag) ; } \ - else { return ; } } -/* Added to remove memory leaks in ADF_Get_Node_ID */ -#define CHECK_ADF_ABORT1( error_flag ) if( error_flag != NO_ERROR ) { \ - free (name_tmp); \ - if( ADF_abort_on_error == TRUE ) { \ - ADF_Error_Message( error_flag, 0L );\ - ADFI_Abort( error_flag) ; } \ - else { return ; } } - -/*********************************************************************** -Data Query: -Note: If the node is a link, the data query will occur on the linked-to -node, not the node which is the link. -Internal Implementation: A linked node will have a data-type of "LK", -dimension of 1 and a dimension value of the length of a data string -containing the file-path and the node-path within the file. The -routines ADF_Is_Link and ADF_Get_Link_Path allow viewing of a link's -data-type and data. -***********************************************************************/ -/*********************************************************************** -Data I/O: -A 1-based system is used with all index values (the first element has an -index of 1, not 0). -***********************************************************************/ -/* end of file ADF_AAA_var.c */ -/* end of file ADF_AAA_var.c */ -/* file ADF_Children_Names.c */ -/*********************************************************************** -ADF Children names: - -Get Children names of a Node. Return the name of children nodes -directly associated with a parent node. The names of the children -are NOT guaranteed to be returned in any particular order. If a new -child is added, it is NOT guaranteed to be returned as the last child. - -Null-terminated names will be written into the names array and thus -there needs to be room for the null character. As an example, -the array can be defined as: - - char names[IMAX_NUM][IMAX_NAME_LENGTH+1]; - -where IMAX_NUM and IMAX_NAME_LENGTH are defined by the using application -and correspond to this function's "imax_num" and "imax_name_len" parameters -respectively. "imax_name_len" is the maximum length of a name to be copied -into the names array. This value can be equal to ADF_NAME_LENGTH but does -not have to be. However, the name dimension of the array MUST be declared -to be "imax_name_len" + 1. The name will be returned truncated (but still -null-terminated) if the actual name is longer than "imax_name_len" and -if "imax_name_len" is less than ADF_NAME_LENGTH. - -Note that the names array parameter is declared as a single dimension -character array inside this function. Therefore, use a (char *) cast to -cast a two dimensional array argument. - -ADF_Children_Names( PID, istart, imax_num, imax_name_len, inum_ret, - names, error_return ) -input: const double PID The ID of the Node to use. -input: const int istart The Nth child's name to start with (first is 1). -input: const int imax_num Maximum number of names to return. -input: const int imax_name_len Maximum Length of a name to return. -output: int *inum_ret The number of names returned. -output: char *names The returned names (cast with (char *)). -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -NUMBER_LESS_THAN_MINIMUM -***********************************************************************/ -void ADF_Children_Names( - const double PID, - const int istart, - const int imax_num, - const int imax_name_len, - int *inum_ret, - char *names, - int *error_return ) -{ -int i ; -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -struct SUB_NODE_TABLE_ENTRY sub_node_table_entry ; -double LID ; - -*error_return = NO_ERROR ; - -if( inum_ret == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -*inum_ret = 0 ; - -if( names == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( (istart <=0) || (imax_num <= 0) || (imax_name_len <= 0) ) { - *error_return = NUMBER_LESS_THAN_MINIMUM ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -ADFI_chase_link( PID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Check for zero children, return if 0 **/ -if( node.num_sub_nodes == 0 ) { - return ; - } /* end if */ - - /** point to the first child wanted **/ -block_offset.block = node.sub_node_table.block ; -block_offset.offset = node.sub_node_table.offset + - (TAG_SIZE + DISK_POINTER_SIZE + - (ADF_NAME_LENGTH + DISK_POINTER_SIZE) * (istart-1)) ; - - /** Return the data for the requested children **/ -for( i=(istart-1); i< MIN(istart-1+imax_num, (int) node.num_sub_nodes); i++ ) { - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Read the sun-node entry table **/ - ADFI_read_sub_node_table_entry( file_index, &block_offset, - &sub_node_table_entry, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Convert the child's name from blank-filled into a C string **/ - ADFI_string_2_C_string( sub_node_table_entry.child_name, - MIN(imax_name_len,ADF_NAME_LENGTH), - &names[(i-(istart-1))*(imax_name_len+1)], - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Increment the disk-pointer and the number of names returned **/ - block_offset.offset += (ADF_NAME_LENGTH + DISK_POINTER_SIZE) ; - *inum_ret = *inum_ret + 1 ; - } /* end for */ -} /* end of ADF_Children_Names */ -/* end of file ADF_Children_Names.c */ -/* file ADF_Children_IDs.c */ -/*********************************************************************** -ADF Children IDs: - -Get Children node IDs of a Node. Return the node IDs of children nodes -directly associated with a parent node. - -ADF_Children_IDs( PID, istart, imax_num, inum_ret, IDs, error_return) -input: const double PID The ID of the Node to use. -input: const int istart The Nth child's name to start with (first is 1). -input: const int imax_num Maximum number of names to return. -output: int *inum_ret The number of names returned. -output: double *IDs The returned node IDs -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -NUMBER_LESS_THAN_MINIMUM -***********************************************************************/ -void ADF_Children_IDs ( - const double PID, - const int istart, - const int imax_num, - int *inum_ret, - double *IDs, - int *error_return ) -{ -int i ; -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -struct SUB_NODE_TABLE_ENTRY sub_node_table_entry ; -double LID ; - -*error_return = NO_ERROR ; - -if( inum_ret == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -*inum_ret = 0 ; - -if( IDs == NULL ) { - *error_return = NULL_NODEID_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( (istart <=0) || (imax_num <= 0) ) { - *error_return = NUMBER_LESS_THAN_MINIMUM ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -ADFI_chase_link( PID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Check for zero children, return if 0 **/ -if( node.num_sub_nodes == 0 ) { - return ; - } /* end if */ - - /** point to the first child wanted **/ -block_offset.block = node.sub_node_table.block ; -block_offset.offset = node.sub_node_table.offset + - (TAG_SIZE + DISK_POINTER_SIZE + - (ADF_NAME_LENGTH + DISK_POINTER_SIZE) * (istart-1)) ; - - /** Return the data for the requested children **/ -for( i=(istart-1); i< MIN(istart-1+imax_num, (int) node.num_sub_nodes); i++ ) { - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Read the sub-node entry table **/ - ADFI_read_sub_node_table_entry( file_index, &block_offset, - &sub_node_table_entry, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Get the ID from the sub-node table **/ - ADFI_file_block_offset_2_ID( file_index, - sub_node_table_entry.child_location.block, - sub_node_table_entry.child_location.offset, - &IDs[i-(istart-1)], error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Increment the disk-pointer and the number of IDs returned **/ - block_offset.offset += (ADF_NAME_LENGTH + DISK_POINTER_SIZE) ; - *inum_ret = *inum_ret + 1 ; - } /* end for */ -} /* end of ADF_Children_IDs */ -/* end of file ADF_Children_IDs.c */ -/* file ADF_Create.c */ -/*********************************************************************** -ADF Create: - -Create a Node. Create a new node (not a link-node) as a child of a -given parent. Default values in this new node are: - label=blank, - number of sub-nodes = 0, - data-type = "MT", - number of dimensions = 0, - data = NULL. - -ADF_Create( PID, name, ID, error_return ) -input: const double PID The ID of the parent node, to whom we - are creating a new child node. -input: const char *name The name of the new child. -output: double *ID The ID of the newly created node. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADF_Create( - const double PID, - const char *name, - double *ID, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER parent_block_offset, child_block_offset ; -struct DISK_POINTER sub_node_entry_location ; -struct NODE_HEADER parent_node, child_node ; -struct SUB_NODE_TABLE_ENTRY sub_node_entry ; -int i, name_length, name_start, found ; -double LID ; - -ADFI_check_string_length( name, ADF_NAME_LENGTH, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( ID == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( PID, &LID, &file_index, &parent_block_offset, - &parent_node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - - /** Initialize node header **/ -ADFI_fill_initial_node_header( &child_node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Skip any leading blanks in the name **/ -name_start = 0 ; -while( name[ name_start ] == ' ' ) { - name_start++ ; - } /* end while */ -name_length = strlen( &name[ name_start ] ) ; -if( name_length > ADF_NAME_LENGTH ) { - *error_return = STRING_LENGTH_TOO_BIG ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Check for uniqueness and legality of the name **/ -ADFI_check_4_child_name( file_index, &parent_block_offset, - &name[ name_start ], &found, &sub_node_entry_location, - &sub_node_entry, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -if( found == 1 ) { - *error_return = DUPLICATE_CHILD_NAME ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -for ( i=0; i < name_length; i++ ) { - if ( ! isprint ( name[ name_start + i ] ) || - name[ name_start + i ] == '/' ) { - *error_return = INVALID_NODE_NAME; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - } /* end for */ - - /** Assign the name to the new node **/ -strncpy( child_node.name, &name[ name_start ], name_length ) ; - - /** Allocate disk space for the new node **/ -ADFI_file_malloc( file_index, NODE_HEADER_SIZE, &child_block_offset, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Write out the new node header **/ -ADFI_write_node_header( file_index, &child_block_offset, &child_node, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** OK, new node is on disk. Now, update the list of - children for the parent... - **/ -ADFI_add_2_sub_node_table( file_index, &parent_block_offset, - &child_block_offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Return the ID of the new child **/ -ADFI_file_block_offset_2_ID( file_index, child_block_offset.block, - child_block_offset.offset, ID, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -#if !LINUX_NFS_OPT -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -#endif - -} /* end of ADF_Create */ -/* end of file ADF_Create.c */ -/* file ADF_Database_Close.c */ -/*********************************************************************** -ADF Database Close: - -Close an opened database. If the ADF database spans multiple files, -then all files used will also be closed. If an ADF file which is -linked to by this database is also opened through another -database, only the opened file stream associated with this database -will be closed. - -ADF_Database_Close( Root_ID, error_return ) -input: const double Root_ID Root-ID of the ADF database. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Database_Close( - const double Root_ID, - int *error_return ) -{ -unsigned int file_index ; -int tmp; -struct DISK_POINTER block_offset ; - -*error_return = NO_ERROR ; - - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( Root_ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Write modification time in ADF_Database_Close but nowhere else, - otherwise Linux NFS performance is even worse than normal. - (Note that if the file was opened read-only this will fail) */ -#if LINUX_NFS_OPT -ADFI_write_modification_date( file_index, &tmp ) ; -#endif - - /** Close the ADF file (which may close other sub-files) **/ -ADFI_close_file( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -} /* end of ADF_Database_Close */ -/* end of file ADF_Database_Close.c */ -/* file ADF_Database_Delete.c */ -/*********************************************************************** -ADF Database Delete: - -Delete an existing database. This will delete one or more ADF files -which are linked together under file top ADF file named "filename". - -ADF_Database_Delete( filename, error_return ) -input: char *filename Filename of the ADF database to delete. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Database_Delete( - const char *filename, - int *error_return ) -{ -ADFI_check_string_length( filename, ADF_FILENAME_LENGTH, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -fprintf(stderr,"Subroutine ADF_Database_Delete is not yet implemented...\n" ) ; -*error_return = UNIMPLEMENTED_CODE ; -CHECK_ADF_ABORT( *error_return ) ; -} /* end of ADF_Database_Delete */ -/* end of file ADF_Database_Delete.c */ -/* file ADF_Database_Garbage_Collection.c */ -/*********************************************************************** -ADF Database Garbage Collection: - -Garbage Collection. This capability will most likely be implemented -internally and will not be user-callable. - -ADF_Database_Garbage_Collection( ID, error_return ) -input: const double ID The ID of a node in the ADF file in which - to do garbage collection. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Database_Garbage_Collection( - const double ID, - int *error_return ) -{ -fprintf(stderr, -"Subroutine ADF_Database_Garbage_Collection is not yet implemented...\n" ) ; -*error_return = UNIMPLEMENTED_CODE ; -CHECK_ADF_ABORT( *error_return ) ; -} /* end of ADF_Database_Garbage_Collection */ - -/* end of file ADF_Database_Garbage_Collection.c */ -/* file ADF_Database_Get_Format.c */ -/*********************************************************************** -ADF Database Get Format: - -Get the data format used in an existing database. - -ADF_Database_Get_Format( Root_ID, format, error_return ) -input: const double Root_ID The root_ID of the ADF file. -output: char *format See format for ADFDOPN. Maximum of 20 - characters returned. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Database_Get_Format( - const double Root_ID, - char *format, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct FILE_HEADER file_header ; - -if( format == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( Root_ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get node_header for the node **/ -ADFI_read_file_header( file_index, &file_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -#define EVAL_2_BYTES( C0, C1 ) (((C0)<<8)+((C1))) - -switch( EVAL_2_BYTES( file_header.numeric_format, file_header.os_size ) ) { - case EVAL_2_BYTES( 'B', 'L' ) : - strcpy( format, IEEE_BIG_32_FORMAT_STRING ) ; - - break ; - - case EVAL_2_BYTES( 'L', 'L' ) : - strcpy( format, IEEE_LITTLE_32_FORMAT_STRING ) ; - break ; - - case EVAL_2_BYTES( 'B', 'B' ) : - strcpy( format, IEEE_BIG_64_FORMAT_STRING ) ; - - break ; - - case EVAL_2_BYTES( 'L', 'B' ) : - strcpy( format, IEEE_LITTLE_64_FORMAT_STRING ) ; - break ; - - case EVAL_2_BYTES( 'C', 'B' ) : - strcpy( format, CRAY_FORMAT_STRING ) ; - break ; - - case EVAL_2_BYTES( 'N', 'L' ) : - case EVAL_2_BYTES( 'N', 'B' ) : - strcpy( format, NATIVE_FORMAT_STRING ) ; - break ; - - default: - *error_return = ADF_FILE_FORMAT_NOT_RECOGNIZED ; - return ; - - } /* end switch */ - -} /* end of ADF_Database_Get_Format */ -/* end of file ADF_Database_Get_Format.c */ -/* file ADF_Database_Open.c */ -/*********************************************************************** -ADF Database Open: - -Open a database. Open either a new or an existing ADF file. If links to -other ADF files are used, these additional file will be opened -automatically as required. - -ADF_Database_Open( filename, status, format, root_ID, error_return) -input: const char *filename Not used if status SCRATCH is used. - Filename must be a legal name and may include a relative or - absolute path. It must be directly usable by the C fopen() - system routine. - -input: const char *status_in Like FORTRAN OPEN() status. - Allowable values are: - READ_ONLY - File must exist. Writing NOT allowed. - OLD - File must exist. Reading and writing allowed. - NEW - File must not exist. - SCRATCH - New file. Filename is ignored. - UNKNOWN - OLD if file exists, else NEW is used. - -input: const char *format Specifies the numeric format for the - file. If blank or NULL, the machine's native format is - used. This field is only used when a file is created. - NATIVE - Determine the format on the machine. If the - native format is not one of the formats - supported, the created file cannot be used on - other machines. - IEEE_BIG - Use the IEEE big ENDIAN format. - IEEE_LITTLE - Use the IEEE little ENDIAN format. - CRAY - Use the native Cray format. - -output: double *root_ID Root-ID of the opened ADF database. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -ADF_FILE_STATUS_NOT_RECOGNIZED -REQUESTED_NEW_FILE_EXISTS -FILE_OPEN_ERROR -***********************************************************************/ -void ADF_Database_Open( - const char *filename, - const char *status_in, - const char *format, - double *Root_ID, - int *error_return ) -{ -int iret ; -int error_dummy ; -char machine_format, format_to_use, os_to_use ; -char *status ; -int formats_compare ; -unsigned int file_index ; -unsigned int file_minor_version, lib_minor_version ; -struct FILE_HEADER file_header ; -struct NODE_HEADER node_header ; -struct FREE_CHUNK_TABLE free_chunk_table ; - -file_header.tag0[0] = '\0' ; - -status = (char *)status_in ; -if( status == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( Root_ID == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** DO NOT Check filename for NULL here, it may NOT be used... **/ - -*error_return = NO_ERROR ; - - /** Get this machine's numeric format **/ - ADFI_figure_machine_format( format, &machine_format, &format_to_use, - &os_to_use, error_return ) ; - -if( ADFI_stridx_c( status, "SCRATCH" ) != 0 ) { - ADFI_check_string_length( filename, ADF_FILENAME_LENGTH, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -ADFI_check_string_length( status, ADF_STATUS_LENGTH, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Determine the requested STATUS **/ -if( ADFI_stridx_c( status, "UNKNOWN" ) == 0 ) { - /** Determine the assessability of the filename **/ - iret = access( filename, F_OK ) ; - if( iret != 0 ) /* File does not exist, set status to NEW */ - status = "NEW" ; - else - status = "OLD" ; - } /* end else if */ - -if( (ADFI_stridx_c( status, "READ_ONLY" ) == 0) || - (ADFI_stridx_c( status, "OLD" ) == 0) ) { - /** Determine the assessability of the filename **/ - iret = access( filename, F_OK ) ; - if( iret != 0 ) { /* File does not exist, this is BAD for OLD */ - *error_return = REQUESTED_OLD_FILE_NOT_FOUND ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** open the file **/ - ADFI_open_file( filename, status, -1, &file_index, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else if */ - -else if( (ADFI_stridx_c( status, "NEW" ) == 0) || - (ADFI_stridx_c( status, "SCRATCH" ) == 0) ) { - /** Determine the assessability of the filename **/ - if( ADFI_stridx_c( status, "NEW" ) == 0 ) { - iret = access( filename, F_OK ) ; - if( iret == 0 ) { /* File exists, this is BAD for NEW */ - *error_return = REQUESTED_NEW_FILE_EXISTS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - if( errno != ENOENT ) { - *error_return = FILE_OPEN_ERROR ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - } /* end if */ - - /** Compose the file header **/ - ADFI_fill_initial_file_header( format_to_use, os_to_use, - ADF_D_identification, - &file_header, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Open the new file **/ - ADFI_open_file( filename, status, -1, &file_index, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** write out the file header **/ - ADFI_write_file_header( file_index, &file_header, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Compose Initial root-node header **/ - ADFI_fill_initial_node_header( &node_header, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - strncpy( node_header.name, ROOT_NODE_NAME, strlen( ROOT_NODE_NAME )) ; - strncpy( node_header.label, ROOT_NODE_LABEL, strlen( ROOT_NODE_LABEL ) ) ; - - /** Write out the root-node header **/ - ADFI_write_node_header( file_index, &file_header.root_node, - &node_header, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Compose Initial Free-Chunk Table **/ - ADFI_fill_initial_free_chunk_table( &free_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write out Free-Chunk Table **/ - ADFI_write_free_chunk_table( file_index, &free_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else if */ - -else { - *error_return = ADF_FILE_STATUS_NOT_RECOGNIZED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Initilaize the link separator for the file **/ -strcpy ( link_separator[file_index], ">" ) ; - - /** Read the header of the ADF file **/ -if( file_header.tag0[0] == '\0' ) { - ADFI_read_file_header( file_index, &file_header, error_return ) ; - if ( *error_return != NO_ERROR ) goto Open_Error ; - - /** Check Database version numbers for compatibility **/ - if( file_header.what[25] != ADF_D_identification[25] ) { -/* Look at major revision letter: version in file must equal what - this library would write unless there is a policy decision to - support both versions. */ - - *error_return = INVALID_VERSION ; - if ( *error_return != NO_ERROR ) goto Open_Error ; - } /* end if */ - - if( file_header.what[28] == '>' ) - { -/* we have an old file created before this version numbering scheme - was instituted - probably will not work */ - *error_return = INVALID_VERSION ; - if ( *error_return != NO_ERROR ) goto Open_Error ; - } - else /* check version number for file format compatibility */ - { -/* Look at minor revision number: version in file must be less than - or equal to what this library would write. */ - - ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &file_header.what[26], - &file_minor_version, error_return) ; - if ( *error_return != NO_ERROR ) goto Open_Error ; - - ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &ADF_D_identification[26], - &lib_minor_version, error_return) ; - if ( *error_return != NO_ERROR ) goto Open_Error ; - if( file_minor_version > lib_minor_version ) { - *error_return = INVALID_VERSION ; - if ( *error_return != NO_ERROR ) goto Open_Error ; - } /* end if */ - - if( file_minor_version < lib_minor_version ) { - /** If a new feature is added which requires that the file version - be changed then it is done here. Care must be take not to - break forward compatibility by changing the file version. Thus - new features may not be available for older file versions. - For instance version A1 files cannot be upgraded to version - A2 and above since a change was made to how links were store - and the file version is used to decide how to treat links. **/ - if ( ADF_D_identification[25] == 'A' && file_minor_version > 1 ) { - ADFI_remember_version_update( file_index, ADF_D_identification, - error_return ) ; - - if ( *error_return != NO_ERROR ) goto Open_Error ; - } /* end if */ - - /** The link separator was changed from " " to ">" in order - to support blanks in filenames under Windows. This change - is for version A02 and higher **/ - if ( ADF_D_identification[25] == 'A' && file_minor_version < 2 ) { - strcpy ( link_separator[file_index], " " ) ; - } /* end if */ - - } /* end if */ - } /* end if */ - } /* end if */ - - /** get the root ID for the user **/ -ADFI_file_block_offset_2_ID( file_index, file_header.root_node.block, - file_header.root_node.offset, Root_ID, error_return ) ; -if ( *error_return != NO_ERROR ) goto Open_Error ; - - /** Remember the file's data format **/ -ADFI_remember_file_format( file_index, file_header.numeric_format, - file_header.os_size, error_return ) ; -if ( *error_return != NO_ERROR ) goto Open_Error ; - - /** check machine modes, if machine is native the file must be !! **/ -ADFI_file_and_machine_compare( file_index, NULL, &formats_compare, - error_return ) ; -if ( *error_return != NO_ERROR ) goto Open_Error ; - - return ; - - Open_Error: - /** Close the ADF file and free its index **/ -ADFI_close_file( file_index, &error_dummy ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Database_Open */ -/* end of file ADF_Database_Open.c */ -/* file ADF_Database_Set_Format.c */ -/*********************************************************************** -ADF Database Set Format: - -Set the data format used in an existing database. - Note: Use with extreme caution. Needed only - for data conversion utilities and NOT intended - for the general user!!! - -ADF_Database_Set_Format( Root_ID, format, error_return ) -input: const double Root_ID The root_ID if the ADF file. -input: const char *format See format for ADFDOPN. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Database_Set_Format( - const double Root_ID, - const char *format, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct FILE_HEADER file_header ; -char machine_format, format_to_use, os_to_use ; - -ADFI_check_string_length( format, ADF_FORMAT_LENGTH, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( Root_ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get node_header for the node **/ -ADFI_read_file_header( file_index, &file_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_figure_machine_format( format, &machine_format, &format_to_use, - &os_to_use, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -file_header.numeric_format = format_to_use ; -file_header.os_size = os_to_use ; - - /** Get modification date to be updated with the header **/ -ADFI_get_current_date ( file_header.modification_date ); - - /** Now write the disk header out... **/ -ADFI_write_file_header( file_index, &file_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_remember_file_format( file_index, format_to_use, os_to_use, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Database_Set_Format */ -/* end of file ADF_Database_Set_Format.c */ -/* file ADF_Database_Version.c */ -/*********************************************************************** -ADF Database Version: - -Get ADF File Version ID. This is the version number of the ADF library -routines which created an ADF database. Modified ADF databases -will take on the version ID of the current ADF library version if -it is higher than the version indicated in the file. - The format of the version ID is: "ADF Database Version 000.01" - -ADF_Database_Version( Root_ID, version, creation_date, modification_date, - error_return ) -input: const double Root_ID The ID of the root node in the ADF file. -output: char *version A 32-byte character string containing the - version ID. -output: char *creation_date A 32-byte character string containing the - creation date of the file. -output: char *modification_date A 32-byte character string containing the - last modification date of the file. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Database_Version( - const double Root_ID, - char *version, - char *creation_date, - char *modification_date, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct FILE_HEADER file_header ; - -if( (version == NULL) || (creation_date == NULL) || - (modification_date == NULL) ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( Root_ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get node_header for the node **/ -ADFI_read_file_header( file_index, &file_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -*error_return = NO_ERROR ; - /** Convert the "what" string into a C string **/ -ADFI_string_2_C_string( &file_header.what[4], strcspn ( file_header.what, ">" ) - 4, - version, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Convert the creation date string into a C string **/ -ADFI_string_2_C_string( file_header.creation_date, 28, - creation_date, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Convert the modification date string into a C string **/ -ADFI_string_2_C_string( file_header.modification_date, 28, - modification_date, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Database_Version */ -/* end of file ADF_Database_Version.c */ -/* file ADF_Delete.c */ -/*********************************************************************** -ADF Delete: - -Delete a Node. If the node is NOT a link, then the specified node and all -sub-nodes anywhere under it are also deleted. For a link, and also -for links farther down in the tree, the link-node will be deleted, -but the node which the link is linked to is not affected. When a -node is deleted, other link-nodes which point to it are left -dangling. For example, if N13 is deleted, then L1 and L2 point to a -non-existing node. This is OK until L1 and L2 are used. - -ADF_Delete( PID, ID, error_return ) -input: const double PID The ID of the node's parent. -input: const double ID The ID of the node to use. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Delete( - const double PID, - const double ID, - int *error_return ) -{ -int num_ids , i, link_path_length ; -double *ids ; -unsigned int file_index ; -struct DISK_POINTER parent ; -struct DISK_POINTER child ; -struct NODE_HEADER node_header ; - - /** Don't use ADFI_chase_link() - delete link nodes but NOT the - nodes they are linked too **/ - -ADFI_ID_2_file_block_offset( ID, &file_index, &child.block, &child.offset, - error_return ) ; - -CHECK_ADF_ABORT( *error_return ) ; - -ADF_Is_Link( ID, &link_path_length, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_read_node_header( file_index, &child, &node_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Delete node data **/ - -if( link_path_length > 0 ) { /** this node IS a link **/ - /** Delete the link path data for this node **/ - ADFI_delete_data( file_index, &node_header, error_return ) ; - } -else { /** this node is NOT a link **/ - - /** Recursively delete all sub-nodes (children) of this node **/ - ADFI_get_direct_children_ids( file_index, &child, &num_ids, &ids, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - for( i=0; i 0 ) { - free( ids ) ; - } /* end if */ - - /** Delete all data for this node **/ - - ADF_Put_Dimension_Information( ID, "MT", 0, (int *)0, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if-else */ - - - /** Disassociate node from parent **/ -ADFI_ID_2_file_block_offset( PID, &file_index, - &parent.block, &parent.offset, error_return ) ; - /* file_index should be same as before since parent and child - should be in the same file */ -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_delete_from_sub_node_table( file_index, &parent, &child, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Delete this node's sub node table **/ -if( node_header.entries_for_sub_nodes > 0 ) { - ADFI_delete_sub_node_table( file_index, &node_header.sub_node_table, - node_header.entries_for_sub_nodes, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Delete node header from disk **/ -ADFI_file_free( file_index, &child, 0, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -#if !LINUX_NFS_OPT -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -#endif - -} /* end of ADF_Delete */ -/* end of file ADF_Delete.c */ -/* file ADF_Error_Message.c */ -/*********************************************************************** -ADF Error message: - -Return Error Message. Given an error_return from an ADF routine, -get a textual description of the error. - -ADF_Error_Message( error_return, error_string ) -input: const int error_return An ADF-generated error code. -output: char *error_string An 80-byte description of the specified error. - If the number is NULL, then print out error message. -***********************************************************************/ -void ADF_Error_Message( - const int error_return_input, - char *error_string ) -{ -char err_msg_str[ADF_MAX_ERROR_STR_LENGTH+1] ; - - /** If return pointer is NULL, print message to stdout **/ -if( error_string == NULL ) { - ADF_Error_Message( error_return_input, err_msg_str ) ; - fprintf(stderr,"%s\n", err_msg_str ) ; - return ; - } /* end if */ - - /** NO_ERROR is NOT zero for pointer-assignment checking **/ -if( error_return_input == NO_ERROR ) { - strcpy( error_string, ADF_error_string[ 0 ] ) ; - } /* end if */ - /** Check range of error code **/ -else if( (error_return_input <= 0) || - ((unsigned)error_return_input >= sizeof( ADF_error_string )/sizeof(char *) - 1 ) ) { - sprintf( error_string, "ADF: Unrecognized error number %d.", - error_return_input ) ; - } /* end else if */ - /** Error-code good, copy it for the user **/ -else { - strcpy( error_string, ADF_error_string[error_return_input] ) ; - } /* end else */ -} /* end of ADF_Error_Message */ -/* end of file ADF_Error_Message.c */ -/* file ADF_Flush_to_Disk.c */ -/*********************************************************************** -ADF Flush to Disk: - -Flush data to disk. This routine is used force any modified information -to be flushed to the physical disk. This ensures that data will not -be lost if a program aborts. This control of when to flush all data -to disk is provided to the user rather than to flush the data every -time it is modified, which would result in reduced performance. - -ADF_Flush_to_Disk( ID, error_return ) -input: const double ID The ID of a node in the ADF file to flush. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Flush_to_Disk( - const double ID, - int *error_return ) -{ -double LID ; -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; - - ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - ADFI_fflush_file( file_index, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; -} /* end of ADF_Flush_to_Disk */ -/* end of file ADF_Flush_to_Disk.c */ -/* file ADF_Get_Data_Type.c */ -/*********************************************************************** -ADF Get Data Type: - -Get Data Type. Return the 32 character string in a node's data-type field. -In C, the name will be null terminated after the last non-blank character. -A maximum of 33 characters may be used (32 for the name plus 1 for the null). - -ADF_Get_Data_Type( ID, data_type, error_return ) -input: const double ID The ID of the node to use. -output: char *data_type The 32-character data-type of the node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Data_Type( - const double ID, - char *data_type, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -double LID ; - -if( data_type == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Copy the blank-filled data-type into a C string **/ -ADFI_string_2_C_string( node.data_type, ADF_DATA_TYPE_LENGTH, data_type, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Get_Data_Type */ -/* end of file ADF_Get_Data_Type.c */ -/* file ADF_Get_Dimension_Values.c */ -/*********************************************************************** -ADF Get Dimension Values: - -Get Dimension Values. Return the dimension values for a node. Values -will be in the range of 1 to 100,000. Values will only be returned -for the number of dimensions defined in the node. If the number -of dimensions for the node is zero, an error is returned. - -ADF_Get_Dimension_Values( ID, dim_vals, error_return ) -input: const double ID The ID of the node to use. -output: int dim_vals[] Array for returned dimension values. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Dimension_Values( - const double ID, - int dim_vals[], - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -int i ; -double LID ; - -if( dim_vals == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Check for zero dimensions **/ -if( node.number_of_dimensions == 0 ) { - *error_return = ZERO_DIMENSIONS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Check for too-large-of dimensions **/ -if( node.number_of_dimensions > ADF_MAX_DIMENSIONS ) { - *error_return = BAD_NUMBER_OF_DIMENSIONS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Copy the dimension information **/ -for( i=0; i<(int)node.number_of_dimensions; i++ ) - dim_vals[i] = node.dimension_values[i] ; - -} /* end of ADF_Get_Dimension_Values */ -/* end of file ADF_Get_Dimension_Values.c */ -/* file ADF_Get_Error_State.c */ -/*********************************************************************** -ADF Get Error State: - -Get Error State. Return the current error state. - -ADF_Get_Error_State( error_state, error_return ) -output: int *error_state Flag for ABORT on error (1) or return error - status (0). -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Error_State( - int *error_state, - int *error_return ) -{ -if( error_state == 0L ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -if( ADF_abort_on_error == TRUE ) - *error_state = 1 ; -else - *error_state = 0 ; - -} /* end of ADF_Get_Error_State */ -/* end of file ADF_Get_Error_State.c */ -/* file ADF_Get_Label.c */ -/*********************************************************************** -ADF Get Label: - -Return the 32 character string in a node's label field. - -ADF_Get_Label( ID, label, error_return ) -input: const double ID The ID of the node to use. -output: char *label The 32-character label of the node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Label( - const double ID, - char *label, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -double LID ; - -if( label == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Copy the blank-filled label type into a C string **/ -ADFI_string_2_C_string( node.label, ADF_LABEL_LENGTH, label, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Get_Label */ -/* end of file ADF_Get_Label.c */ -/* file ADF_Get_Link_Path.c */ -/*********************************************************************** -ADF Get Link path: - -Get path information from a link. If the node is a link-node, return -the path information. Else, return an error. If the link is in the same -file, then the filename returned is zero length. - -ADF_Get_Link_Path( ID, file, name_in_file, error_return ) -input: const double ID The ID of the node to use. -output: char *file The returned filename -output: char *name_in_file The returned name of node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Link_Path( - const double ID, - char *file, - char *name_in_file, - int *error_return ) -{ -unsigned int file_index ; -int file_bytes, machine_bytes, total_bytes ; -char file_format, machine_format ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node_header ; -struct TOKENIZED_DATA_TYPE tokenized_data_type[ 2 ] ; -char link_data[ADF_FILENAME_LENGTH + ADF_MAX_LINK_DATA_SIZE + 1 + 1] ; -size_t lenfilename ; - -if( file == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( name_in_file == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get node_header for the node **/ -ADFI_read_node_header( file_index, &block_offset, &node_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( (node_header.data_type[0] != 'L') || (node_header.data_type[1] != 'K')) { - *error_return = NODE_IS_NOT_A_LINK ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Get tokenized datatype **/ -ADFI_evaluate_datatype( file_index, node_header.data_type, - &file_bytes, &machine_bytes, tokenized_data_type, - &file_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -total_bytes = file_bytes * node_header.dimension_values[0] ; -ADFI_read_data_chunk( file_index, &node_header.data_chunks, - tokenized_data_type, file_bytes, total_bytes, - 0, total_bytes, link_data, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /* NULL terminate the string */ -link_data[ node_header.dimension_values[0] ] = '\0' ; - -file[0] = '\0' ; -name_in_file[0] = '\0' ; - - /** look for file/link delimiter **/ -lenfilename = strcspn ( link_data, link_separator[file_index] ) ; - -if ( lenfilename == 0 ) /** no filename **/ -{ - strcpy( name_in_file, &link_data[1] ); -} -else if ( lenfilename > 0 && lenfilename == strlen( link_data ) ) -{ - strcpy( file, link_data) ; /** no link ? **/ -} -else -{ - strncpy( file, link_data, lenfilename) ; - file[lenfilename] = '\0'; - strcpy( name_in_file, &link_data[lenfilename+1] ); -} /* end if */ - -} /* end of ADF_Get_Link_Path */ -/* end of file ADF_Get_Link_Path.c */ -/* file ADF_Get_Name.c */ -/*********************************************************************** -ADF get name: - -Get Name of a Node. Given a node's ID, return the 32 character name of -that node. - -ADF_Get_Name( ID, name, error_return ) -input: const double ID The ID of the node to use. -output: char *name The simple name of the node (no path info). -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Name( - const double ID, - char *name, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; - -if( name == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get node_header for the node **/ -ADFI_read_node_header( file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Copy the blank-filled name into a C string **/ -ADFI_string_2_C_string( node.name, ADF_NAME_LENGTH, name, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Get_Name */ -/* end of file ADF_Get_Name.c */ -/* file ADF_Get_Node_ID.c */ -/*********************************************************************** -ADF get Node ID: - -Get Unique-Identifier of a Node. Given a parent node ID and a name of -a child node, this routine returns the ID of the child. If the child -node is a link, the ID of the link node is returned (not the ID of the -linked-to node) - otherwise there would be no way to obtain the ID -of a link node. - -The child name may be a simple name or a compound path name. -If the name is a compound path name and it begins with a '/', -then the parent node ID may be any valid ID in the same database -as the first node in the path. If the name is only "/" and the -parent ID is any valid ID in the database, the root ID is returned. -If the name is a compound path name and does not begin with a '/', -then the parent node ID is the ID of the parent of the first node -in the path. If the path name contains a link node (except for -the ending leaf node), then the link is followed. - - -ADF_Get_Node_ID( PID, name, ID, error_return ) -input: const double PID The ID of name's parent. -input: const char *name The name of the node. Compound - names including path information use a slash "/" notation between - node names. If a leading slash is used, then PID can be any - valid node ID in the ADF database of the first name in the path. - -output: double *ID The ID of the named node. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADF_Get_Node_ID( - const double PID, - const char *name, - double *ID, - int *error_return ) -{ -double LID ; -int found ; -int name_length ; -unsigned int file_index ; -struct DISK_POINTER parent_block_offset, sub_node_entry_location ; -struct SUB_NODE_TABLE_ENTRY sub_node_entry ; -struct NODE_HEADER node_header ; -char *name_tmp, *name_ptr, *name_pos ; - -if( name == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -name_length = strlen( name ) ; -if( name_length == 0 ) { - *error_return = STRING_LENGTH_ZERO ; - return ; - } /* end if */ - -if( ID == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -*ID = PID ; /** initialize the ID variable to use in intermediate steps **/ - -if( name[0] == '/' ) { /** start at the root node **/ - /** according to user documentation, PID can be any valid node - in the database, but we need to use it to get the root ID - in order to start at the top **/ - - ADF_Get_Root_ID( PID, ID, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** This is the root-node, return the Root-ID **/ - if( name[ 1 ] == '\0' ) { - return ; /** NOT an error, just done and need to get out **/ - } /* end if */ - } /* end if */ - -name_tmp = (char *) malloc( (name_length + 1) * sizeof( char ) ) ; -if( name_tmp == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -strcpy( name_tmp, name ) ; - - /** start search for tokens (names separated by '/') **/ -name_pos = name_tmp ; -name_ptr = ADFI_strtok( name_tmp, &name_pos, "/" ) ; -if( name_ptr == NULL ) { /** this should never happen but check anyway **/ - *error_return = INVALID_NODE_NAME ; - CHECK_ADF_ABORT1( *error_return ) ; - } /* end if */ - - /** Get file-index, etc. to start. Note: Parent ID may be a link **/ -ADFI_chase_link( *ID, &LID, &file_index, - &parent_block_offset, &node_header, error_return ) ; -CHECK_ADF_ABORT1( *error_return ) ; -*ID = LID ; - - /** Track through the possible compound name string **/ -while( name_ptr ) { - - /** Find this child under the current parent **/ - ADFI_check_4_child_name( file_index, &parent_block_offset, name_ptr, &found, - &sub_node_entry_location, &sub_node_entry, error_return ) ; - CHECK_ADF_ABORT1( *error_return ) ; - - if( found == 0 ) { /** Child NOT found **/ - *error_return = CHILD_NOT_OF_GIVEN_PARENT ; - CHECK_ADF_ABORT1( *error_return ) ; - } /* end if */ - - /** create the child ID **/ - ADFI_file_block_offset_2_ID( file_index, - sub_node_entry.child_location.block, - sub_node_entry.child_location.offset, ID, error_return ) ; - - /** Get the next node-name token (NULL if no more). This is needed - for the while-loop check and normally would be done at the - end of the loop, but it is useful in the next step to see if - there are any more branches in the path. **/ - name_ptr = ADFI_strtok( name_tmp, &name_pos, "/" ) ; - - /** If this node is the last in the path it may be a link, but - there needs to be a mechanism by which a link's ID can - be determined and so we cannot follow the link at this time. **/ - if( name_ptr != NULL ) { - /* Make sure we have a real ID so we can continue the search */ - ADFI_chase_link( *ID, &LID, &file_index, &parent_block_offset, - &node_header, error_return ) ; - CHECK_ADF_ABORT1( *error_return ) ; - *ID = LID ; - - /** This child now becomes the parent. Do it again... **/ - ADFI_ID_2_file_block_offset( *ID, &file_index, - &parent_block_offset.block, - &parent_block_offset.offset, - error_return ) ; - CHECK_ADF_ABORT1( *error_return ) ; - } /* end if */ - - } /* end while */ - -free( name_tmp ) ; - -} /* end of ADF_Get_Node_ID */ -/* end of file ADF_Get_Node_ID.c */ -/* file ADF_Get_Number_of_Dimensions.c */ -/*********************************************************************** -ADF Get Number of Dimensions: - -Get Number of Dimensions. Return the number of data dimensions -used in a node. Valid values are from 0 to 12. - -ADF_Get_Number_of_Dimensions( ID, num_dims, error_return) -input: const double ID The ID of the node to use. -output: int *num_dims The returned number of dimensions. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Number_of_Dimensions( - const double ID, - int *num_dims, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -double LID ; - -if( num_dims == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, - &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Return the number of dimensions **/ -*num_dims = node.number_of_dimensions ; - -} /* end of ADF_Get_Number_of_Dimensions */ -/* end of file ADF_Get_Number_of_Dimensions.c */ -/* file ADF_Get_Root_ID.c */ -/*********************************************************************** -ADF_Get_Root_ID: - Get root-ID for an ADF system from any ID in the system. - -input: const double ID The ID of the node to use. -output: *double Root_ID The returned ID of the root node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Root_ID( - const double ID, - double *Root_ID, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct FILE_HEADER file_header ; - -if( Root_ID == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Get the file ID **/ -ADFI_ID_2_file_block_offset( ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Use the file header to find the root ID **/ -ADFI_read_file_header( file_index, &file_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Format the root ID **/ -ADFI_file_block_offset_2_ID( file_index, file_header.root_node.block, - file_header.root_node.offset, Root_ID, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Get_Root_ID */ -/* end of file ADF_Get_Root_ID.c */ -/* file ADF_Is_Link.c */ -/*********************************************************************** -ADF Is Link: - -Test if a Node is a link. If the actual data-type of the node is "LK" -(created with ADF_Link), return the link path length. Otherwise, -return 0. - -ADF_Is_Link( ID, link_path_length, error_return ) -input: const double ID The ID of the node to use. -output: int *link_path_length 0 if the node is NOT a link. If the - node is a link, the length of the path string is returned. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Is_Link( - const double ID, - int *link_path_length, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node_header ; - -if( link_path_length == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get node_header for the node **/ -ADFI_read_node_header( file_index, &block_offset, &node_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( (node_header.data_type[0] == 'L') && (node_header.data_type[1] == 'K')) - *link_path_length = node_header.dimension_values[0] ; -else - *link_path_length = 0 ; - -} /* end of ADF_Is_Link */ -/* end of file ADF_Is_Link.c */ -/* file ADF_Library_Version.c */ -/*********************************************************************** -ADF Library Version: - -Get ADF Library Version ID. This is the version number of the ADF -library routines which your program is currently using. - The format of the version ID is: "ADF Library Version 000.01" - -ADF_Library_Version( version, error_return ) -output: char *version A 32-byte character string containing - the ADF Library version ID information. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Library_Version( - char *version, - int *error_return ) -{ - -int lversion; - -if( version == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Copy the proper portion of the "what" string **/ -strcpy ( version, &ADF_L_identification[4] ) ; -lversion = strlen ( version ) ; -version[lversion-1] = '\0' ; /** remove trailing "what" delimiter ('>') **/ -} /* end of ADF_Library_Version */ -/* end of file ADF_Library_Version.c */ -/* file ADF_Link.c */ -/*********************************************************************** -ADF Link: - -Create a link. Note: The Node linked to does not have to exist when the -link is created (but it may exist and that is OK). However, when -the link is used, an error will occur if the linked to node does not -exist. - -ADF_Link( PID, name, file, name_in_file, ID, error_return ) -input: const double PID The ID of the Node's parent. -input: const char *name The name of the link node. -input: const char *file The filename to use for the link (directly - usable by a C open() routine). If blank (null), - the link will be within the same file. - -input: const char *name_in_file The name of the node which - the link will point to. This can be a simple or compound name. - -output: double ID The returned ID of the link-node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Link( - const double PID, - const char *name, - const char *file_name, - const char *name_in_file, - double *ID, - int *error_return ) -{ -char link_data[ADF_FILENAME_LENGTH + - ADF_MAX_LINK_DATA_SIZE + 2] ; -int null_filename = FALSE ; -int filename_length, linked_to_length, data_length ; -int dim_vals[1] ; -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node_header ; - - /** Don't check file since it can be a NULL pointer **/ - -ADFI_check_string_length( name, ADF_NAME_LENGTH, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_check_string_length( name_in_file, ADF_MAX_LINK_DATA_SIZE, error_return ); -CHECK_ADF_ABORT( *error_return ) ; - -ADF_Is_Link( PID, &linked_to_length, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -if ( linked_to_length > 0 ) { - *error_return = LINKS_TOO_DEEP ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Create the node in the normal way **/ -ADF_Create( PID, name, ID, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( *ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Add the file and linked-to name as data in the child **/ -ADFI_check_string_length( file_name, ADF_FILENAME_LENGTH, error_return ) ; -if( *error_return != NO_ERROR ) { - null_filename = TRUE ; - filename_length = 0 ; - } /* end if */ -else { - filename_length = strlen( file_name) ; - } /* end else */ -linked_to_length = strlen( name_in_file ) ; - -data_length = filename_length + linked_to_length + 1 ; -if( data_length > ADF_FILENAME_LENGTH + ADF_MAX_LINK_DATA_SIZE + 1 ) { - *error_return = STRING_LENGTH_TOO_BIG ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( null_filename == TRUE ) { - sprintf( link_data, "%s%s", link_separator[file_index], name_in_file ) ; - } /* end if */ -else { - sprintf( link_data, "%s%s%s", file_name, link_separator[file_index], - name_in_file ) ; - } /* end else */ - - /** We must use a datatype of "C1" to put the data into this node. - With a datatype of "Lk" (a link), the written data will go - into the linked-to node (that's the whole point). To set - this up we must be careful... - **/ -dim_vals[0] = data_length ; -ADF_Put_Dimension_Information( *ID, "C1", 1, dim_vals, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADF_Write_All_Data( *ID, link_data, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Change the datatype to be LK, without deleting the data. - We can't use ADF_Put_Dimension_Information since the change - of datatype will delete the data. We must do this manually. - **/ - -ADFI_read_node_header( file_index, &block_offset, &node_header, error_return ); -CHECK_ADF_ABORT( *error_return ) ; - -if( (node_header.data_type[0] != 'C') || (node_header.data_type[1] != '1') || - (node_header.data_type[2] != ' ') ) { - *error_return = INVALID_DATA_TYPE ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -node_header.data_type[0] = 'L' ; -node_header.data_type[1] = 'K' ; -ADFI_write_node_header( file_index, &block_offset, &node_header, error_return ); -CHECK_ADF_ABORT( *error_return ) ; - -#if !LINUX_NFS_OPT -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -#endif - -} /* end of ADF_Link */ -/* end of file ADF_Link.c */ -/* file ADF_Move_Child.c */ -/*********************************************************************** -ADF Move Child: - -Change Parent (move a Child Node). The node and the 2 parents must -all exist within a single ADF file. If the node is pointed to by a -link-node, changing the node's parent will break the link. - -ADF_Move_Child( PID, ID, NPID, error_return ) -input: double PID The ID of the Node's parent. -input: double ID The ID of the node to use. -input: double NPID The ID of the Node's New Parent -output: int *error_return Error return. -***********************************************************************/ -void ADF_Move_Child( - const double PID, - const double ID, - const double NPID, - int *error_return ) -{ - -unsigned int parent_file_index, child_file_index, - new_parent_file_index, file_index ; -char child_name[ ADF_NAME_LENGTH ] ; -int found ; -struct DISK_POINTER parent, child, new_parent, sub_node_entry_location ; -struct SUB_NODE_TABLE_ENTRY sub_node_entry ; - -*error_return = NO_ERROR ; - -ADFI_ID_2_file_block_offset( PID, &parent_file_index, &parent.block, - &parent.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_ID_2_file_block_offset( ID, &child_file_index, &child.block, - &child.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( child_file_index != parent_file_index ) { - *error_return = NODES_NOT_IN_SAME_FILE ; - CHECK_ADF_ABORT( *error_return ) ; - } - -ADFI_ID_2_file_block_offset( NPID, &new_parent_file_index, &new_parent.block, - &new_parent.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( new_parent_file_index != parent_file_index ) { - *error_return = NODES_NOT_IN_SAME_FILE ; - CHECK_ADF_ABORT( *error_return ) ; - } - -file_index = parent_file_index ; /* use a shorter, more generic name - - file indices should now be the same - for all 3 nodes */ - - /** check that child is really a child of parent **/ -ADF_Get_Name( ID, child_name, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_check_4_child_name( file_index, &parent, child_name, &found, - &sub_node_entry_location, &sub_node_entry, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( found == 0 ) { /* child not found */ - *error_return = CHILD_NOT_OF_GIVEN_PARENT ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** add child to its new parent's sub node table **/ -ADFI_add_2_sub_node_table( file_index, &new_parent, &child, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** remove child from its old parent's sub node table **/ -ADFI_delete_from_sub_node_table( file_index, &parent, &child, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Move_Child */ -/* end of file ADF_Move_Child.c */ -/* file ADF_Number_of_Children.c */ -/*********************************************************************** -ADF Number of Children; - -Get Number of Children of a Node. Return the number of children -nodes directly associated with a parent node. - -ADF_Number_of_Children( ID, num_children, error_return ) -input: const double ID The ID of the node to use. -output: int *num_children The number of children directly - associated with this node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Number_of_Children( - const double ID, - int *num_children, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -double LID ; - -if( num_children == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Return the number of children **/ -*num_children = node.num_sub_nodes ; -} /* end of ADF_Number_of_Children */ -/* end of file ADF_Number_of_Children.c */ -/* file ADF_Put_Dimension_Information.c */ -/*********************************************************************** -ADF Put Dimension Information: - -Set/change the data-type and Dimension Information of a Node. Valid -user-definable data-types are: - -No data MT -Integer 32 I4 -Integer 64 I8 -Unsigned Int 32 U4 -Unsigned Int 64 U8 -Real 32 R4 -Real 64 R8 -Complex 64 X4 -Complex 128 X8 -Character (unsigned byte) C1 -Byte (unsigned byte) B1 -Compound data-types can be used which combine types -("I4,I4,R8"), define an array ("I4[25]"), or a combination of these -("I4,C1[20],R8[3]"). -dims can be a number from 0 to 12. - -dim_vals is an array of integers. The number of integers used is -determined by the dims argument. If dims is zero, the dim_values -are not used. Valid range for dim_values are from 1 to 2,147,483,648. -The total data size, calculated by the data-type-size times the -dimension value(s), cannot exceed 2,147,483,648. - -Note: When this routine is called and the data-type or the -number of dimensions changes, any data currently associated -with the node is lost!! The dimension values can be changed and -the data space will be extended as needed. - -ADF_Put_Dimension_Information( ID, data_type, dims, dim_vals, error_return ) -input: const double ID The ID of the node. -input: const char *data-type The data-type to use. -input: const int dims The number of dimensions this node has. -input: const int dim_vals[] The dimension values for this node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Put_Dimension_Information( - const double ID, - const char *data_type, - const int dims, - const int dim_vals[], - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -struct TOKENIZED_DATA_TYPE - tokenized_data_type[ 1 + (ADF_DATA_TYPE_LENGTH + 1)/3 ] ; -char file_format, machine_format ; -int file_bytes[2], machine_bytes[2] ; -int data_bytes, old_data_bytes ; -int i, datatype_length ; -int preserve_data = FALSE ; -double LID ; - -ADFI_check_string_length( data_type, ADF_DATA_TYPE_LENGTH, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( dim_vals == NULL && dims > 0 ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Check new datatype **/ -ADFI_evaluate_datatype( file_index, data_type, - &file_bytes[0], &machine_bytes[0], - tokenized_data_type, &file_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Look at old datatype **/ -ADFI_evaluate_datatype( file_index, node.data_type, - &file_bytes[1], &machine_bytes[1], - tokenized_data_type, &file_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Calculate new data-size **/ -if( dims < 0 ) { - *error_return = NUMBER_LESS_THAN_MINIMUM ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -if( dims > ADF_MAX_DIMENSIONS) { - *error_return = BAD_NUMBER_OF_DIMENSIONS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** If the number of dimensions is zero, set data-bytes to zero **/ -if( dims == 0 ) - data_bytes = 0 ; -else { /** Calculate the total number of bytes in the data **/ - for( data_bytes=file_bytes[0], i=0; i ADF_NAME_LENGTH ) { - *error_return = STRING_LENGTH_TOO_BIG ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( name_length == 0 ) { - *error_return = STRING_LENGTH_ZERO ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Need to check for uniqueness and legality of the name **/ -ADFI_check_4_child_name( file_index, &parent_block_offset, - &name[ name_start ], &found, &sub_node_entry_location, - &sub_node_entry, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( found == 1 ) { - *error_return = DUPLICATE_CHILD_NAME ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -for ( i=0; i < name_length; i++ ) { - if ( ! isprint ( name[ name_start + i ] ) || - name[ name_start + i ] == '/' ) { - *error_return = INVALID_NODE_NAME; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - } /* end for */ - - /** Confirm that child is from the parent **/ -ADFI_check_4_child_name( file_index, &parent_block_offset, - child_node.name, &found, &sub_node_entry_location, - &sub_node_entry, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( found == 0 ) { - *error_return = CHILD_NOT_OF_GIVEN_PARENT ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( (child_block_offset.block != sub_node_entry.child_location.block) || - (child_block_offset.offset != sub_node_entry.child_location.offset) ) { - *error_return = CHILD_NOT_OF_GIVEN_PARENT ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Copy the name **/ -name_length = strlen( name ) ; -for( i=0; i total_bytes ) { - bytes_to_read = total_bytes - bytes_read ; - } /* end if */ - if( bytes_to_read == 0 ) - break ; - ADFI_read_data_chunk( file_index, &data_chunk_table[i].start, - tokenized_data_type, file_bytes, bytes_to_read, 0, - bytes_to_read, data_pointer, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - -/** note: memory_bytes and file_bytes might be different (e.g., if machine - is "IEEE_BIG" and file is "CRAY") in which case data pointer advances - at a different rate from file pointer. **/ - data_pointer += (bytes_to_read * memory_bytes) / file_bytes ; - bytes_read += bytes_to_read ; - } /* end for */ - free( data_chunk_table ) ; - if( bytes_read < total_bytes ) { - *error_return = INCOMPLETE_DATA ; - memset( data_pointer, 0, total_bytes - bytes_read ) ; - } /* end if */ - } /* end else */ - -} /* end of ADF_Read_All_Data */ -/* end of file ADF_Read_All_Data.c */ -/* file ADF_Read_Block_Data.c */ -/*********************************************************************** -ADF Read Block Data: - -Read a continous block of data from a Node. Reads a block the node's data -and returns it into a contiguous memory space. - -ADF_Read_Block_Data( ID, data, error_return ) -input: const double ID The ID of the node to use. -input: const long b_start The starting point in block in token space -input: const long b_end The ending point in block in token space -output: char *data The start of the data in memory. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Read_Block_Data( - const double ID, - const long b_start, - const long b_end, - char *data, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -struct TOKENIZED_DATA_TYPE - tokenized_data_type[ 1 + (ADF_DATA_TYPE_LENGTH + 1)/3 ] ; -struct DATA_CHUNK_TABLE_ENTRY *data_chunk_table ; -char *data_pointer ; - -char file_format, machine_format ; -int file_bytes, memory_bytes, bytes_to_read ; -long total_bytes, bytes_read, start_offset ; -long chunk_size, chunk_end_byte ; -long start_byte, end_byte, block_bytes ; -int i, j ; -double LID ; - -if( data == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get datatype size **/ -ADFI_evaluate_datatype( file_index, node.data_type, &file_bytes, &memory_bytes, - tokenized_data_type, &file_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( (file_bytes == 0) || (node.number_of_dimensions == 0) ) { - *error_return = NO_DATA ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Calculate total number of bytes in the data **/ -total_bytes = file_bytes ; -for( j=0; j<(int)node.number_of_dimensions; j++ ) - total_bytes *= node.dimension_values[j] ; -if( total_bytes == 0 ) { - *error_return = ZERO_DIMENSIONS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Calculate the starting and ending range in the file **/ -start_byte = file_bytes * (b_start-1) ; -end_byte = file_bytes * b_end ; -if ( start_byte < 0 || start_byte > end_byte || end_byte > total_bytes ) { - *error_return = START_OUT_OF_DEFINED_RANGE ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -block_bytes = end_byte - start_byte ; - - /** If there is NO DATA, fill data space with zeros, return error **/ -if( node.number_of_data_chunks == 0 ) { - memset( data, 0, block_bytes*memory_bytes/file_bytes ) ; - *error_return = NO_DATA ; - return ; /** NO_DATA is really a warning, so don't check & abort... **/ - } /* end if */ - - /** Read the data from disk **/ -else if( node.number_of_data_chunks == 1 ) { - ADFI_read_data_chunk( file_index, &node.data_chunks, tokenized_data_type, - file_bytes, total_bytes, start_byte, block_bytes, - data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else if */ -else { - /** Allocate memory for the required table space in memory **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( node.number_of_data_chunks * sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Read in the table **/ - ADFI_read_data_chunk_table( file_index, &node.data_chunks, - data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Read data from each entry in the table **/ - bytes_read = 0 ; - chunk_end_byte = 0 ; - data_pointer = data ; - for( i=0; i<(int)node.number_of_data_chunks; i++ ) { - chunk_size = - (data_chunk_table[i].end.block - data_chunk_table[i].start.block) * - DISK_BLOCK_SIZE + - (data_chunk_table[i].end.offset - data_chunk_table[i].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - - /** Check to be sure we don't think the chunk is bigger than it is - (shrinking a data block can cause this) - **/ - if( chunk_end_byte + chunk_size > total_bytes ) { - chunk_size = total_bytes - chunk_end_byte ; - } /* end if */ - if( chunk_size == 0 ) - break ; - - chunk_end_byte += chunk_size ; - - /** If start of block not in this chunk then continue **/ - if ( start_byte > chunk_end_byte ) - continue ; - - /** Set offset into the current chunk **/ - if ( start_byte > (chunk_end_byte - chunk_size) ) - /** The start of the block is inside the current chunk so - adjust the offset to the beginning of the block **/ - start_offset = ( start_byte - (chunk_end_byte-chunk_size) ) ; - else - start_offset = 0 ; - - /** Calculate the number of bytes needed in this chunk **/ - bytes_to_read = chunk_size - start_offset ; - if( bytes_read + bytes_to_read > block_bytes ) { - bytes_to_read = block_bytes - bytes_read ; - } /* end if */ - if( bytes_to_read == 0 || (chunk_end_byte-chunk_size) > end_byte ) - break ; - - ADFI_read_data_chunk( file_index, &data_chunk_table[i].start, - tokenized_data_type, file_bytes, chunk_size, start_offset, - bytes_to_read, data_pointer, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - -/** note: memory_bytes and file_bytes might be different (e.g., if machine - is "IEEE_BIG" and file is "CRAY") in which case data pointer advances - at a different rate from file pointer. **/ - data_pointer += (bytes_to_read * memory_bytes) / file_bytes ; - bytes_read += bytes_to_read ; - } /* end for */ - free( data_chunk_table ) ; - if( bytes_read < block_bytes ) { - *error_return = INCOMPLETE_DATA ; - memset( data_pointer, 0, total_bytes - bytes_read ) ; - } /* end if */ - } /* end else */ - -} /* end of ADF_Read_Block_Data */ -/* end of file ADF_Read_Block_Data.c */ -/* file ADF_Read_Data.c */ -/*********************************************************************** -ADF Read Data: - -Read data from a node, with partial capabilities. The partial -capabilities are both in the node's data and also in memory. -Vectors of integers are used to indicate the data to be accessed -from the node, and another set of integer vectors is used to -describe the memory location for the data. - Note: If the data-type of the node is a compound data-type ("I4[3],R8") -for example, the partial capabilities will access one or more of -these 20-byte data entities. You cannot access a subset of an -occurrence of the data-type. - -ADF_Read_Data( ID, s_start[], s_end[], s_stride[], m_num_dims, - m_dims[], m_start[], m_end[], m_stride[], data, error_return ) -input: const double ID The ID of the node to use. -input: const int s_start[] The starting dimension values to use in - the database (node). -input: const int s_end[] The ending dimension values to use in - the database (node). -input: const int s_stride[] The stride values to use in the database (node). -input: const int m_num_dims The number of dimensions to use in memory. -input: const int m_dims[] The dimensionality to use in memory. -input: const int m_start[] The starting dimension values to use in memory. -input: const int m_end[] The ending dimension values to use in memory. -input: const int m_stride[] The stride values to use in memory. -output: char *data The start of the data in memory. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Read_Data( - const double ID, - const int s_start[], - const int s_end[], - const int s_stride[], - const int m_num_dims, - const int m_dims[], - const int m_start[], - const int m_end[], - const int m_stride[], - char *data, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset, relative_block ; -struct NODE_HEADER node ; -struct TOKENIZED_DATA_TYPE - tokenized_data_type[ 1 + (ADF_DATA_TYPE_LENGTH + 1)/3 ] ; -int current_disk[ADF_MAX_DIMENSIONS] ; -int current_memory[ADF_MAX_DIMENSIONS] ; -unsigned long total_disk_elements, total_memory_elements ; -unsigned long disk_offset, memory_offset ; -char disk_format, machine_format ; -int formats_compare ; -int i ; -int file_bytes = 0 ; -int memory_bytes = 0 ; -int no_data = FALSE ; -double LID ; -unsigned long relative_offset = 0, current_chunk = 0, current_chunk_size = 0, - past_chunk_sizes = 0; -struct DATA_CHUNK_TABLE_ENTRY *data_chunk_table = 0; - -if( (s_start == NULL) || (s_end == NULL) || (s_stride == NULL) || - (m_dims == NULL) || (m_start == NULL) || (m_end == NULL) || - (m_stride == NULL) || (data == NULL) ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get datatype length **/ -ADFI_evaluate_datatype( file_index, node.data_type, &file_bytes, &memory_bytes, - tokenized_data_type, &disk_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( (file_bytes == 0) || (node.number_of_dimensions == 0) ) { - *error_return = NO_DATA ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -ADFI_count_total_array_points( node.number_of_dimensions, - node.dimension_values, - s_start, s_end, s_stride, - &total_disk_elements, &disk_offset, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_count_total_array_points( (unsigned int)m_num_dims, - (unsigned int *)m_dims, - m_start, m_end, m_stride, - &total_memory_elements, &memory_offset, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( total_disk_elements != total_memory_elements ) { - *error_return = UNEQUAL_MEMORY_AND_DISK_DIMS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -ADFI_file_and_machine_compare( file_index, tokenized_data_type, - &formats_compare, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Check to see if there is actual data to use **/ -if( node.number_of_data_chunks == 0 ) { - no_data = TRUE ; - } /* end if */ - /** Check for multiple data-chunks **/ -else if( node.number_of_data_chunks == 1 ) { /** A single data chunk **/ - /** Point to the start of the data **/ - block_offset.block = node.data_chunks.block ; - block_offset.offset = node.data_chunks.offset + TAG_SIZE + - DISK_POINTER_SIZE + disk_offset * file_bytes ; - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else if */ -else if( node.number_of_data_chunks > 1 ) { /** Multiple data chunks **/ - current_chunk = 0 ; - past_chunk_sizes = 0 ; - relative_offset = disk_offset * file_bytes ; - /** Allocate memory for the required table space in memory **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( node.number_of_data_chunks * sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Read in the table **/ - ADFI_read_data_chunk_table( file_index, &node.data_chunks, - data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - current_chunk_size = (data_chunk_table[ current_chunk ].end.block - - data_chunk_table[ current_chunk ].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[ current_chunk ].end.offset - - data_chunk_table[ current_chunk ].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - - } /* end else if */ - - /** Setup initial indexing **/ -for( i=0; i<(int)node.number_of_dimensions; i++ ) - current_disk[i] = s_start[i] ; -for( i=0; i DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - if( formats_compare ) { - /** Read the data off of disk directly **/ - ADFI_read_file( file_index, block_offset.block, block_offset.offset, - file_bytes, (char *)data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { /** Read and translate data **/ - ADFI_read_data_translated( file_index, block_offset.block, - block_offset.offset, tokenized_data_type, file_bytes, - file_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Increment disk pointers, for the special case of one dimensional - data we will a simple increment to maximize the throught. Thus for - block reads you can temporarily change to 1D for the read to - improve efficiency. Note total size shouldn't change!! **/ - if( (unsigned)i < total_disk_elements - 1 ) { - if ( node.number_of_dimensions == 1 ) { - disk_offset = s_stride[0]; - current_disk[0] += disk_offset; - if ( current_disk[0] > s_end[0] ) current_disk[0] = s_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - node.number_of_dimensions, node.dimension_values, - s_start, s_end, s_stride, current_disk, &disk_offset, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - block_offset.offset += disk_offset * file_bytes ; - if ( block_offset.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - } /* end if */ - } /* end else if */ - else if( node.number_of_data_chunks > 1 ) { /** Multiple data chunks **/ - while( relative_offset >= past_chunk_sizes + current_chunk_size ) { - if( ++current_chunk >= node.number_of_data_chunks ) { - *error_return = INCOMPLETE_DATA ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { - past_chunk_sizes += current_chunk_size ; - current_chunk_size = (data_chunk_table[ current_chunk ].end.block - - data_chunk_table[ current_chunk ].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[ current_chunk ].end.offset - - data_chunk_table[ current_chunk ].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - } /* end else */ - } /* end while */ - - /** Get the data off of disk **/ - relative_block.block = data_chunk_table[ current_chunk ].start.block ; - relative_block.offset = data_chunk_table[ current_chunk ].start.offset + - (TAG_SIZE + DISK_POINTER_SIZE) + - (relative_offset - past_chunk_sizes) ; - if ( relative_block.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &relative_block, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } - - if( formats_compare ) { - /** Read the data off of disk directly **/ - ADFI_read_file( file_index, relative_block.block, relative_block.offset, - file_bytes, (char *)data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { /** Read and translate data **/ - ADFI_read_data_translated( file_index, relative_block.block, - relative_block.offset, tokenized_data_type, file_bytes, - file_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Increment disk pointers **/ - if( (unsigned)i < total_disk_elements - 1 ) { - if ( node.number_of_dimensions == 1 ) { - disk_offset = s_stride[0]; - current_disk[0] += disk_offset; - if ( current_disk[0] > s_end[0] ) current_disk[0] = s_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - node.number_of_dimensions, node.dimension_values, - s_start, s_end, s_stride, current_disk, &disk_offset, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - relative_offset += disk_offset * file_bytes ; - } /* end if */ - } /* end else if */ - - if( (unsigned)i < total_disk_elements - 1 ) { - /** Increment memory pointers **/ - if ( m_num_dims == 1 ) { - memory_offset = m_stride[0]; - current_memory[0] += disk_offset; - if ( current_memory[0] > m_end[0] ) current_memory[0] = m_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - (unsigned int)m_num_dims, (unsigned int* )m_dims, - m_start, m_end, m_stride, - current_memory, &memory_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Adjust data pointer **/ - data += memory_offset * memory_bytes ; - } /* end if */ - } /* end for */ - -if( node.number_of_data_chunks > 1 ) /** Multiple data chunks **/ - free( data_chunk_table ) ; - -} /* end of ADF_Read_Data */ -/* end of file ADF_Read_Data.c */ -/* file ADF_Set_Error_State.c */ -/*********************************************************************** -ADF Set Error State: - -Set Error State. For all ADF calls, set the error handling convention; -either return error codes, or abort the program on an error. The -default state for the ADF interface is to return error codes and NOT abort. - -ADF_Set_Error_State( error_state, error_return ) -input: const int error_state Flag for ABORT on error (1) or return error - status (0). -output: int *error_return Error return. -***********************************************************************/ -void ADF_Set_Error_State( - const int error_state, - int *error_return ) -{ -*error_return = NO_ERROR ; -if( error_state == 0 ) - ADF_abort_on_error = FALSE ; -else if( error_state == 1 ) - ADF_abort_on_error = TRUE ; -else { - *error_return = BAD_ERROR_STATE ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - -} /* end of ADF_Set_Error_State */ -/* end of file ADF_Set_Error_State.c */ -/* file ADF_Set_Label.c */ -/*********************************************************************** -ADF Set Label: - -Set Label. Set the 32 character string in a node's label field. - -ADF_Set_Label( ID, label, error_return ) -input: const double ID The ID of the node to use. -input: const char *label The 32-character label of the node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Set_Label( - const double ID, - const char *label, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -int i, label_length ; -double LID ; - - /** Don't check for NULL or BLANK label, these are OK **/ -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Copy the label **/ -if( label == NULL ) - label_length = 0 ; /* copy none, then blank fill */ -else - label_length = strlen( label ) ; -if( label_length > ADF_LABEL_LENGTH ) { - *error_return = STRING_LENGTH_TOO_BIG ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -for( i=0; i chunk_total_bytes ) { - /** Write the part of the new data to existing data-chunk **/ - ADFI_write_data_chunk( file_index, &node.data_chunks, - tokenized_data_type, file_bytes, chunk_total_bytes, 0, - chunk_total_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Allocate a second data chunk **/ - total_bytes -= chunk_total_bytes ; - ADFI_file_malloc( file_index, - total_bytes + TAG_SIZE + TAG_SIZE + DISK_POINTER_SIZE, - &new_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write the rest of the data **/ -/** note: memory_bytes and file_bytes might be different (e.g., if machine - is "IEEE_BIG" and file is "CRAY") in which case data pointer advances - at a different rate from file pointer. **/ - data += (chunk_total_bytes * memory_bytes ) / file_bytes ; - - ADFI_write_data_chunk( file_index, &new_block_offset, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Allocate a data-chunk-table for two entries **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + 5 * DISK_POINTER_SIZE, - &dct_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write data-chunk-table to disk **/ - data_chunk_entry_table[0].start.block = node.data_chunks.block ; - data_chunk_entry_table[0].start.offset = node.data_chunks.offset ; - chunk_start.block = node.data_chunks.block ; - chunk_start.offset = node.data_chunks.offset + TAG_SIZE ; - ADFI_adjust_disk_pointer( &chunk_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - /** get the size of the data_chunk for the table end pointer **/ - ADFI_read_disk_pointer_from_disk( file_index, - chunk_start.block, chunk_start.offset, - &data_chunk_entry_table[0].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - data_chunk_entry_table[1].start.block = new_block_offset.block ; - data_chunk_entry_table[1].start.offset = new_block_offset.offset ; - chunk_start.block = new_block_offset.block ; - chunk_start.offset = new_block_offset.offset + TAG_SIZE ; - ADFI_adjust_disk_pointer( &chunk_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - /** get the size of the data_chunk for the table end pointer **/ - ADFI_read_disk_pointer_from_disk( file_index, - chunk_start.block, chunk_start.offset, - &data_chunk_entry_table[1].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - ADFI_write_data_chunk_table( file_index, &dct_block_offset, - 2, data_chunk_entry_table, error_return ) ; - - /** Update node header with number of data-chunks = 2 and the - pointer to the data-chunk-table **/ - node.data_chunks.block = dct_block_offset.block ; - node.data_chunks.offset = dct_block_offset.offset ; - node.number_of_data_chunks = 2 ; - ADFI_write_node_header( file_index, &block_offset, &node, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { - /** Write the new data to existing data-chunk **/ - ADFI_write_data_chunk( file_index, &node.data_chunks, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - } /* end else if */ -else { /** Multiple data chunks **/ - /** Allocate memory for the data-chunk-table, with an additional - entry in case we need to grow it - **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( (node.number_of_data_chunks + 1 ) * - sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Read in the table **/ - ADFI_read_data_chunk_table( file_index, &node.data_chunks, - data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** looping on the data-chunks, write the size of the current chunk **/ - for( i=0; i<(int)node.number_of_data_chunks; i++ ) { - current_bytes = (data_chunk_table[i].end.block - - data_chunk_table[i].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[i].end.offset - - data_chunk_table[i].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - /** Limit the number of bytes written by whats left to write. **/ - current_bytes = MIN( current_bytes, total_bytes ) ; - ADFI_write_data_chunk( file_index, &data_chunk_table[i].start, - tokenized_data_type, file_bytes, current_bytes, 0, - current_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - -/** note: memory_bytes and file_bytes might be different (e.g., if machine - is "IEEE_BIG" and file is "CRAY") in which case data pointer advances - at a different rate from file pointer. **/ - data += (current_bytes * memory_bytes ) / file_bytes ; - - total_bytes -= current_bytes ; - if( total_bytes <= 0 ) - break ; - } /* end for */ - - /** If we are out of data-chunks and have data left, allocate a - new data-chunk in the file. **/ - - if( total_bytes > 0 ) { - /** Write data-chunk-table to disk **/ - - /** allocate data space in the file **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + DISK_POINTER_SIZE + - total_bytes, - &data_chunk_table[ node.number_of_data_chunks ].start, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - data_chunk_table[ node.number_of_data_chunks ].end.block = - data_chunk_table[ node.number_of_data_chunks ].start.block ; - data_chunk_table[ node.number_of_data_chunks ].end.offset = - data_chunk_table[ node.number_of_data_chunks ].start.offset + - TAG_SIZE + DISK_POINTER_SIZE + total_bytes ; - ADFI_adjust_disk_pointer( - &data_chunk_table[ node.number_of_data_chunks ].end, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** allocate space for the new data-chunk-entry-table **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + - (2 * (node.number_of_data_chunks + 1) + 1) * DISK_POINTER_SIZE, - &dct_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - ADFI_write_data_chunk_table( file_index, &dct_block_offset, - node.number_of_data_chunks+1, data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - ADFI_write_data_chunk( file_index, - &data_chunk_table[node.number_of_data_chunks ].start, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Free the old data-chunk-table **/ - ADFI_file_free( file_index, &node.data_chunks, 0, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Update node header with number of data-chunks++ and the - pointer to the data-chunk-table **/ - node.number_of_data_chunks++ ; - node.data_chunks.block = dct_block_offset.block ; - node.data_chunks.offset = dct_block_offset.offset ; - ADFI_write_node_header( file_index, &block_offset, &node, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - free( data_chunk_table ) ; - } /* end else */ - -#if !LINUX_NFS_OPT -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -#endif - -} /* end of ADF_Write_All_Data */ -/* end of file ADF_Write_All_Data.c */ -/* end of file ADF_Write_All_Data.c */ -/* file ADF_Write_Block_Data.c */ -/*********************************************************************** -ADF Write Block Data: - -Write all data to a Node. Writes all the node's data from a contiguous -memory space. - -ADF_Write_All_Data( ID, data, error_return ) -input: const double ID The ID of the node to use. -input: const long b_start The starting point in block in token space -input: const long b_end The ending point in block in token space -input: const char *data The start of the data in memory. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Write_Block_Data( - const double ID, - const long b_start, - const long b_end, - char *data, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset, new_block_offset, dct_block_offset ; -struct NODE_HEADER node ; -struct TOKENIZED_DATA_TYPE - tokenized_data_type[ 1 + (ADF_DATA_TYPE_LENGTH + 1)/3 ] ; -struct DATA_CHUNK_TABLE_ENTRY data_chunk_entry_table[2], *data_chunk_table ; - -char file_format, machine_format ; -int file_bytes, memory_bytes ; -long total_bytes, bytes_written, bytes_to_write = 0; -int i, j ; -char tag[TAG_SIZE+1] ; -struct DISK_POINTER data_start, chunk_start, end_of_chunk_tag ; -long start_offset ; -long chunk_size, chunk_end_byte ; -long start_byte, end_byte, block_bytes ; -double LID ; - -if( data == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get the datatype length **/ -ADFI_evaluate_datatype( file_index, node.data_type, &file_bytes, &memory_bytes, - tokenized_data_type, &file_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Calculate the total number of data bytes **/ -total_bytes = file_bytes ; -for( j=0; j<(int)node.number_of_dimensions; j++ ) - total_bytes *= node.dimension_values[j] ; -if( total_bytes == 0 ) { - *error_return = ZERO_DIMENSIONS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Calculate the starting and ending range in the file **/ -start_byte = file_bytes * (b_start-1) ; -end_byte = file_bytes * b_end ; -if ( start_byte < 0 || start_byte > end_byte || end_byte > total_bytes ) { - *error_return = START_OUT_OF_DEFINED_RANGE ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -block_bytes = end_byte - start_byte ; - - /** If there currently is NO data, allocate disk space for it **/ -if( node.number_of_data_chunks == 0 ) { - ADFI_file_malloc( file_index, - total_bytes + TAG_SIZE + TAG_SIZE + DISK_POINTER_SIZE, - &node.data_chunks, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write the new data **/ - ADFI_write_data_chunk( file_index, &node.data_chunks, tokenized_data_type, - file_bytes, total_bytes, start_byte, block_bytes, data, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Record the modified the node-header **/ - node.number_of_data_chunks = 1 ; - ADFI_write_node_header( file_index, &block_offset, &node, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -else if( node.number_of_data_chunks == 1 ) { - /** Get the data length **/ - ADFI_read_chunk_length( file_index, &node.data_chunks, tag, - &end_of_chunk_tag, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - tag[TAG_SIZE] = '\0' ; - - /** Check start-of-chunk tag **/ - if( ADFI_stridx_c( tag, data_chunk_start_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Point to the start of the data **/ - data_start.block = node.data_chunks.block ; - data_start.offset = node.data_chunks.offset + TAG_SIZE + DISK_POINTER_SIZE ; - ADFI_adjust_disk_pointer( &data_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** See if the new data exceedes the existing data space **/ - chunk_size = end_of_chunk_tag.offset - data_start.offset + - (end_of_chunk_tag.block - data_start.block) * DISK_BLOCK_SIZE ; - - - /** If Data grew: Write old size, then allocate more - data-space and write the rest **/ - if( total_bytes > chunk_size ) { - /** Write the part of the new data to existing data-chunk **/ - bytes_written = 0 ; - if ( start_byte <= chunk_size ) { - bytes_to_write = MIN ( block_bytes, (chunk_size-start_byte) ) ; - ADFI_write_data_chunk( file_index, &node.data_chunks, - tokenized_data_type, file_bytes, chunk_size, start_byte, - bytes_to_write, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - bytes_written += bytes_to_write ; - } /* end if */ - - /** Allocate a second data chunk **/ - total_bytes -= chunk_size ; - ADFI_file_malloc( file_index, - total_bytes + TAG_SIZE + TAG_SIZE + DISK_POINTER_SIZE, - &new_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write the rest of the data **/ -/** note: memory_bytes and file_bytes might be different (e.g., if machine - is "IEEE_BIG" and file is "CRAY") in which case data pointer advances - at a different rate from file pointer. **/ - data += (bytes_to_write * memory_bytes ) / file_bytes ; - - if ( bytes_written < block_bytes ) { - bytes_to_write = block_bytes - bytes_written ; - start_offset = MAX ( 0L, (start_byte - chunk_size) ) ; - ADFI_write_data_chunk( file_index, &new_block_offset, - tokenized_data_type, file_bytes, total_bytes, start_offset, - bytes_to_write, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { - ADFI_write_data_chunk( file_index, &new_block_offset, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, NULL, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Allocate a data-chunk-table for two entries **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + 5 * DISK_POINTER_SIZE, - &dct_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write data-chunk-table to disk **/ - data_chunk_entry_table[0].start.block = node.data_chunks.block ; - data_chunk_entry_table[0].start.offset = node.data_chunks.offset ; - /** get the size of the data_chunk for the table end pointer **/ - chunk_start.block = node.data_chunks.block ; - chunk_start.offset = node.data_chunks.offset + TAG_SIZE ; - ADFI_adjust_disk_pointer( &chunk_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - ADFI_read_disk_pointer_from_disk( file_index, - chunk_start.block, chunk_start.offset, - &data_chunk_entry_table[0].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - data_chunk_entry_table[1].start.block = new_block_offset.block ; - data_chunk_entry_table[1].start.offset = new_block_offset.offset ; - chunk_start.block = new_block_offset.block ; - chunk_start.offset = new_block_offset.offset + TAG_SIZE ; - ADFI_adjust_disk_pointer( &chunk_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - /** get the size of the data_chunk for the table end pointer **/ - ADFI_read_disk_pointer_from_disk( file_index, - chunk_start.block, chunk_start.offset, - &data_chunk_entry_table[1].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - ADFI_write_data_chunk_table( file_index, &dct_block_offset, - 2, data_chunk_entry_table, error_return ) ; - - /** Update node header with number of data-chunks = 2 and the - pointer to the data-chunk-table **/ - node.data_chunks.block = dct_block_offset.block ; - node.data_chunks.offset = dct_block_offset.offset ; - node.number_of_data_chunks = 2 ; - ADFI_write_node_header( file_index, &block_offset, &node, error_return ); - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { - /** Write the new data to existing data-chunk **/ - ADFI_write_data_chunk( file_index, &node.data_chunks, - tokenized_data_type, file_bytes, chunk_size, start_byte, - block_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - } /* end else if */ -else { /** Multiple data chunks **/ - /** Allocate memory for the data-chunk-table, with an additional - entry in case we need to grow it - **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( (node.number_of_data_chunks + 1 ) * - sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Read in the table **/ - ADFI_read_data_chunk_table( file_index, &node.data_chunks, - data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** looping on the data-chunks, write the size of the current chunk **/ - chunk_end_byte = 0 ; - bytes_written = 0 ; - for( i=0; i<(int)node.number_of_data_chunks; i++ ) { - chunk_size = (data_chunk_table[i].end.block - - data_chunk_table[i].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[i].end.offset - - data_chunk_table[i].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - chunk_end_byte += chunk_size ; - - /** If start of block not in this chunk then continue **/ - if ( start_byte > chunk_end_byte ) - continue ; - - /** Set offset into the current chunk **/ - if ( start_byte > (chunk_end_byte - chunk_size) ) - /** The start of the block is inside the current chunk so - adjust the offset to the beginning of the block **/ - start_offset = ( start_byte - (chunk_end_byte-chunk_size) ) ; - else - start_offset = 0 ; - - /** Check to be sure we aren't writing too much data **/ - bytes_to_write = chunk_size - start_offset ; - if( bytes_written + bytes_to_write > block_bytes ) { - bytes_to_write = block_bytes - bytes_written ; - } /* end if */ - if( bytes_to_write == 0 || (chunk_end_byte-chunk_size) > end_byte ) - continue ; - - /** Write the chunk **/ - ADFI_write_data_chunk( file_index, &data_chunk_table[i].start, - tokenized_data_type, file_bytes, chunk_size, start_offset, - bytes_to_write, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - -/** note: memory_bytes and file_bytes might be different (e.g., if machine - is "IEEE_BIG" and file is "CRAY") in which case data pointer advances - at a different rate from file pointer. **/ - data += (bytes_to_write * memory_bytes ) / file_bytes ; - - bytes_written += bytes_to_write ; - } /* end for */ - - /** If we are out of data-chunks and have data left, allocate a - new data-chunk in the file. **/ - total_bytes -= chunk_end_byte ; - if( total_bytes > 0 ) { - /** Write data-chunk-table to disk **/ - - /** allocate data space in the file **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + DISK_POINTER_SIZE + - total_bytes, - &data_chunk_table[ node.number_of_data_chunks ].start, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - data_chunk_table[ node.number_of_data_chunks ].end.block = - data_chunk_table[ node.number_of_data_chunks ].start.block ; - data_chunk_table[ node.number_of_data_chunks ].end.offset = - data_chunk_table[ node.number_of_data_chunks ].start.offset + - TAG_SIZE + DISK_POINTER_SIZE + total_bytes ; - ADFI_adjust_disk_pointer( - &data_chunk_table[ node.number_of_data_chunks ].end, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** allocate space for the new data-chunk-entry-table **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + - (2 * (node.number_of_data_chunks + 1) + 1) * DISK_POINTER_SIZE, - &dct_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - ADFI_write_data_chunk_table( file_index, &dct_block_offset, - node.number_of_data_chunks+1, data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - if ( bytes_written < block_bytes ) { - bytes_to_write = block_bytes - bytes_written ; - start_offset = MAX ( 0L, (start_byte - total_bytes) ) ; - ADFI_write_data_chunk( file_index, - &data_chunk_table[node.number_of_data_chunks ].start, - tokenized_data_type, file_bytes, - total_bytes, start_offset, bytes_to_write, - data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { - ADFI_write_data_chunk( file_index, - &data_chunk_table[node.number_of_data_chunks ].start, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, NULL, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Free the old data-chunk-table **/ - ADFI_file_free( file_index, &node.data_chunks, 0, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Update node header with number of data-chunks++ and the - pointer to the data-chunk-table **/ - node.number_of_data_chunks++ ; - node.data_chunks.block = dct_block_offset.block ; - node.data_chunks.offset = dct_block_offset.offset ; - ADFI_write_node_header( file_index, &block_offset, &node, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - free( data_chunk_table ) ; - } /* end else */ - -#if !LINUX_NFS_OPT -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -#endif - -} /* end of ADF_Write_Block_Data */ -/* end of file ADF_Write_Block_Data.c */ -/* file ADF_Write_Data.c */ -/*********************************************************************** -ADF Write Data: - -Write data to a Node, with partial capabilities. See ADF_Read_Data for -description. - -ADF_Write_Data( ID, s_start[], s_end[], s_stride[], m_num_dims, - m_dims[], m_start[], m_end[], m_stride[], data, error_return ) -input: const double ID The ID of the node to use. -input: const int s_start[] The starting dimension values to use in - the database (node). -input: const int s_end[] The ending dimension values to use in - the database (node). -input: const int s_stride[] The stride values to use in the database (node). -input: const int m_num_dims The number of dimensions to use in memory. -input: const int m_dims[] The dimensionality to use in memory. -input: const int m_start[] The starting dimension values to use in memory. -input: const int m_end[] The ending dimension values to use in memory. -input: const int m_stride[] The stride values to use in memory. -input: const char *data The start of the data in memory. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Write_Data( - const double ID, - const int s_start[], - const int s_end[], - const int s_stride[], - const int m_num_dims, - const int m_dims[], - const int m_start[], - const int m_end[], - const int m_stride[], - const char *data, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset, dct_block_offset, relative_block ; -struct DISK_POINTER data_start, new_block_offset ; -struct DISK_POINTER chunk_start, end_of_chunk_tag ; -struct NODE_HEADER node ; -struct DATA_CHUNK_TABLE_ENTRY *data_chunk_table ; -struct TOKENIZED_DATA_TYPE - tokenized_data_type[ 1 + (ADF_DATA_TYPE_LENGTH + 1)/3 ] ; -int current_disk[ADF_MAX_DIMENSIONS] ; -int current_memory[ADF_MAX_DIMENSIONS] ; -unsigned long total_disk_elements, total_memory_elements ; -unsigned long disk_offset, memory_offset ; -int formats_compare ; -char disk_format, machine_format ; -int i ; -int file_bytes = 0 ; -int memory_bytes = 0 ; -char tag[TAG_SIZE+1] ; -unsigned long total_bytes ; -long current_bytes, chunk_total_bytes ; -double LID ; -unsigned long relative_offset, current_chunk, current_chunk_size, - past_chunk_sizes ; - -if( (s_start == NULL) || (s_end == NULL) || (s_stride == NULL) || - (m_dims == NULL) || (m_start == NULL) || (m_end == NULL) || - (m_stride == NULL) || (data == NULL) ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; -data_chunk_table = 0L ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get datatype length **/ -ADFI_evaluate_datatype( file_index, node.data_type, &file_bytes, &memory_bytes, - tokenized_data_type, &disk_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( (file_bytes == 0) || (node.number_of_dimensions == 0) ) { - *error_return = NO_DATA ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -ADFI_count_total_array_points( node.number_of_dimensions, - node.dimension_values, - s_start, s_end, s_stride, - &total_disk_elements, &disk_offset, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_count_total_array_points( (unsigned int)m_num_dims, - (unsigned int *)m_dims, - m_start, m_end, m_stride, - &total_memory_elements, &memory_offset, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( total_disk_elements != total_memory_elements ) { - *error_return = UNEQUAL_MEMORY_AND_DISK_DIMS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Calculate the total number of data bytes **/ -total_bytes = file_bytes ; -for( i=0; i<(int)node.number_of_dimensions; i++ ) - total_bytes *= node.dimension_values[i] ; -if( total_bytes == 0 ) { - *error_return = ZERO_DIMENSIONS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** check for need of data translation **/ -ADFI_file_and_machine_compare( file_index, tokenized_data_type, - &formats_compare, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** If there currently is NO data, allocate disk space for it **/ -if( node.number_of_data_chunks == 0 ) { - ADFI_file_malloc( file_index, - total_bytes + TAG_SIZE + TAG_SIZE + DISK_POINTER_SIZE, - &node.data_chunks, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** initialize the new disk_space with zero's, then we'll - write the partial data **/ - ADFI_write_data_chunk( file_index, &node.data_chunks, tokenized_data_type, - file_bytes, total_bytes, 0, total_bytes, 0L, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Record the modified the node-header **/ - node.number_of_data_chunks = 1 ; - ADFI_write_node_header( file_index, &block_offset, &node, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - /** If one data chunk, check to see if we need to add a second **/ -else if( node.number_of_data_chunks == 1 ) { - /** Get the data length **/ - ADFI_read_chunk_length( file_index, &node.data_chunks, tag, - &end_of_chunk_tag, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - tag[TAG_SIZE] = '\0' ; - - /** Check start-of-chunk tag **/ - if( ADFI_stridx_c( tag, data_chunk_start_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Point to the start of the data **/ - data_start.block = node.data_chunks.block ; - data_start.offset = node.data_chunks.offset + TAG_SIZE + DISK_POINTER_SIZE ; - ADFI_adjust_disk_pointer( &data_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** See if the new data exceedes the existing data space **/ - chunk_total_bytes = end_of_chunk_tag.offset - data_start.offset + - (end_of_chunk_tag.block - data_start.block) * DISK_BLOCK_SIZE ; - - /** If Data grew: Allocate more data-space and initialize to zero**/ - if( (long int) total_bytes > chunk_total_bytes ) { - /** Allocate memory for the data-chunk-table, with an additional - entry in case we need to grow it **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( (node.number_of_data_chunks + 1 ) * - sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Allocate a second data chunk **/ - total_bytes -= chunk_total_bytes ; - ADFI_file_malloc( file_index, - total_bytes + TAG_SIZE + TAG_SIZE + DISK_POINTER_SIZE, - &new_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Initialize the new data with zeros **/ - ADFI_write_data_chunk( file_index, &new_block_offset, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, 0L, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Allocate a data-chunk-table for two entries **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + 5 * DISK_POINTER_SIZE, - &dct_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write data-chunk-table to disk **/ - data_chunk_table[0].start.block = node.data_chunks.block ; - data_chunk_table[0].start.offset = node.data_chunks.offset ; - chunk_start.block = node.data_chunks.block ; - chunk_start.offset = node.data_chunks.offset + TAG_SIZE ; - ADFI_adjust_disk_pointer( &chunk_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - /** get the size of the data_chunk for the table end pointer **/ - ADFI_read_disk_pointer_from_disk( file_index, - chunk_start.block, chunk_start.offset, - &data_chunk_table[0].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - data_chunk_table[1].start.block = new_block_offset.block ; - data_chunk_table[1].start.offset = new_block_offset.offset ; - chunk_start.block = new_block_offset.block ; - chunk_start.offset = new_block_offset.offset + TAG_SIZE ; - ADFI_adjust_disk_pointer( &chunk_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - /** get the size of the data_chunk for the table end pointer **/ - ADFI_read_disk_pointer_from_disk( file_index, - chunk_start.block, chunk_start.offset, - &data_chunk_table[1].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - ADFI_write_data_chunk_table( file_index, &dct_block_offset, - 2, data_chunk_table, error_return ) ; - - /** Update node header with number of data-chunks = 2 and the - pointer to the data-chunk-table **/ - node.data_chunks.block = dct_block_offset.block ; - node.data_chunks.offset = dct_block_offset.offset ; - node.number_of_data_chunks = 2 ; - ADFI_write_node_header( file_index, &block_offset, &node, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - } /* end else if */ -else { /** Multiple data chunks, check to see if we need to add one mode **/ - /** Allocate memory for the data-chunk-table, with an additional - entry in case we need to grow it **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( (node.number_of_data_chunks + 1 ) * - sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Read in the table **/ - ADFI_read_data_chunk_table( file_index, &node.data_chunks, - data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** looping on the data-chunks, look at the size of the chunks **/ - for( i=0; i<(int)node.number_of_data_chunks; i++ ) { - current_bytes = (data_chunk_table[i].end.block - - data_chunk_table[i].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[i].end.offset - - data_chunk_table[i].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - total_bytes -= current_bytes ; - if( total_bytes <= 0 ) - break ; - } /* end for */ - - /** If we are out of data-chunks and have data left, allocate a - new data-chunk in the file. **/ - if( total_bytes > 0 ) { - /** Write data-chunk-table to disk **/ - - /** allocate data space in the file **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + DISK_POINTER_SIZE + - total_bytes, &data_chunk_table[ node.number_of_data_chunks ].start, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - data_chunk_table[ node.number_of_data_chunks ].end.block = - data_chunk_table[ node.number_of_data_chunks ].start.block ; - data_chunk_table[ node.number_of_data_chunks ].end.offset = - data_chunk_table[ node.number_of_data_chunks ].start.offset + - TAG_SIZE + DISK_POINTER_SIZE + total_bytes ; - ADFI_adjust_disk_pointer( - &data_chunk_table[ node.number_of_data_chunks ].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** allocate space for the new data-chunk-entry-table **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + - (2 * (node.number_of_data_chunks + 1) + 1) * DISK_POINTER_SIZE, - &dct_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - ADFI_write_data_chunk_table( file_index, &dct_block_offset, - node.number_of_data_chunks+1, data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Initialize the new data chunk to zeros **/ - ADFI_write_data_chunk( file_index, - &data_chunk_table[node.number_of_data_chunks ].start, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, 0L, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - /** Free the old data-chunk-table **/ - ADFI_file_free( file_index, &node.data_chunks, 0, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Update node header with number of data-chunks++ and the - pointer to the data-chunk-table **/ - node.number_of_data_chunks++ ; - node.data_chunks.block = dct_block_offset.block ; - node.data_chunks.offset = dct_block_offset.offset ; - ADFI_write_node_header( file_index, &block_offset, &node, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - } /* end else */ - - /** Do single data-chunks here... **/ -if( node.number_of_data_chunks == 1 ) { - /** Point to the start of the data **/ - block_offset.block = node.data_chunks.block ; - block_offset.offset = node.data_chunks.offset + TAG_SIZE + - DISK_POINTER_SIZE + disk_offset * file_bytes ; - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Setup initial indexing **/ - for( i=0; i<(int)node.number_of_dimensions; i++ ) - current_disk[i] = s_start[i] ; - for( i=0; i DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } - - /** Here is where we need to check for spanning multiple data-chunks **/ - - /** Put the data out to disk **/ - if( formats_compare ) { /* directly */ - ADFI_write_file( file_index, block_offset.block, block_offset.offset, - file_bytes, (char *)data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { /* translated */ - ADFI_write_data_translated( file_index, block_offset.block, - block_offset.offset, tokenized_data_type, file_bytes, - file_bytes, (char *)data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Increment disk/memory pointers, for the special case of one dimensional - data we will a simple increment to maximize the throught. Thus for - block writes you can temporarily change to 1D for the read to - improve efficiency. Note total size shouldn't change!! **/ - if( (unsigned)i < total_disk_elements - 1 ) { - if ( node.number_of_dimensions == 1 ) { - disk_offset = s_stride[0]; - current_disk[0] += disk_offset; - if ( current_disk[0] > s_end[0] ) current_disk[0] = s_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - node.number_of_dimensions, node.dimension_values, - s_start, s_end, s_stride, current_disk, &disk_offset, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - if ( m_num_dims == 1 ) { - memory_offset = m_stride[0]; - current_memory[0] += disk_offset; - if ( current_memory[0] > m_end[0] ) current_memory[0] = m_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - (unsigned int)m_num_dims, (unsigned int* )m_dims, - m_start, m_end, m_stride, - current_memory, &memory_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - block_offset.offset += disk_offset * file_bytes ; - if ( block_offset.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Adjust data pointer **/ - data += memory_offset * memory_bytes ; - } /* end if */ - } /* end for */ - } /* end if */ -else { - /** Point to the start of the data **/ - current_chunk = 0 ; - past_chunk_sizes = 0 ; - relative_offset = disk_offset * file_bytes ; - current_chunk_size = (data_chunk_table[ current_chunk ].end.block - - data_chunk_table[ current_chunk ].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[ current_chunk ].end.offset - - data_chunk_table[ current_chunk ].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - - /** Setup initial indexing **/ - for( i=0; i<(int)node.number_of_dimensions; i++ ) - current_disk[i] = s_start[i] ; - for( i=0; i= past_chunk_sizes + current_chunk_size ) { - if( ++current_chunk >= node.number_of_data_chunks ) { - *error_return = INCOMPLETE_DATA ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { - past_chunk_sizes += current_chunk_size ; - current_chunk_size = (data_chunk_table[ current_chunk ].end.block - - data_chunk_table[ current_chunk ].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[ current_chunk ].end.offset - - data_chunk_table[ current_chunk ].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - } /* end else */ - } /* end while */ - - /** Put the data to disk **/ - relative_block.block = data_chunk_table[ current_chunk ].start.block ; - relative_block.offset = data_chunk_table[ current_chunk ].start.offset + - (TAG_SIZE + DISK_POINTER_SIZE) + - (relative_offset - past_chunk_sizes) ; - if ( relative_block.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &relative_block, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Put the data out to disk **/ - if( formats_compare ) { /* directly */ - ADFI_write_file( file_index, - relative_block.block, relative_block.offset, - file_bytes, (char *)data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { /* translated */ - ADFI_write_data_translated( file_index, relative_block.block, - relative_block.offset, tokenized_data_type, file_bytes, - file_bytes, (char *)data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Increment disk and memory pointers **/ - if( (unsigned)i < total_disk_elements - 1 ) { - if ( node.number_of_dimensions == 1 ) { - disk_offset = s_stride[0]; - current_disk[0] += disk_offset; - if ( current_disk[0] > s_end[0] ) current_disk[0] = s_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - node.number_of_dimensions, node.dimension_values, - s_start, s_end, s_stride, current_disk, &disk_offset, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - relative_offset += disk_offset * file_bytes ; - - if ( m_num_dims == 1 ) { - memory_offset = m_stride[0]; - current_memory[0] += disk_offset; - if ( current_memory[0] > m_end[0] ) current_memory[0] = m_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - (unsigned int)m_num_dims, (unsigned int* )m_dims, - m_start, m_end, m_stride, - current_memory, &memory_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Adjust data pointer **/ - data += memory_offset * memory_bytes ; - } /* end if */ - } /* end for */ - } /* end else */ - -if( data_chunk_table != 0L ) - free( data_chunk_table ) ; - -#if !LINUX_NFS_OPT -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -#endif - -} /* end of ADF_Write_Data */ -/* end of file ADF_Write_Data.c */ -/* end of combine 2.0 */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_interface.cpp b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_interface.cpp deleted file mode 100644 index 9a91d73585..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_interface.cpp +++ /dev/null @@ -1,5 +0,0 @@ -extern "C" { - -#include "ADF_interface.c" - -} diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_interface.mod.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_interface.mod.c deleted file mode 100644 index 06626384d9..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_interface.mod.c +++ /dev/null @@ -1,4450 +0,0 @@ -/* ADF write performance on Linux 2.4 NFS is very bad, largely due to - the fact that ADF does a lot of fseeks. Writing the modification - time all the time increases the problem; about a 10 - 20% performance - can be achieved by only writing the mod time when the file is closed. */ -#ifndef LINUX_NFS_OPT -#define LINUX_NFS_OPT 1 -#endif - -#include -#define kTimerNameMaxChars 255 -struct _Timer { - char name[kTimerNameMaxChars+1]; - struct timeval start; - struct timeval end; - double time; - long iterations; -}; -typedef struct _Timer Timer; -extern void tStart(Timer *t); -extern void tEnd(Timer *t); - -extern Timer gADF_Create_Node_Timer; -extern Timer gADF_Create_Node_Prep_Timer; -extern Timer gADF_Create_Node_Write_Timer; -extern Timer gADF_Create_Node_After_Timer; -extern Timer gADF_Create_Node_With_Label_Timer; -extern Timer gADF_Create_Node_With_Label_Prep_Timer; -extern Timer gADF_Create_Node_With_Label_Write_Timer; -extern Timer gADF_Create_Node_With_Label_After_Timer; -extern Timer gADF_Children_Names_Timer; -extern Timer gADF_Children_IDs_Timer; -extern Timer gADF_Database_Close_Timer; -extern Timer gADF_Database_Get_Format_Timer; -extern Timer gADF_Database_Open_Timer; -extern Timer gADF_Database_Set_Format_Timer; -extern Timer gADF_Database_Version_Timer; -extern Timer gADF_Delete_Timer; -extern Timer gADF_Get_Data_Type_Timer; -extern Timer gADF_Get_Dimension_Values_Timer; -extern Timer gADF_Get_Label_Timer; -extern Timer gADF_Get_Link_Path_Timer; -extern Timer gADF_Get_Name_Timer; -extern Timer gADF_Get_Node_ID_Timer; -extern Timer gADF_Get_Number_of_Dimensions_Timer; -extern Timer gADF_Get_Root_ID_Timer; -extern Timer gADF_Is_Link_Timer; -extern Timer gADF_Number_of_Children_Timer; -extern Timer gADF_Put_Dimension_Information_Timer; -extern Timer gADF_Put_Name_Timer; -extern Timer gADF_Read_All_Data_Timer; -extern Timer gADF_Read_Block_Data_Timer; -extern Timer gADF_Read_Data_Timer; -extern Timer gADF_Set_Label_Timer; -extern Timer gADF_Write_All_Data_Timer; -extern Timer gADF_Write_Block_Data_Timer; -extern Timer gADF_Write_Data_Timer; - -/* created by combine 2.0 */ -/* file ADF_AAA_var.c */ -/* file ADF_AAA_var.c */ -/*** -File: ADF_interface.c - ---------------------------------------------------------------------- - BOEING - ---------------------------------------------------------------------- - Project: CGNS - Author: Tom Dickens 234-1024 tpd6908@yak.ca.boeing.com - Date: 3/2/1995 - Purpose: The code which implements the ADF-Core capabilities. - ---------------------------------------------------------------------- - ---------------------------------------------------------------------- - -***/ - -/*********************************************************************** - Library and Database "what" strings. -***********************************************************************/ -/** Change the major revision letter in the Library Version for changes - to the API (new public functions, changes to public header files, - changes to existings functions or their defined behavior) - and/or changes to the internal file format resulting in - incompatibilites with previous library versions. Change the - internal revision number for internal changes and bug fixes; - reset to zero for major revision letter changes. **/ - -/** With the original ADF library, there is no binary data for at least - the first 560 bytes, which causes a lot of programs - (mailers, WinZip) to think that the file is text and try to do - a \n -> \n\r conversion. Since this string is only used for the - 'what' command, I am deciding that we don't need this functionality - and am putting binary characters here. Specifically, I am putting - control characters, because while some programs (Evolution/gnome-vfs) - look for unprintable characters, some look for a ratio (Mozilla). **/ - -static char ADF_L_identification[] = "@(#)ADF Library Version E01>\001\002\003\004"; - /* 01234567890123456789012345678901 = 32 */ - -/** Change version database version number every time the library - version changes according to the following philosophy. - -The format: - - AXXxxx - -where: - - A Major revision number. Major internal structure changes. - This number is not expected to change very often if at all - because backward compatibility is only available by explicit - policy decision. - - One alphabetic character. - Range of values: A-Za-z - In unlikely event of reaching z, then can use any other - unused printable ASCII character except blank or symbols - used by "what" command: @, (, #, ), ~, >, \. - - XX Minor revision number. New features and minor changes and - bug fixes. Files are backward but NOT forward compatible. - - Two digit hexadecimal number (uppercase letters). - Range of values: 00 - FF - Reset to 00 with changes in major revision number. - - xxx Incremental number. Incremented with every new version of - library (even if no changes are made to file format). - Files are forward AND backward compatible. - - Three digit hexadecimal number (lowercase letters) - Range of values: 000 to fff - Does not reset. - -Definitions: - - forward compatible Older versions of libraries can read and write - to files created by newer versions of libraries. - - backward compatible Newer versions of libraries can read and write - to files created by older versions of libraries. -**/ - - /* AXXxxx */ -static char ADF_D_identification[] = "@(#)ADF Database>\001\002\003\004\005\006\007\010A02011>"; - /* 01234567890123456789012345678901 = 32 */ - -/*********************************************************************** - Includes -***********************************************************************/ -#ifndef MAKEDEPEND -#include -#include -#include -#if !defined(_WIN32) || (defined(_WIN32) && defined(__NUTC__)) -#include -#else -#include -#endif -#include -#include -#endif - -#include "ADF.h" -#include "ADF_internals.h" -/* This was moved from ADF_internals.h since they are only used here - and leaving them here gives warning messages when the other .c files - are compiled. WRO 2005-Jan-11 */ -static char data_chunk_start_tag[] = "DaTa" ; - -#if defined(_WIN32) && !defined(__NUTC__) -#ifndef MAKEDEPEND -#include -#endif -#ifndef F_OK -#define R_OK 004 /* Test for Read permission */ -#define W_OK 002 /* Test for Write permission */ -#define X_OK 001 /* Test for eXecute permission */ -#define F_OK 000 /* Test for existence of File */ -#endif -#endif - - -/*********************************************************************** - Error strings - These strings must be kept in sync with the error defines in ADF.h. -***********************************************************************/ -const char *ADF_error_string[] = { - "ADF -1: No Error.", - "ADF 1: Integer number is less than given minimum value.", - "ADF 2: Integer number is greater than given maximum value.", - "ADF 3: String length of zero or blank string detected.", - "ADF 4: String length longer than maximum allowable length.", - "ADF 5: String is not an ASCII-HEX string.", - "ADF 6: Too many ADF files opened.", - "ADF 7: ADF file status was not recognized.", - "ADF 8: ADF file-open error.", - "ADF 9: ADF file not currently opened.", - "ADF 10: ADF file index out of legal range.", - "ADF 11: Block/offset out of legal range.", - "ADF 12: A string pointer is NULL.", - "ADF 13: FSEEK error.", - "ADF 14: FWRITE error.", - "ADF 15: FREAD error.", - "ADF 16: Internal error: Memory boundary tag bad.", - "ADF 17: Internal error: Disk boundary tag bad.", - "ADF 18: File Open Error: NEW - File already exists.", - "ADF 19: ADF file format was not recognized.", - "ADF 20: Attempt to free the RootNode disk information.", - "ADF 21: Attempt to free the FreeChunkTable disk information.", - "ADF 22: File Open Error: OLD - File does not exist.", - "ADF 23: Entered area of Unimplemented Code...", - "ADF 24: Sub-Node.entries is bad.", - "ADF 25: Memory allocation failed.", - "ADF 26: Duplicate child name under a parent node.", - "ADF 27: Node has no dimensions.", - "ADF 28: Node's number-of-dimensions is not in legal range.", - "ADF 29: Specified child is NOT a child of the specified parent.", - "ADF 30: Data-Type is too long.", - "ADF 31: Invalid Data-Type.", - "ADF 32: A pointer is NULL.", - "ADF 33: Node has no data associated with it.", - "ADF 34: Error zeroing out memory.", - "ADF 35: Requested data exceeds actual data available.", - "ADF 36: Bad end value.", - "ADF 37: Bad stride value.", - "ADF 38: Minimum values is greater than the maximum value.", - "ADF 39: The format of this machine does not match a known signature.", - "ADF 40: Cannot convert to or from an unknown Native format.", - "ADF 41: The two conversion formats are equal, no conversion done.", - "ADF 42: The data format is not support on a particular machine.", - "ADF 43: File Close error.", - "ADF 44: Numeric overflow/underflow in data conversion.", - "ADF 45: Bad start value.", - "ADF 46: A value of zero is not allowable.", - "ADF 47: Bad dimension value.", - "ADF 48: Error state must be either a 0 (zero) or a 1 (one).", - "ADF 49: Dimensional specifications for disk and memory are unequal.", - "ADF 50: Too many link level used. May be caused by a recursive link.", - "ADF 51: The node is not a link. It was expected to be a link.", - "ADF 52: The linked-to node does not exist.", - "ADF 53: The ADF file of a linked-node is not accessable.", - "ADF 54: A node-id of 0.0 is not valid.", - "ADF 55: Incomplete Data when reading multiple data blocks.", - "ADF 56: Node name contains invalid characters.", - "ADF 57: ADF file version incompatible with this library version.", - "ADF 58: Nodes are not from the same file.", - "ADF 59: Priority Stack Error.", - "ADF 60: Machine format and file format are incompatable.", - "ADF 61: FFLUSH error", - "ADF 62: The node ID pointer is NULL.", - "ADF x: Last error mesage" - } ; - -/*********************************************************************** - Global Variables: -***********************************************************************/ -static int ADF_abort_on_error = FALSE ; -static char link_separator[MAXIMUM_FILES][2] ; - -#define CHECK_ADF_ABORT( error_flag ) if( error_flag != NO_ERROR ) { \ - if( ADF_abort_on_error == TRUE ) { \ - ADF_Error_Message( error_flag, 0L );\ - ADFI_Abort( error_flag) ; } \ - else { return ; } } -/* Added to remove memory leaks in ADF_Get_Node_ID */ -#define CHECK_ADF_ABORT1( error_flag ) if( error_flag != NO_ERROR ) { \ - free (name_tmp); \ - if( ADF_abort_on_error == TRUE ) { \ - ADF_Error_Message( error_flag, 0L );\ - ADFI_Abort( error_flag) ; } \ - else { return ; } } - -/*********************************************************************** -Data Query: -Note: If the node is a link, the data query will occur on the linked-to -node, not the node which is the link. -Internal Implementation: A linked node will have a data-type of "LK", -dimension of 1 and a dimension value of the length of a data string -containing the file-path and the node-path within the file. The -routines ADF_Is_Link and ADF_Get_Link_Path allow viewing of a link's -data-type and data. -***********************************************************************/ -/*********************************************************************** -Data I/O: -A 1-based system is used with all index values (the first element has an -index of 1, not 0). -***********************************************************************/ -/* end of file ADF_AAA_var.c */ -/* end of file ADF_AAA_var.c */ -/* file ADF_Children_Names.c */ -/*********************************************************************** -ADF Children names: - -Get Children names of a Node. Return the name of children nodes -directly associated with a parent node. The names of the children -are NOT guaranteed to be returned in any particular order. If a new -child is added, it is NOT guaranteed to be returned as the last child. - -Null-terminated names will be written into the names array and thus -there needs to be room for the null character. As an example, -the array can be defined as: - - char names[IMAX_NUM][IMAX_NAME_LENGTH+1]; - -where IMAX_NUM and IMAX_NAME_LENGTH are defined by the using application -and correspond to this function's "imax_num" and "imax_name_len" parameters -respectively. "imax_name_len" is the maximum length of a name to be copied -into the names array. This value can be equal to ADF_NAME_LENGTH but does -not have to be. However, the name dimension of the array MUST be declared -to be "imax_name_len" + 1. The name will be returned truncated (but still -null-terminated) if the actual name is longer than "imax_name_len" and -if "imax_name_len" is less than ADF_NAME_LENGTH. - -Note that the names array parameter is declared as a single dimension -character array inside this function. Therefore, use a (char *) cast to -cast a two dimensional array argument. - -ADF_Children_Names( PID, istart, imax_num, imax_name_len, inum_ret, - names, error_return ) -input: const double PID The ID of the Node to use. -input: const int istart The Nth child's name to start with (first is 1). -input: const int imax_num Maximum number of names to return. -input: const int imax_name_len Maximum Length of a name to return. -output: int *inum_ret The number of names returned. -output: char *names The returned names (cast with (char *)). -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -NUMBER_LESS_THAN_MINIMUM -***********************************************************************/ -void ADF_Children_Names( - const double PID, - const int istart, - const int imax_num, - const int imax_name_len, - int *inum_ret, - char *names, - int *error_return ) -{ -int i ; -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -struct SUB_NODE_TABLE_ENTRY sub_node_table_entry ; -double LID ; - -*error_return = NO_ERROR ; - -if( inum_ret == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -*inum_ret = 0 ; - -if( names == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( (istart <=0) || (imax_num <= 0) || (imax_name_len <= 0) ) { - *error_return = NUMBER_LESS_THAN_MINIMUM ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -tStart(&gADF_Children_Names_Timer); -ADFI_chase_link( PID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Check for zero children, return if 0 **/ -if( node.num_sub_nodes == 0 ) { - tEnd(&gADF_Children_Names_Timer); - return ; - } /* end if */ - - /** point to the first child wanted **/ -block_offset.block = node.sub_node_table.block ; -block_offset.offset = node.sub_node_table.offset + - (TAG_SIZE + DISK_POINTER_SIZE + - (ADF_NAME_LENGTH + DISK_POINTER_SIZE) * (istart-1)) ; - - /** Return the data for the requested children **/ -for( i=(istart-1); i< MIN(istart-1+imax_num, (int) node.num_sub_nodes); i++ ) { - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Read the sun-node entry table **/ - ADFI_read_sub_node_table_entry( file_index, &block_offset, - &sub_node_table_entry, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Convert the child's name from blank-filled into a C string **/ - ADFI_string_2_C_string( sub_node_table_entry.child_name, - MIN(imax_name_len,ADF_NAME_LENGTH), - &names[(i-(istart-1))*(imax_name_len+1)], - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Increment the disk-pointer and the number of names returned **/ - block_offset.offset += (ADF_NAME_LENGTH + DISK_POINTER_SIZE) ; - *inum_ret = *inum_ret + 1 ; - } /* end for */ - tEnd(&gADF_Children_Names_Timer); -} /* end of ADF_Children_Names */ -/* end of file ADF_Children_Names.c */ -/* file ADF_Children_IDs.c */ -/*********************************************************************** -ADF Children IDs: - -Get Children node IDs of a Node. Return the node IDs of children nodes -directly associated with a parent node. - -ADF_Children_IDs( PID, istart, imax_num, inum_ret, IDs, error_return) -input: const double PID The ID of the Node to use. -input: const int istart The Nth child's name to start with (first is 1). -input: const int imax_num Maximum number of names to return. -output: int *inum_ret The number of names returned. -output: double *IDs The returned node IDs -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -NUMBER_LESS_THAN_MINIMUM -***********************************************************************/ -void ADF_Children_IDs ( - const double PID, - const int istart, - const int imax_num, - int *inum_ret, - double *IDs, - int *error_return ) -{ -int i ; -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -struct SUB_NODE_TABLE_ENTRY sub_node_table_entry ; -double LID ; - -*error_return = NO_ERROR ; - -if( inum_ret == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -*inum_ret = 0 ; - -if( IDs == NULL ) { - *error_return = NULL_NODEID_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( (istart <=0) || (imax_num <= 0) ) { - *error_return = NUMBER_LESS_THAN_MINIMUM ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -tStart(&gADF_Children_IDs_Timer); -ADFI_chase_link( PID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Check for zero children, return if 0 **/ -if( node.num_sub_nodes == 0 ) { - tEnd(&gADF_Children_IDs_Timer); - return ; - } /* end if */ - - /** point to the first child wanted **/ -block_offset.block = node.sub_node_table.block ; -block_offset.offset = node.sub_node_table.offset + - (TAG_SIZE + DISK_POINTER_SIZE + - (ADF_NAME_LENGTH + DISK_POINTER_SIZE) * (istart-1)) ; - - /** Return the data for the requested children **/ -for( i=(istart-1); i< MIN(istart-1+imax_num, (int) node.num_sub_nodes); i++ ) { - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Read the sub-node entry table **/ - ADFI_read_sub_node_table_entry( file_index, &block_offset, - &sub_node_table_entry, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Get the ID from the sub-node table **/ - ADFI_file_block_offset_2_ID( file_index, - sub_node_table_entry.child_location.block, - sub_node_table_entry.child_location.offset, - &IDs[i-(istart-1)], error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Increment the disk-pointer and the number of IDs returned **/ - block_offset.offset += (ADF_NAME_LENGTH + DISK_POINTER_SIZE) ; - *inum_ret = *inum_ret + 1 ; - } /* end for */ - tEnd(&gADF_Children_IDs_Timer); -} /* end of ADF_Children_IDs */ -/* end of file ADF_Children_IDs.c */ -/* file ADF_Create.c */ -/*********************************************************************** -ADF Create: - -Create a Node. Create a new node (not a link-node) as a child of a -given parent. Default values in this new node are: - label=blank, - number of sub-nodes = 0, - data-type = "MT", - number of dimensions = 0, - data = NULL. - -ADF_Create( PID, name, ID, error_return ) -input: const double PID The ID of the parent node, to whom we - are creating a new child node. -input: const char *name The name of the new child. -output: double *ID The ID of the newly created node. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADF_Create( - const double PID, - const char *name, - double *ID, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER parent_block_offset, child_block_offset ; -struct DISK_POINTER sub_node_entry_location ; -struct NODE_HEADER parent_node, child_node ; -struct SUB_NODE_TABLE_ENTRY sub_node_entry ; -int i, name_length, name_start, found ; -double LID ; - - tStart(&gADF_Create_Node_Timer); -ADFI_check_string_length( name, ADF_NAME_LENGTH, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( ID == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -printf("-------- ADF_Create(%s) ----------- \n", name); - - tStart(&gADF_Create_Node_Prep_Timer); -ADFI_chase_link( PID, &LID, &file_index, &parent_block_offset, - &parent_node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - - /** Initialize node header **/ -ADFI_fill_initial_node_header( &child_node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Skip any leading blanks in the name **/ -name_start = 0 ; -while( name[ name_start ] == ' ' ) { - name_start++ ; - } /* end while */ -name_length = strlen( &name[ name_start ] ) ; -if( name_length > ADF_NAME_LENGTH ) { - *error_return = STRING_LENGTH_TOO_BIG ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Check for uniqueness and legality of the name **/ -ADFI_check_4_child_name( file_index, &parent_block_offset, - &name[ name_start ], &found, &sub_node_entry_location, - &sub_node_entry, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -if( found == 1 ) { - *error_return = DUPLICATE_CHILD_NAME ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -for ( i=0; i < name_length; i++ ) { - if ( ! isprint ( name[ name_start + i ] ) || - name[ name_start + i ] == '/' ) { - *error_return = INVALID_NODE_NAME; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - } /* end for */ - tEnd(&gADF_Create_Node_Prep_Timer); - - /** Assign the name to the new node **/ -tStart(&gADF_Create_Node_Write_Timer); -strncpy( child_node.name, &name[ name_start ], name_length ) ; - - /** Allocate disk space for the new node **/ -ADFI_file_malloc( file_index, NODE_HEADER_SIZE, &child_block_offset, - error_return ) ; - printf("fmalloc child node: (%d, %d)\n", child_block_offset.block, - child_block_offset.offset); -CHECK_ADF_ABORT( *error_return ) ; - - /** Update the list of children for the parent... **/ -tStart(&gADF_Create_Node_After_Timer); -ADFI_add_2_sub_node_table( file_index, &parent_block_offset, - &child_block_offset, /*child_node.name,*/ error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Write out the new node header **/ -ADFI_write_node_header( file_index, &child_block_offset, &child_node, - error_return ) ; -printf("write child header: (%d, %d)\n", child_block_offset.block, - child_block_offset.offset); -CHECK_ADF_ABORT( *error_return ) ; -tEnd(&gADF_Create_Node_Write_Timer); - - /** Return the ID of the new child **/ -ADFI_file_block_offset_2_ID( file_index, child_block_offset.block, - child_block_offset.offset, ID, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -#if !LINUX_NFS_OPT -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -#endif -tEnd(&gADF_Create_Node_After_Timer); -tEnd(&gADF_Create_Node_Timer); -printf("-----------------------\n"); -} /* end of ADF_Create */ -/* end of file ADF_Create.c */ - -/*********************************************************************** -ADF Create with Label: - -Create a Node. Create a new node (not a link-node) as a child of a -given parent. Default values in this new node are: - label=blank, - number of sub-nodes = 0, - data-type = "MT", - number of dimensions = 0, - data = NULL. - -ADF_Create_With_Label( PID, name, const char *label, ID, error_return ) -input: const double PID The ID of the parent node, to whom we - are creating a new child node. -input: const char *name The name of the new child. -input: const char *label The label of the new child. -output: double *ID The ID of the newly created node. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADF_Create_With_Label( - const double PID, - const char *name, - const char *label, - double *ID, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER parent_block_offset, child_block_offset ; -struct DISK_POINTER sub_node_entry_location ; -struct NODE_HEADER parent_node, child_node ; -struct SUB_NODE_TABLE_ENTRY sub_node_entry ; -int i, name_length, label_length, name_start, found; -double LID ; - -tStart(&gADF_Create_Node_With_Label_Timer); -ADFI_check_string_length( name, ADF_NAME_LENGTH, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( ID == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -tStart(&gADF_Create_Node_With_Label_Prep_Timer); -ADFI_chase_link( PID, &LID, &file_index, &parent_block_offset, - &parent_node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - - /** Initialize node header **/ -ADFI_fill_initial_node_header( &child_node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Skip any leading blanks in the name **/ -name_start = 0 ; -while( name[ name_start ] == ' ' ) { - name_start++ ; - } /* end while */ -name_length = strlen( &name[ name_start ] ) ; -if( name_length > ADF_NAME_LENGTH ) { - *error_return = STRING_LENGTH_TOO_BIG ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Check for uniqueness and legality of the name **/ -ADFI_check_4_child_name( file_index, &parent_block_offset, - &name[ name_start ], &found, &sub_node_entry_location, - &sub_node_entry, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -if( found == 1 ) { - *error_return = DUPLICATE_CHILD_NAME ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -for ( i=0; i < name_length; i++ ) { - if ( ! isprint ( name[ name_start + i ] ) || - name[ name_start + i ] == '/' ) { - *error_return = INVALID_NODE_NAME; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - } /* end for */ - tEnd(&gADF_Create_Node_Prep_Timer); - - /** Assign the name to the new node **/ -tStart(&gADF_Create_Node_With_Label_Write_Timer); -strncpy( child_node.name, &name[ name_start ], name_length ) ; - - /** Assign the label **/ -if( label == NULL ) - label_length = 0 ; /* copy none, then blank fill */ -else - label_length = strlen( label ) ; -if( label_length > ADF_LABEL_LENGTH ) { - *error_return = STRING_LENGTH_TOO_BIG ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -for( i=0; i" ) ; - - /** Read the header of the ADF file **/ -if( file_header.tag0[0] == '\0' ) { - ADFI_read_file_header( file_index, &file_header, error_return ) ; - if ( *error_return != NO_ERROR ) goto Open_Error ; - - /** Check Database version numbers for compatibility **/ - if( file_header.what[25] != ADF_D_identification[25] ) { -/* Look at major revision letter: version in file must equal what - this library would write unless there is a policy decision to - support both versions. */ - - *error_return = INVALID_VERSION ; - if ( *error_return != NO_ERROR ) goto Open_Error ; - } /* end if */ - - if( file_header.what[28] == '>' ) - { -/* we have an old file created before this version numbering scheme - was instituted - probably will not work */ - *error_return = INVALID_VERSION ; - if ( *error_return != NO_ERROR ) goto Open_Error ; - } - else /* check version number for file format compatibility */ - { -/* Look at minor revision number: version in file must be less than - or equal to what this library would write. */ - - ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &file_header.what[26], - &file_minor_version, error_return) ; - if ( *error_return != NO_ERROR ) goto Open_Error ; - - ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &ADF_D_identification[26], - &lib_minor_version, error_return) ; - if ( *error_return != NO_ERROR ) goto Open_Error ; - if( file_minor_version > lib_minor_version ) { - *error_return = INVALID_VERSION ; - if ( *error_return != NO_ERROR ) goto Open_Error ; - } /* end if */ - - if( file_minor_version < lib_minor_version ) { - /** If a new feature is added which requires that the file version - be changed then it is done here. Care must be take not to - break forward compatibility by changing the file version. Thus - new features may not be available for older file versions. - For instance version A1 files cannot be upgraded to version - A2 and above since a change was made to how links were store - and the file version is used to decide how to treat links. **/ - if ( ADF_D_identification[25] == 'A' && file_minor_version > 1 ) { - ADFI_remember_version_update( file_index, ADF_D_identification, - error_return ) ; - - if ( *error_return != NO_ERROR ) goto Open_Error ; - } /* end if */ - - /** The link separator was changed from " " to ">" in order - to support blanks in filenames under Windows. This change - is for version A02 and higher **/ - if ( ADF_D_identification[25] == 'A' && file_minor_version < 2 ) { - strcpy ( link_separator[file_index], " " ) ; - } /* end if */ - - } /* end if */ - } /* end if */ - } /* end if */ - - /** get the root ID for the user **/ -ADFI_file_block_offset_2_ID( file_index, file_header.root_node.block, - file_header.root_node.offset, Root_ID, error_return ) ; -if ( *error_return != NO_ERROR ) goto Open_Error ; - - /** Remember the file's data format **/ -ADFI_remember_file_format( file_index, file_header.numeric_format, - file_header.os_size, error_return ) ; -if ( *error_return != NO_ERROR ) goto Open_Error ; - - /** check machine modes, if machine is native the file must be !! **/ -ADFI_file_and_machine_compare( file_index, NULL, &formats_compare, - error_return ) ; -if ( *error_return != NO_ERROR ) goto Open_Error ; - -tEnd(&gADF_Database_Open_Timer); - return ; - - Open_Error: - /** Close the ADF file and free its index **/ -ADFI_close_file( file_index, &error_dummy ) ; -CHECK_ADF_ABORT( *error_return ) ; -tEnd(&gADF_Database_Open_Timer); - -} /* end of ADF_Database_Open */ -/* end of file ADF_Database_Open.c */ -/* file ADF_Database_Set_Format.c */ -/*********************************************************************** -ADF Database Set Format: - -Set the data format used in an existing database. - Note: Use with extreme caution. Needed only - for data conversion utilities and NOT intended - for the general user!!! - -ADF_Database_Set_Format( Root_ID, format, error_return ) -input: const double Root_ID The root_ID if the ADF file. -input: const char *format See format for ADFDOPN. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Database_Set_Format( - const double Root_ID, - const char *format, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct FILE_HEADER file_header ; -char machine_format, format_to_use, os_to_use ; - -tStart(&gADF_Database_Set_Format_Timer); -ADFI_check_string_length( format, ADF_FORMAT_LENGTH, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( Root_ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get node_header for the node **/ -ADFI_read_file_header( file_index, &file_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_figure_machine_format( format, &machine_format, &format_to_use, - &os_to_use, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -file_header.numeric_format = format_to_use ; -file_header.os_size = os_to_use ; - - /** Get modification date to be updated with the header **/ -ADFI_get_current_date ( file_header.modification_date ); - - /** Now write the disk header out... **/ -ADFI_write_file_header( file_index, &file_header, /*1,*/ error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_remember_file_format( file_index, format_to_use, os_to_use, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -tEnd(&gADF_Database_Set_Format_Timer); -} /* end of ADF_Database_Set_Format */ -/* end of file ADF_Database_Set_Format.c */ -/* file ADF_Database_Version.c */ -/*********************************************************************** -ADF Database Version: - -Get ADF File Version ID. This is the version number of the ADF library -routines which created an ADF database. Modified ADF databases -will take on the version ID of the current ADF library version if -it is higher than the version indicated in the file. - The format of the version ID is: "ADF Database Version 000.01" - -ADF_Database_Version( Root_ID, version, creation_date, modification_date, - error_return ) -input: const double Root_ID The ID of the root node in the ADF file. -output: char *version A 32-byte character string containing the - version ID. -output: char *creation_date A 32-byte character string containing the - creation date of the file. -output: char *modification_date A 32-byte character string containing the - last modification date of the file. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Database_Version( - const double Root_ID, - char *version, - char *creation_date, - char *modification_date, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct FILE_HEADER file_header ; - -if( (version == NULL) || (creation_date == NULL) || - (modification_date == NULL) ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -tStart(&gADF_Database_Version_Timer); - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( Root_ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get node_header for the node **/ -ADFI_read_file_header( file_index, &file_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -*error_return = NO_ERROR ; - /** Convert the "what" string into a C string **/ -ADFI_string_2_C_string( &file_header.what[4], strcspn ( file_header.what, ">" ) - 4, - version, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Convert the creation date string into a C string **/ -ADFI_string_2_C_string( file_header.creation_date, 28, - creation_date, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Convert the modification date string into a C string **/ -ADFI_string_2_C_string( file_header.modification_date, 28, - modification_date, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -tEnd(&gADF_Database_Version_Timer); -} /* end of ADF_Database_Version */ -/* end of file ADF_Database_Version.c */ -/* file ADF_Delete.c */ -/*********************************************************************** -ADF Delete: - -Delete a Node. If the node is NOT a link, then the specified node and all -sub-nodes anywhere under it are also deleted. For a link, and also -for links farther down in the tree, the link-node will be deleted, -but the node which the link is linked to is not affected. When a -node is deleted, other link-nodes which point to it are left -dangling. For example, if N13 is deleted, then L1 and L2 point to a -non-existing node. This is OK until L1 and L2 are used. - -ADF_Delete( PID, ID, error_return ) -input: const double PID The ID of the node's parent. -input: const double ID The ID of the node to use. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Delete( - const double PID, - const double ID, - int *error_return ) -{ -int num_ids , i, link_path_length ; -double *ids ; -unsigned int file_index ; -struct DISK_POINTER parent ; -struct DISK_POINTER child ; -struct NODE_HEADER node_header ; - - /** Don't use ADFI_chase_link() - delete link nodes but NOT the - nodes they are linked too **/ - -tStart(&gADF_Delete_Timer); -ADFI_ID_2_file_block_offset( ID, &file_index, &child.block, &child.offset, - error_return ) ; - -CHECK_ADF_ABORT( *error_return ) ; - -ADF_Is_Link( ID, &link_path_length, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_read_node_header( file_index, &child, &node_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Delete node data **/ - -if( link_path_length > 0 ) { /** this node IS a link **/ - /** Delete the link path data for this node **/ - ADFI_delete_data( file_index, &node_header, error_return ) ; - } -else { /** this node is NOT a link **/ - - /** Recursively delete all sub-nodes (children) of this node **/ - ADFI_get_direct_children_ids( file_index, &child, &num_ids, &ids, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - for( i=0; i 0 ) { - free( ids ) ; - } /* end if */ - - /** Delete all data for this node **/ - - ADF_Put_Dimension_Information( ID, "MT", 0, (int *)0, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if-else */ - - - /** Disassociate node from parent **/ -ADFI_ID_2_file_block_offset( PID, &file_index, - &parent.block, &parent.offset, error_return ) ; - /* file_index should be same as before since parent and child - should be in the same file */ -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_delete_from_sub_node_table( file_index, &parent, &child, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Delete this node's sub node table **/ -if( node_header.entries_for_sub_nodes > 0 ) { - ADFI_delete_sub_node_table( file_index, &node_header.sub_node_table, - node_header.entries_for_sub_nodes, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Delete node header from disk **/ -ADFI_file_free( file_index, &child, 0, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -#if !LINUX_NFS_OPT -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -#endif - -tEnd(&gADF_Delete_Timer); -} /* end of ADF_Delete */ -/* end of file ADF_Delete.c */ -/* file ADF_Error_Message.c */ -/*********************************************************************** -ADF Error message: - -Return Error Message. Given an error_return from an ADF routine, -get a textual description of the error. - -ADF_Error_Message( error_return, error_string ) -input: const int error_return An ADF-generated error code. -output: char *error_string An 80-byte description of the specified error. - If the number is NULL, then print out error message. -***********************************************************************/ -void ADF_Error_Message( - const int error_return_input, - char *error_string ) -{ -char err_msg_str[ADF_MAX_ERROR_STR_LENGTH+1] ; - - /** If return pointer is NULL, print message to stdout **/ -if( error_string == NULL ) { - ADF_Error_Message( error_return_input, err_msg_str ) ; - fprintf(stderr,"%s\n", err_msg_str ) ; - return ; - } /* end if */ - - /** NO_ERROR is NOT zero for pointer-assignment checking **/ -if( error_return_input == NO_ERROR ) { - strcpy( error_string, ADF_error_string[ 0 ] ) ; - } /* end if */ - /** Check range of error code **/ -else if( (error_return_input <= 0) || - ((unsigned)error_return_input >= sizeof( ADF_error_string )/sizeof(char *) - 1 ) ) { - sprintf( error_string, "ADF: Unrecognized error number %d.", - error_return_input ) ; - } /* end else if */ - /** Error-code good, copy it for the user **/ -else { - strcpy( error_string, ADF_error_string[error_return_input] ) ; - } /* end else */ -} /* end of ADF_Error_Message */ -/* end of file ADF_Error_Message.c */ -/* file ADF_Flush_to_Disk.c */ -/*********************************************************************** -ADF Flush to Disk: - -Flush data to disk. This routine is used force any modified information -to be flushed to the physical disk. This ensures that data will not -be lost if a program aborts. This control of when to flush all data -to disk is provided to the user rather than to flush the data every -time it is modified, which would result in reduced performance. - -ADF_Flush_to_Disk( ID, error_return ) -input: const double ID The ID of a node in the ADF file to flush. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Flush_to_Disk( - const double ID, - int *error_return ) -{ -double LID ; -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; - - ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - ADFI_fflush_file( file_index, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; -} /* end of ADF_Flush_to_Disk */ -/* end of file ADF_Flush_to_Disk.c */ -/* file ADF_Get_Data_Type.c */ -/*********************************************************************** -ADF Get Data Type: - -Get Data Type. Return the 32 character string in a node's data-type field. -In C, the name will be null terminated after the last non-blank character. -A maximum of 33 characters may be used (32 for the name plus 1 for the null). - -ADF_Get_Data_Type( ID, data_type, error_return ) -input: const double ID The ID of the node to use. -output: char *data_type The 32-character data-type of the node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Data_Type( - const double ID, - char *data_type, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -double LID ; - -if( data_type == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -tStart(&gADF_Get_Data_Type_Timer); -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Copy the blank-filled data-type into a C string **/ -ADFI_string_2_C_string( node.data_type, ADF_DATA_TYPE_LENGTH, data_type, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -tEnd(&gADF_Get_Data_Type_Timer); - -} /* end of ADF_Get_Data_Type */ -/* end of file ADF_Get_Data_Type.c */ -/* file ADF_Get_Dimension_Values.c */ -/*********************************************************************** -ADF Get Dimension Values: - -Get Dimension Values. Return the dimension values for a node. Values -will be in the range of 1 to 100,000. Values will only be returned -for the number of dimensions defined in the node. If the number -of dimensions for the node is zero, an error is returned. - -ADF_Get_Dimension_Values( ID, dim_vals, error_return ) -input: const double ID The ID of the node to use. -output: int dim_vals[] Array for returned dimension values. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Dimension_Values( - const double ID, - int dim_vals[], - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -int i ; -double LID ; - -if( dim_vals == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -tStart(&gADF_Get_Dimension_Values_Timer); -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Check for zero dimensions **/ -if( node.number_of_dimensions == 0 ) { - *error_return = ZERO_DIMENSIONS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Check for too-large-of dimensions **/ -if( node.number_of_dimensions > ADF_MAX_DIMENSIONS ) { - *error_return = BAD_NUMBER_OF_DIMENSIONS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Copy the dimension information **/ -for( i=0; i<(int)node.number_of_dimensions; i++ ) - dim_vals[i] = node.dimension_values[i] ; - -tEnd(&gADF_Get_Dimension_Values_Timer); -} /* end of ADF_Get_Dimension_Values */ -/* end of file ADF_Get_Dimension_Values.c */ -/* file ADF_Get_Error_State.c */ -/*********************************************************************** -ADF Get Error State: - -Get Error State. Return the current error state. - -ADF_Get_Error_State( error_state, error_return ) -output: int *error_state Flag for ABORT on error (1) or return error - status (0). -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Error_State( - int *error_state, - int *error_return ) -{ -if( error_state == 0L ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -if( ADF_abort_on_error == TRUE ) - *error_state = 1 ; -else - *error_state = 0 ; - -} /* end of ADF_Get_Error_State */ -/* end of file ADF_Get_Error_State.c */ -/* file ADF_Get_Label.c */ -/*********************************************************************** -ADF Get Label: - -Return the 32 character string in a node's label field. - -ADF_Get_Label( ID, label, error_return ) -input: const double ID The ID of the node to use. -output: char *label The 32-character label of the node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Label( - const double ID, - char *label, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -double LID ; - -if( label == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -tStart(&gADF_Get_Label_Timer); -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Copy the blank-filled label type into a C string **/ -ADFI_string_2_C_string( node.label, ADF_LABEL_LENGTH, label, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -tEnd(&gADF_Get_Label_Timer); -} /* end of ADF_Get_Label */ -/* end of file ADF_Get_Label.c */ -/* file ADF_Get_Link_Path.c */ -/*********************************************************************** -ADF Get Link path: - -Get path information from a link. If the node is a link-node, return -the path information. Else, return an error. If the link is in the same -file, then the filename returned is zero length. - -ADF_Get_Link_Path( ID, file, name_in_file, error_return ) -input: const double ID The ID of the node to use. -output: char *file The returned filename -output: char *name_in_file The returned name of node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Link_Path( - const double ID, - char *file, - char *name_in_file, - int *error_return ) -{ -unsigned int file_index ; -int file_bytes, machine_bytes, total_bytes ; -char file_format, machine_format ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node_header ; -struct TOKENIZED_DATA_TYPE tokenized_data_type[ 2 ] ; -char link_data[ADF_FILENAME_LENGTH + ADF_MAX_LINK_DATA_SIZE + 1 + 1] ; -size_t lenfilename ; - -if( file == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( name_in_file == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -tStart(&gADF_Get_Link_Path_Timer); - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get node_header for the node **/ -ADFI_read_node_header( file_index, &block_offset, &node_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( (node_header.data_type[0] != 'L') || (node_header.data_type[1] != 'K')) { - *error_return = NODE_IS_NOT_A_LINK ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Get tokenized datatype **/ -ADFI_evaluate_datatype( file_index, node_header.data_type, - &file_bytes, &machine_bytes, tokenized_data_type, - &file_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -total_bytes = file_bytes * node_header.dimension_values[0] ; -ADFI_read_data_chunk( file_index, &node_header.data_chunks, - tokenized_data_type, file_bytes, total_bytes, - 0, total_bytes, link_data, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /* NULL terminate the string */ -link_data[ node_header.dimension_values[0] ] = '\0' ; - -file[0] = '\0' ; -name_in_file[0] = '\0' ; - - /** look for file/link delimiter **/ -lenfilename = strcspn ( link_data, link_separator[file_index] ) ; - -if ( lenfilename == 0 ) /** no filename **/ -{ - strcpy( name_in_file, &link_data[1] ); -} -else if ( lenfilename > 0 && lenfilename == strlen( link_data ) ) -{ - strcpy( file, link_data) ; /** no link ? **/ -} -else -{ - strncpy( file, link_data, lenfilename) ; - file[lenfilename] = '\0'; - strcpy( name_in_file, &link_data[lenfilename+1] ); -} /* end if */ - -tEnd(&gADF_Get_Link_Path_Timer); -} /* end of ADF_Get_Link_Path */ -/* end of file ADF_Get_Link_Path.c */ -/* file ADF_Get_Name.c */ -/*********************************************************************** -ADF get name: - -Get Name of a Node. Given a node's ID, return the 32 character name of -that node. - -ADF_Get_Name( ID, name, error_return ) -input: const double ID The ID of the node to use. -output: char *name The simple name of the node (no path info). -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Name( - const double ID, - char *name, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; - -if( name == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - -tStart(&gADF_Get_Name_Timer); -*error_return = NO_ERROR ; - - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get node_header for the node **/ -ADFI_read_node_header( file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Copy the blank-filled name into a C string **/ -ADFI_string_2_C_string( node.name, ADF_NAME_LENGTH, name, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -tEnd(&gADF_Get_Name_Timer); -} /* end of ADF_Get_Name */ -/* end of file ADF_Get_Name.c */ -/* file ADF_Get_Node_ID.c */ -/*********************************************************************** -ADF get Node ID: - -Get Unique-Identifier of a Node. Given a parent node ID and a name of -a child node, this routine returns the ID of the child. If the child -node is a link, the ID of the link node is returned (not the ID of the -linked-to node) - otherwise there would be no way to obtain the ID -of a link node. - -The child name may be a simple name or a compound path name. -If the name is a compound path name and it begins with a '/', -then the parent node ID may be any valid ID in the same database -as the first node in the path. If the name is only "/" and the -parent ID is any valid ID in the database, the root ID is returned. -If the name is a compound path name and does not begin with a '/', -then the parent node ID is the ID of the parent of the first node -in the path. If the path name contains a link node (except for -the ending leaf node), then the link is followed. - - -ADF_Get_Node_ID( PID, name, ID, error_return ) -input: const double PID The ID of name's parent. -input: const char *name The name of the node. Compound - names including path information use a slash "/" notation between - node names. If a leading slash is used, then PID can be any - valid node ID in the ADF database of the first name in the path. - -output: double *ID The ID of the named node. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADF_Get_Node_ID( - const double PID, - const char *name, - double *ID, - int *error_return ) -{ -double LID ; -int found ; -int name_length ; -unsigned int file_index ; -struct DISK_POINTER parent_block_offset, sub_node_entry_location ; -struct SUB_NODE_TABLE_ENTRY sub_node_entry ; -struct NODE_HEADER node_header ; -char *name_tmp, *name_ptr, *name_pos ; - -if( name == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -name_length = strlen( name ) ; -if( name_length == 0 ) { - *error_return = STRING_LENGTH_ZERO ; - return ; - } /* end if */ - -if( ID == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -tStart(&gADF_Get_Node_ID_Timer); -*error_return = NO_ERROR ; - -*ID = PID ; /** initialize the ID variable to use in intermediate steps **/ - -if( name[0] == '/' ) { /** start at the root node **/ - /** according to user documentation, PID can be any valid node - in the database, but we need to use it to get the root ID - in order to start at the top **/ - - ADF_Get_Root_ID( PID, ID, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** This is the root-node, return the Root-ID **/ - if( name[ 1 ] == '\0' ) { - return ; /** NOT an error, just done and need to get out **/ - } /* end if */ - } /* end if */ - -name_tmp = (char *) malloc( (name_length + 1) * sizeof( char ) ) ; -if( name_tmp == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -strcpy( name_tmp, name ) ; - - /** start search for tokens (names separated by '/') **/ -name_pos = name_tmp ; -name_ptr = ADFI_strtok( name_tmp, &name_pos, "/" ) ; -if( name_ptr == NULL ) { /** this should never happen but check anyway **/ - *error_return = INVALID_NODE_NAME ; - CHECK_ADF_ABORT1( *error_return ) ; - } /* end if */ - - /** Get file-index, etc. to start. Note: Parent ID may be a link **/ -ADFI_chase_link( *ID, &LID, &file_index, - &parent_block_offset, &node_header, error_return ) ; -CHECK_ADF_ABORT1( *error_return ) ; -*ID = LID ; - - /** Track through the possible compound name string **/ -while( name_ptr ) { - - /** Find this child under the current parent **/ - ADFI_check_4_child_name( file_index, &parent_block_offset, name_ptr, &found, - &sub_node_entry_location, &sub_node_entry, error_return ) ; - CHECK_ADF_ABORT1( *error_return ) ; - - if( found == 0 ) { /** Child NOT found **/ - *error_return = CHILD_NOT_OF_GIVEN_PARENT ; - CHECK_ADF_ABORT1( *error_return ) ; - } /* end if */ - - /** create the child ID **/ - ADFI_file_block_offset_2_ID( file_index, - sub_node_entry.child_location.block, - sub_node_entry.child_location.offset, ID, error_return ) ; - - /** Get the next node-name token (NULL if no more). This is needed - for the while-loop check and normally would be done at the - end of the loop, but it is useful in the next step to see if - there are any more branches in the path. **/ - name_ptr = ADFI_strtok( name_tmp, &name_pos, "/" ) ; - - /** If this node is the last in the path it may be a link, but - there needs to be a mechanism by which a link's ID can - be determined and so we cannot follow the link at this time. **/ - if( name_ptr != NULL ) { - /* Make sure we have a real ID so we can continue the search */ - ADFI_chase_link( *ID, &LID, &file_index, &parent_block_offset, - &node_header, error_return ) ; - CHECK_ADF_ABORT1( *error_return ) ; - *ID = LID ; - - /** This child now becomes the parent. Do it again... **/ - ADFI_ID_2_file_block_offset( *ID, &file_index, - &parent_block_offset.block, - &parent_block_offset.offset, - error_return ) ; - CHECK_ADF_ABORT1( *error_return ) ; - } /* end if */ - - } /* end while */ - -free( name_tmp ) ; -tEnd(&gADF_Get_Node_ID_Timer); - -} /* end of ADF_Get_Node_ID */ -/* end of file ADF_Get_Node_ID.c */ -/* file ADF_Get_Number_of_Dimensions.c */ -/*********************************************************************** -ADF Get Number of Dimensions: - -Get Number of Dimensions. Return the number of data dimensions -used in a node. Valid values are from 0 to 12. - -ADF_Get_Number_of_Dimensions( ID, num_dims, error_return) -input: const double ID The ID of the node to use. -output: int *num_dims The returned number of dimensions. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Number_of_Dimensions( - const double ID, - int *num_dims, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -double LID ; - -if( num_dims == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -tStart(&gADF_Get_Number_of_Dimensions_Timer); -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, - &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Return the number of dimensions **/ -*num_dims = node.number_of_dimensions ; - -tEnd(&gADF_Get_Number_of_Dimensions_Timer); -} /* end of ADF_Get_Number_of_Dimensions */ -/* end of file ADF_Get_Number_of_Dimensions.c */ -/* file ADF_Get_Root_ID.c */ -/*********************************************************************** -ADF_Get_Root_ID: - Get root-ID for an ADF system from any ID in the system. - -input: const double ID The ID of the node to use. -output: *double Root_ID The returned ID of the root node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Root_ID( - const double ID, - double *Root_ID, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct FILE_HEADER file_header ; - -if( Root_ID == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -tStart(&gADF_Get_Root_ID_Timer); -*error_return = NO_ERROR ; - - /** Get the file ID **/ -ADFI_ID_2_file_block_offset( ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Use the file header to find the root ID **/ -ADFI_read_file_header( file_index, &file_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Format the root ID **/ -ADFI_file_block_offset_2_ID( file_index, file_header.root_node.block, - file_header.root_node.offset, Root_ID, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -tEnd(&gADF_Get_Root_ID_Timer); -} /* end of ADF_Get_Root_ID */ -/* end of file ADF_Get_Root_ID.c */ -/* file ADF_Is_Link.c */ -/*********************************************************************** -ADF Is Link: - -Test if a Node is a link. If the actual data-type of the node is "LK" -(created with ADF_Link), return the link path length. Otherwise, -return 0. - -ADF_Is_Link( ID, link_path_length, error_return ) -input: const double ID The ID of the node to use. -output: int *link_path_length 0 if the node is NOT a link. If the - node is a link, the length of the path string is returned. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Is_Link( - const double ID, - int *link_path_length, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node_header ; - -if( link_path_length == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -tStart(&gADF_Is_Link_Timer); - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get node_header for the node **/ -ADFI_read_node_header( file_index, &block_offset, &node_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( (node_header.data_type[0] == 'L') && (node_header.data_type[1] == 'K')) - *link_path_length = node_header.dimension_values[0] ; -else - *link_path_length = 0 ; - -tEnd(&gADF_Is_Link_Timer); -} /* end of ADF_Is_Link */ -/* end of file ADF_Is_Link.c */ -/* file ADF_Library_Version.c */ -/*********************************************************************** -ADF Library Version: - -Get ADF Library Version ID. This is the version number of the ADF -library routines which your program is currently using. - The format of the version ID is: "ADF Library Version 000.01" - -ADF_Library_Version( version, error_return ) -output: char *version A 32-byte character string containing - the ADF Library version ID information. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Library_Version( - char *version, - int *error_return ) -{ - -int lversion; - -if( version == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Copy the proper portion of the "what" string **/ -strcpy ( version, &ADF_L_identification[4] ) ; -lversion = strlen ( version ) ; -version[lversion-1] = '\0' ; /** remove trailing "what" delimiter ('>') **/ -} /* end of ADF_Library_Version */ -/* end of file ADF_Library_Version.c */ -/* file ADF_Link.c */ -/*********************************************************************** -ADF Link: - -Create a link. Note: The Node linked to does not have to exist when the -link is created (but it may exist and that is OK). However, when -the link is used, an error will occur if the linked to node does not -exist. - -ADF_Link( PID, name, file, name_in_file, ID, error_return ) -input: const double PID The ID of the Node's parent. -input: const char *name The name of the link node. -input: const char *file The filename to use for the link (directly - usable by a C open() routine). If blank (null), - the link will be within the same file. - -input: const char *name_in_file The name of the node which - the link will point to. This can be a simple or compound name. - -output: double ID The returned ID of the link-node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Link( - const double PID, - const char *name, - const char *file_name, - const char *name_in_file, - double *ID, - int *error_return ) -{ -char link_data[ADF_FILENAME_LENGTH + - ADF_MAX_LINK_DATA_SIZE + 2] ; -int null_filename = FALSE ; -int filename_length, linked_to_length, data_length ; -int dim_vals[1] ; -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node_header ; - - /** Don't check file since it can be a NULL pointer **/ - -ADFI_check_string_length( name, ADF_NAME_LENGTH, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_check_string_length( name_in_file, ADF_MAX_LINK_DATA_SIZE, error_return ); -CHECK_ADF_ABORT( *error_return ) ; - -ADF_Is_Link( PID, &linked_to_length, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -if ( linked_to_length > 0 ) { - *error_return = LINKS_TOO_DEEP ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Create the node in the normal way **/ -ADF_Create( PID, name, ID, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( *ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Add the file and linked-to name as data in the child **/ -ADFI_check_string_length( file_name, ADF_FILENAME_LENGTH, error_return ) ; -if( *error_return != NO_ERROR ) { - null_filename = TRUE ; - filename_length = 0 ; - } /* end if */ -else { - filename_length = strlen( file_name) ; - } /* end else */ -linked_to_length = strlen( name_in_file ) ; - -data_length = filename_length + linked_to_length + 1 ; -if( data_length > ADF_FILENAME_LENGTH + ADF_MAX_LINK_DATA_SIZE + 1 ) { - *error_return = STRING_LENGTH_TOO_BIG ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( null_filename == TRUE ) { - sprintf( link_data, "%s%s", link_separator[file_index], name_in_file ) ; - } /* end if */ -else { - sprintf( link_data, "%s%s%s", file_name, link_separator[file_index], - name_in_file ) ; - } /* end else */ - - /** We must use a datatype of "C1" to put the data into this node. - With a datatype of "Lk" (a link), the written data will go - into the linked-to node (that's the whole point). To set - this up we must be careful... - **/ -dim_vals[0] = data_length ; -ADF_Put_Dimension_Information( *ID, "C1", 1, dim_vals, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADF_Write_All_Data( *ID, link_data, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Change the datatype to be LK, without deleting the data. - We can't use ADF_Put_Dimension_Information since the change - of datatype will delete the data. We must do this manually. - **/ - -ADFI_read_node_header( file_index, &block_offset, &node_header, error_return ); -CHECK_ADF_ABORT( *error_return ) ; - -if( (node_header.data_type[0] != 'C') || (node_header.data_type[1] != '1') || - (node_header.data_type[2] != ' ') ) { - *error_return = INVALID_DATA_TYPE ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -node_header.data_type[0] = 'L' ; -node_header.data_type[1] = 'K' ; -ADFI_write_node_header( file_index, &block_offset, &node_header, error_return ); -CHECK_ADF_ABORT( *error_return ) ; - -#if !LINUX_NFS_OPT -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -#endif - -} /* end of ADF_Link */ -/* end of file ADF_Link.c */ -/* file ADF_Move_Child.c */ -/*********************************************************************** -ADF Move Child: - -Change Parent (move a Child Node). The node and the 2 parents must -all exist within a single ADF file. If the node is pointed to by a -link-node, changing the node's parent will break the link. - -ADF_Move_Child( PID, ID, NPID, error_return ) -input: double PID The ID of the Node's parent. -input: double ID The ID of the node to use. -input: double NPID The ID of the Node's New Parent -output: int *error_return Error return. -***********************************************************************/ -void ADF_Move_Child( - const double PID, - const double ID, - const double NPID, - int *error_return ) -{ - -unsigned int parent_file_index, child_file_index, - new_parent_file_index, file_index ; -char child_name[ ADF_NAME_LENGTH ] ; -int found ; -struct DISK_POINTER parent, child, new_parent, sub_node_entry_location ; -struct SUB_NODE_TABLE_ENTRY sub_node_entry ; - -*error_return = NO_ERROR ; - -ADFI_ID_2_file_block_offset( PID, &parent_file_index, &parent.block, - &parent.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_ID_2_file_block_offset( ID, &child_file_index, &child.block, - &child.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( child_file_index != parent_file_index ) { - *error_return = NODES_NOT_IN_SAME_FILE ; - CHECK_ADF_ABORT( *error_return ) ; - } - -ADFI_ID_2_file_block_offset( NPID, &new_parent_file_index, &new_parent.block, - &new_parent.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( new_parent_file_index != parent_file_index ) { - *error_return = NODES_NOT_IN_SAME_FILE ; - CHECK_ADF_ABORT( *error_return ) ; - } - -file_index = parent_file_index ; /* use a shorter, more generic name - - file indices should now be the same - for all 3 nodes */ - - /** check that child is really a child of parent **/ -ADF_Get_Name( ID, child_name, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_check_4_child_name( file_index, &parent, child_name, &found, - &sub_node_entry_location, &sub_node_entry, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( found == 0 ) { /* child not found */ - *error_return = CHILD_NOT_OF_GIVEN_PARENT ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** add child to its new parent's sub node table **/ -ADFI_add_2_sub_node_table( file_index, &new_parent, &child, /*child_name,*/ - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** remove child from its old parent's sub node table **/ -ADFI_delete_from_sub_node_table( file_index, &parent, &child, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Move_Child */ -/* end of file ADF_Move_Child.c */ -/* file ADF_Number_of_Children.c */ -/*********************************************************************** -ADF Number of Children; - -Get Number of Children of a Node. Return the number of children -nodes directly associated with a parent node. - -ADF_Number_of_Children( ID, num_children, error_return ) -input: const double ID The ID of the node to use. -output: int *num_children The number of children directly - associated with this node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Number_of_Children( - const double ID, - int *num_children, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -double LID ; - -if( num_children == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -tStart(&gADF_Number_of_Children_Timer); -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Return the number of children **/ -*num_children = node.num_sub_nodes ; -tEnd(&gADF_Number_of_Children_Timer); -} /* end of ADF_Number_of_Children */ -/* end of file ADF_Number_of_Children.c */ -/* file ADF_Put_Dimension_Information.c */ -/*********************************************************************** -ADF Put Dimension Information: - -Set/change the data-type and Dimension Information of a Node. Valid -user-definable data-types are: - -No data MT -Integer 32 I4 -Integer 64 I8 -Unsigned Int 32 U4 -Unsigned Int 64 U8 -Real 32 R4 -Real 64 R8 -Complex 64 X4 -Complex 128 X8 -Character (unsigned byte) C1 -Byte (unsigned byte) B1 -Compound data-types can be used which combine types -("I4,I4,R8"), define an array ("I4[25]"), or a combination of these -("I4,C1[20],R8[3]"). -dims can be a number from 0 to 12. - -dim_vals is an array of integers. The number of integers used is -determined by the dims argument. If dims is zero, the dim_values -are not used. Valid range for dim_values are from 1 to 2,147,483,648. -The total data size, calculated by the data-type-size times the -dimension value(s), cannot exceed 2,147,483,648. - -Note: When this routine is called and the data-type or the -number of dimensions changes, any data currently associated -with the node is lost!! The dimension values can be changed and -the data space will be extended as needed. - -ADF_Put_Dimension_Information( ID, data_type, dims, dim_vals, error_return ) -input: const double ID The ID of the node. -input: const char *data-type The data-type to use. -input: const int dims The number of dimensions this node has. -input: const int dim_vals[] The dimension values for this node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Put_Dimension_Information( - const double ID, - const char *data_type, - const int dims, - const int dim_vals[], - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -struct TOKENIZED_DATA_TYPE - tokenized_data_type[ 1 + (ADF_DATA_TYPE_LENGTH + 1)/3 ] ; -char file_format, machine_format ; -int file_bytes[2], machine_bytes[2] ; -int data_bytes, old_data_bytes ; -int i, datatype_length ; -int preserve_data = FALSE ; -double LID ; - -tStart(&gADF_Put_Dimension_Information_Timer); -ADFI_check_string_length( data_type, ADF_DATA_TYPE_LENGTH, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( dim_vals == NULL && dims > 0 ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Check new datatype **/ -ADFI_evaluate_datatype( file_index, data_type, - &file_bytes[0], &machine_bytes[0], - tokenized_data_type, &file_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Look at old datatype **/ -ADFI_evaluate_datatype( file_index, node.data_type, - &file_bytes[1], &machine_bytes[1], - tokenized_data_type, &file_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Calculate new data-size **/ -if( dims < 0 ) { - *error_return = NUMBER_LESS_THAN_MINIMUM ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -if( dims > ADF_MAX_DIMENSIONS) { - *error_return = BAD_NUMBER_OF_DIMENSIONS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** If the number of dimensions is zero, set data-bytes to zero **/ -if( dims == 0 ) - data_bytes = 0 ; -else { /** Calculate the total number of bytes in the data **/ - for( data_bytes=file_bytes[0], i=0; i ADF_NAME_LENGTH ) { - *error_return = STRING_LENGTH_TOO_BIG ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( name_length == 0 ) { - *error_return = STRING_LENGTH_ZERO ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Need to check for uniqueness and legality of the name **/ -ADFI_check_4_child_name( file_index, &parent_block_offset, - &name[ name_start ], &found, &sub_node_entry_location, - &sub_node_entry, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( found == 1 ) { - *error_return = DUPLICATE_CHILD_NAME ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -for ( i=0; i < name_length; i++ ) { - if ( ! isprint ( name[ name_start + i ] ) || - name[ name_start + i ] == '/' ) { - *error_return = INVALID_NODE_NAME; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - } /* end for */ - - /** Confirm that child is from the parent **/ -ADFI_check_4_child_name( file_index, &parent_block_offset, - child_node.name, &found, &sub_node_entry_location, - &sub_node_entry, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( found == 0 ) { - *error_return = CHILD_NOT_OF_GIVEN_PARENT ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( (child_block_offset.block != sub_node_entry.child_location.block) || - (child_block_offset.offset != sub_node_entry.child_location.offset) ) { - *error_return = CHILD_NOT_OF_GIVEN_PARENT ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Copy the name **/ -name_length = strlen( name ) ; -for( i=0; i total_bytes ) { - bytes_to_read = total_bytes - bytes_read ; - } /* end if */ - if( bytes_to_read == 0 ) - break ; - ADFI_read_data_chunk( file_index, &data_chunk_table[i].start, - tokenized_data_type, file_bytes, bytes_to_read, 0, - bytes_to_read, data_pointer, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - -/** note: memory_bytes and file_bytes might be different (e.g., if machine - is "IEEE_BIG" and file is "CRAY") in which case data pointer advances - at a different rate from file pointer. **/ - data_pointer += (bytes_to_read * memory_bytes) / file_bytes ; - bytes_read += bytes_to_read ; - } /* end for */ - free( data_chunk_table ) ; - if( bytes_read < total_bytes ) { - *error_return = INCOMPLETE_DATA ; - memset( data_pointer, 0, total_bytes - bytes_read ) ; - } /* end if */ - } /* end else */ - -tEnd(&gADF_Read_All_Data_Timer); -} /* end of ADF_Read_All_Data */ -/* end of file ADF_Read_All_Data.c */ -/* file ADF_Read_Block_Data.c */ -/*********************************************************************** -ADF Read Block Data: - -Read a continous block of data from a Node. Reads a block the node's data -and returns it into a contiguous memory space. - -ADF_Read_Block_Data( ID, data, error_return ) -input: const double ID The ID of the node to use. -input: const long b_start The starting point in block in token space -input: const long b_end The ending point in block in token space -output: char *data The start of the data in memory. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Read_Block_Data( - const double ID, - const long b_start, - const long b_end, - char *data, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -struct TOKENIZED_DATA_TYPE - tokenized_data_type[ 1 + (ADF_DATA_TYPE_LENGTH + 1)/3 ] ; -struct DATA_CHUNK_TABLE_ENTRY *data_chunk_table ; -char *data_pointer ; - -char file_format, machine_format ; -int file_bytes, memory_bytes, bytes_to_read ; -long total_bytes, bytes_read, start_offset ; -long chunk_size, chunk_end_byte ; -long start_byte, end_byte, block_bytes ; -int i, j ; -double LID ; - -if( data == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -tStart(&gADF_Read_Block_Data_Timer); -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get datatype size **/ -ADFI_evaluate_datatype( file_index, node.data_type, &file_bytes, &memory_bytes, - tokenized_data_type, &file_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( (file_bytes == 0) || (node.number_of_dimensions == 0) ) { - *error_return = NO_DATA ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Calculate total number of bytes in the data **/ -total_bytes = file_bytes ; -for( j=0; j<(int)node.number_of_dimensions; j++ ) - total_bytes *= node.dimension_values[j] ; -if( total_bytes == 0 ) { - *error_return = ZERO_DIMENSIONS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Calculate the starting and ending range in the file **/ -start_byte = file_bytes * (b_start-1) ; -end_byte = file_bytes * b_end ; -if ( start_byte < 0 || start_byte > end_byte || end_byte > total_bytes ) { - *error_return = START_OUT_OF_DEFINED_RANGE ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -block_bytes = end_byte - start_byte ; - - /** If there is NO DATA, fill data space with zeros, return error **/ -if( node.number_of_data_chunks == 0 ) { - memset( data, 0, block_bytes*memory_bytes/file_bytes ) ; - *error_return = NO_DATA ; - tEnd(&gADF_Read_Block_Data_Timer); - return ; /** NO_DATA is really a warning, so don't check & abort... **/ - } /* end if */ - - /** Read the data from disk **/ -else if( node.number_of_data_chunks == 1 ) { - ADFI_read_data_chunk( file_index, &node.data_chunks, tokenized_data_type, - file_bytes, total_bytes, start_byte, block_bytes, - data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else if */ -else { - /** Allocate memory for the required table space in memory **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( node.number_of_data_chunks * sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Read in the table **/ - ADFI_read_data_chunk_table( file_index, &node.data_chunks, - data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Read data from each entry in the table **/ - bytes_read = 0 ; - chunk_end_byte = 0 ; - data_pointer = data ; - for( i=0; i<(int)node.number_of_data_chunks; i++ ) { - chunk_size = - (data_chunk_table[i].end.block - data_chunk_table[i].start.block) * - DISK_BLOCK_SIZE + - (data_chunk_table[i].end.offset - data_chunk_table[i].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - - /** Check to be sure we don't think the chunk is bigger than it is - (shrinking a data block can cause this) - **/ - if( chunk_end_byte + chunk_size > total_bytes ) { - chunk_size = total_bytes - chunk_end_byte ; - } /* end if */ - if( chunk_size == 0 ) - break ; - - chunk_end_byte += chunk_size ; - - /** If start of block not in this chunk then continue **/ - if ( start_byte > chunk_end_byte ) - continue ; - - /** Set offset into the current chunk **/ - if ( start_byte > (chunk_end_byte - chunk_size) ) - /** The start of the block is inside the current chunk so - adjust the offset to the beginning of the block **/ - start_offset = ( start_byte - (chunk_end_byte-chunk_size) ) ; - else - start_offset = 0 ; - - /** Calculate the number of bytes needed in this chunk **/ - bytes_to_read = chunk_size - start_offset ; - if( bytes_read + bytes_to_read > block_bytes ) { - bytes_to_read = block_bytes - bytes_read ; - } /* end if */ - if( bytes_to_read == 0 || (chunk_end_byte-chunk_size) > end_byte ) - break ; - - ADFI_read_data_chunk( file_index, &data_chunk_table[i].start, - tokenized_data_type, file_bytes, chunk_size, start_offset, - bytes_to_read, data_pointer, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - -/** note: memory_bytes and file_bytes might be different (e.g., if machine - is "IEEE_BIG" and file is "CRAY") in which case data pointer advances - at a different rate from file pointer. **/ - data_pointer += (bytes_to_read * memory_bytes) / file_bytes ; - bytes_read += bytes_to_read ; - } /* end for */ - free( data_chunk_table ) ; - if( bytes_read < block_bytes ) { - *error_return = INCOMPLETE_DATA ; - memset( data_pointer, 0, total_bytes - bytes_read ) ; - } /* end if */ - } /* end else */ - - tEnd(&gADF_Read_Block_Data_Timer); -} /* end of ADF_Read_Block_Data */ -/* end of file ADF_Read_Block_Data.c */ -/* file ADF_Read_Data.c */ -/*********************************************************************** -ADF Read Data: - -Read data from a node, with partial capabilities. The partial -capabilities are both in the node's data and also in memory. -Vectors of integers are used to indicate the data to be accessed -from the node, and another set of integer vectors is used to -describe the memory location for the data. - Note: If the data-type of the node is a compound data-type ("I4[3],R8") -for example, the partial capabilities will access one or more of -these 20-byte data entities. You cannot access a subset of an -occurrence of the data-type. - -ADF_Read_Data( ID, s_start[], s_end[], s_stride[], m_num_dims, - m_dims[], m_start[], m_end[], m_stride[], data, error_return ) -input: const double ID The ID of the node to use. -input: const int s_start[] The starting dimension values to use in - the database (node). -input: const int s_end[] The ending dimension values to use in - the database (node). -input: const int s_stride[] The stride values to use in the database (node). -input: const int m_num_dims The number of dimensions to use in memory. -input: const int m_dims[] The dimensionality to use in memory. -input: const int m_start[] The starting dimension values to use in memory. -input: const int m_end[] The ending dimension values to use in memory. -input: const int m_stride[] The stride values to use in memory. -output: char *data The start of the data in memory. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Read_Data( - const double ID, - const int s_start[], - const int s_end[], - const int s_stride[], - const int m_num_dims, - const int m_dims[], - const int m_start[], - const int m_end[], - const int m_stride[], - char *data, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset, relative_block ; -struct NODE_HEADER node ; -struct TOKENIZED_DATA_TYPE - tokenized_data_type[ 1 + (ADF_DATA_TYPE_LENGTH + 1)/3 ] ; -int current_disk[ADF_MAX_DIMENSIONS] ; -int current_memory[ADF_MAX_DIMENSIONS] ; -unsigned long total_disk_elements, total_memory_elements ; -unsigned long disk_offset, memory_offset ; -char disk_format, machine_format ; -int formats_compare ; -int i ; -int file_bytes = 0 ; -int memory_bytes = 0 ; -int no_data = FALSE ; -double LID ; -unsigned long relative_offset = 0, current_chunk = 0, current_chunk_size = 0, - past_chunk_sizes = 0; -struct DATA_CHUNK_TABLE_ENTRY *data_chunk_table = 0; - -if( (s_start == NULL) || (s_end == NULL) || (s_stride == NULL) || - (m_dims == NULL) || (m_start == NULL) || (m_end == NULL) || - (m_stride == NULL) || (data == NULL) ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -tStart(&gADF_Read_Data_Timer); -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get datatype length **/ -ADFI_evaluate_datatype( file_index, node.data_type, &file_bytes, &memory_bytes, - tokenized_data_type, &disk_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( (file_bytes == 0) || (node.number_of_dimensions == 0) ) { - *error_return = NO_DATA ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -ADFI_count_total_array_points( node.number_of_dimensions, - node.dimension_values, - s_start, s_end, s_stride, - &total_disk_elements, &disk_offset, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_count_total_array_points( (unsigned int)m_num_dims, - (unsigned int *)m_dims, - m_start, m_end, m_stride, - &total_memory_elements, &memory_offset, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( total_disk_elements != total_memory_elements ) { - *error_return = UNEQUAL_MEMORY_AND_DISK_DIMS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -ADFI_file_and_machine_compare( file_index, tokenized_data_type, - &formats_compare, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Check to see if there is actual data to use **/ -if( node.number_of_data_chunks == 0 ) { - no_data = TRUE ; - } /* end if */ - /** Check for multiple data-chunks **/ -else if( node.number_of_data_chunks == 1 ) { /** A single data chunk **/ - /** Point to the start of the data **/ - block_offset.block = node.data_chunks.block ; - block_offset.offset = node.data_chunks.offset + TAG_SIZE + - DISK_POINTER_SIZE + disk_offset * file_bytes ; - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else if */ -else if( node.number_of_data_chunks > 1 ) { /** Multiple data chunks **/ - current_chunk = 0 ; - past_chunk_sizes = 0 ; - relative_offset = disk_offset * file_bytes ; - /** Allocate memory for the required table space in memory **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( node.number_of_data_chunks * sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Read in the table **/ - ADFI_read_data_chunk_table( file_index, &node.data_chunks, - data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - current_chunk_size = (data_chunk_table[ current_chunk ].end.block - - data_chunk_table[ current_chunk ].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[ current_chunk ].end.offset - - data_chunk_table[ current_chunk ].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - - } /* end else if */ - - /** Setup initial indexing **/ -for( i=0; i<(int)node.number_of_dimensions; i++ ) - current_disk[i] = s_start[i] ; -for( i=0; i DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - if( formats_compare ) { - /** Read the data off of disk directly **/ - ADFI_read_file( file_index, block_offset.block, block_offset.offset, - file_bytes, (char *)data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { /** Read and translate data **/ - ADFI_read_data_translated( file_index, block_offset.block, - block_offset.offset, tokenized_data_type, file_bytes, - file_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Increment disk pointers, for the special case of one dimensional - data we will a simple increment to maximize the throught. Thus for - block reads you can temporarily change to 1D for the read to - improve efficiency. Note total size shouldn't change!! **/ - if( (unsigned)i < total_disk_elements - 1 ) { - if ( node.number_of_dimensions == 1 ) { - disk_offset = s_stride[0]; - current_disk[0] += disk_offset; - if ( current_disk[0] > s_end[0] ) current_disk[0] = s_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - node.number_of_dimensions, node.dimension_values, - s_start, s_end, s_stride, current_disk, &disk_offset, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - block_offset.offset += disk_offset * file_bytes ; - if ( block_offset.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - } /* end if */ - } /* end else if */ - else if( node.number_of_data_chunks > 1 ) { /** Multiple data chunks **/ - while( relative_offset >= past_chunk_sizes + current_chunk_size ) { - if( ++current_chunk >= node.number_of_data_chunks ) { - *error_return = INCOMPLETE_DATA ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { - past_chunk_sizes += current_chunk_size ; - current_chunk_size = (data_chunk_table[ current_chunk ].end.block - - data_chunk_table[ current_chunk ].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[ current_chunk ].end.offset - - data_chunk_table[ current_chunk ].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - } /* end else */ - } /* end while */ - - /** Get the data off of disk **/ - relative_block.block = data_chunk_table[ current_chunk ].start.block ; - relative_block.offset = data_chunk_table[ current_chunk ].start.offset + - (TAG_SIZE + DISK_POINTER_SIZE) + - (relative_offset - past_chunk_sizes) ; - if ( relative_block.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &relative_block, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } - - if( formats_compare ) { - /** Read the data off of disk directly **/ - ADFI_read_file( file_index, relative_block.block, relative_block.offset, - file_bytes, (char *)data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { /** Read and translate data **/ - ADFI_read_data_translated( file_index, relative_block.block, - relative_block.offset, tokenized_data_type, file_bytes, - file_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Increment disk pointers **/ - if( (unsigned)i < total_disk_elements - 1 ) { - if ( node.number_of_dimensions == 1 ) { - disk_offset = s_stride[0]; - current_disk[0] += disk_offset; - if ( current_disk[0] > s_end[0] ) current_disk[0] = s_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - node.number_of_dimensions, node.dimension_values, - s_start, s_end, s_stride, current_disk, &disk_offset, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - relative_offset += disk_offset * file_bytes ; - } /* end if */ - } /* end else if */ - - if( (unsigned)i < total_disk_elements - 1 ) { - /** Increment memory pointers **/ - if ( m_num_dims == 1 ) { - memory_offset = m_stride[0]; - current_memory[0] += disk_offset; - if ( current_memory[0] > m_end[0] ) current_memory[0] = m_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - (unsigned int)m_num_dims, (unsigned int* )m_dims, - m_start, m_end, m_stride, - current_memory, &memory_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Adjust data pointer **/ - data += memory_offset * memory_bytes ; - } /* end if */ - } /* end for */ - -if( node.number_of_data_chunks > 1 ) /** Multiple data chunks **/ - free( data_chunk_table ) ; - -tEnd(&gADF_Read_Data_Timer); -} /* end of ADF_Read_Data */ -/* end of file ADF_Read_Data.c */ -/* file ADF_Set_Error_State.c */ -/*********************************************************************** -ADF Set Error State: - -Set Error State. For all ADF calls, set the error handling convention; -either return error codes, or abort the program on an error. The -default state for the ADF interface is to return error codes and NOT abort. - -ADF_Set_Error_State( error_state, error_return ) -input: const int error_state Flag for ABORT on error (1) or return error - status (0). -output: int *error_return Error return. -***********************************************************************/ -void ADF_Set_Error_State( - const int error_state, - int *error_return ) -{ -*error_return = NO_ERROR ; -if( error_state == 0 ) - ADF_abort_on_error = FALSE ; -else if( error_state == 1 ) - ADF_abort_on_error = TRUE ; -else { - *error_return = BAD_ERROR_STATE ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - -} /* end of ADF_Set_Error_State */ -/* end of file ADF_Set_Error_State.c */ -/* file ADF_Set_Label.c */ -/*********************************************************************** -ADF Set Label: - -Set Label. Set the 32 character string in a node's label field. - -ADF_Set_Label( ID, label, error_return ) -input: const double ID The ID of the node to use. -input: const char *label The 32-character label of the node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Set_Label( - const double ID, - const char *label, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -int i, label_length ; -double LID ; - -tStart(&gADF_Set_Label_Timer); - /** Don't check for NULL or BLANK label, these are OK **/ -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Copy the label **/ -if( label == NULL ) - label_length = 0 ; /* copy none, then blank fill */ -else - label_length = strlen( label ) ; -if( label_length > ADF_LABEL_LENGTH ) { - *error_return = STRING_LENGTH_TOO_BIG ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -for( i=0; i chunk_total_bytes ) { - /** Write the part of the new data to existing data-chunk **/ - ADFI_write_data_chunk( file_index, &node.data_chunks, - tokenized_data_type, file_bytes, chunk_total_bytes, 0, - chunk_total_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Allocate a second data chunk **/ - total_bytes -= chunk_total_bytes ; - ADFI_file_malloc( file_index, - total_bytes + TAG_SIZE + TAG_SIZE + DISK_POINTER_SIZE, - &new_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write the rest of the data **/ -/** note: memory_bytes and file_bytes might be different (e.g., if machine - is "IEEE_BIG" and file is "CRAY") in which case data pointer advances - at a different rate from file pointer. **/ - data += (chunk_total_bytes * memory_bytes ) / file_bytes ; - - ADFI_write_data_chunk( file_index, &new_block_offset, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Allocate a data-chunk-table for two entries **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + 5 * DISK_POINTER_SIZE, - &dct_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write data-chunk-table to disk **/ - data_chunk_entry_table[0].start.block = node.data_chunks.block ; - data_chunk_entry_table[0].start.offset = node.data_chunks.offset ; - chunk_start.block = node.data_chunks.block ; - chunk_start.offset = node.data_chunks.offset + TAG_SIZE ; - ADFI_adjust_disk_pointer( &chunk_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - /** get the size of the data_chunk for the table end pointer **/ - ADFI_read_disk_pointer_from_disk( file_index, - chunk_start.block, chunk_start.offset, - &data_chunk_entry_table[0].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - data_chunk_entry_table[1].start.block = new_block_offset.block ; - data_chunk_entry_table[1].start.offset = new_block_offset.offset ; - chunk_start.block = new_block_offset.block ; - chunk_start.offset = new_block_offset.offset + TAG_SIZE ; - ADFI_adjust_disk_pointer( &chunk_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - /** get the size of the data_chunk for the table end pointer **/ - ADFI_read_disk_pointer_from_disk( file_index, - chunk_start.block, chunk_start.offset, - &data_chunk_entry_table[1].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - ADFI_write_data_chunk_table( file_index, &dct_block_offset, - 2, data_chunk_entry_table, error_return ) ; - - /** Update node header with number of data-chunks = 2 and the - pointer to the data-chunk-table **/ - node.data_chunks.block = dct_block_offset.block ; - node.data_chunks.offset = dct_block_offset.offset ; - node.number_of_data_chunks = 2 ; - ADFI_write_node_header( file_index, &block_offset, &node, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { - /** Write the new data to existing data-chunk **/ - ADFI_write_data_chunk( file_index, &node.data_chunks, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - } /* end else if */ -else { /** Multiple data chunks **/ - /** Allocate memory for the data-chunk-table, with an additional - entry in case we need to grow it - **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( (node.number_of_data_chunks + 1 ) * - sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Read in the table **/ - ADFI_read_data_chunk_table( file_index, &node.data_chunks, - data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** looping on the data-chunks, write the size of the current chunk **/ - for( i=0; i<(int)node.number_of_data_chunks; i++ ) { - current_bytes = (data_chunk_table[i].end.block - - data_chunk_table[i].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[i].end.offset - - data_chunk_table[i].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - /** Limit the number of bytes written by whats left to write. **/ - current_bytes = MIN( current_bytes, total_bytes ) ; - ADFI_write_data_chunk( file_index, &data_chunk_table[i].start, - tokenized_data_type, file_bytes, current_bytes, 0, - current_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - -/** note: memory_bytes and file_bytes might be different (e.g., if machine - is "IEEE_BIG" and file is "CRAY") in which case data pointer advances - at a different rate from file pointer. **/ - data += (current_bytes * memory_bytes ) / file_bytes ; - - total_bytes -= current_bytes ; - if( total_bytes <= 0 ) - break ; - } /* end for */ - - /** If we are out of data-chunks and have data left, allocate a - new data-chunk in the file. **/ - - if( total_bytes > 0 ) { - /** Write data-chunk-table to disk **/ - - /** allocate data space in the file **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + DISK_POINTER_SIZE + - total_bytes, - &data_chunk_table[ node.number_of_data_chunks ].start, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - data_chunk_table[ node.number_of_data_chunks ].end.block = - data_chunk_table[ node.number_of_data_chunks ].start.block ; - data_chunk_table[ node.number_of_data_chunks ].end.offset = - data_chunk_table[ node.number_of_data_chunks ].start.offset + - TAG_SIZE + DISK_POINTER_SIZE + total_bytes ; - ADFI_adjust_disk_pointer( - &data_chunk_table[ node.number_of_data_chunks ].end, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** allocate space for the new data-chunk-entry-table **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + - (2 * (node.number_of_data_chunks + 1) + 1) * DISK_POINTER_SIZE, - &dct_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - ADFI_write_data_chunk_table( file_index, &dct_block_offset, - node.number_of_data_chunks+1, data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - ADFI_write_data_chunk( file_index, - &data_chunk_table[node.number_of_data_chunks ].start, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Free the old data-chunk-table **/ - ADFI_file_free( file_index, &node.data_chunks, 0, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Update node header with number of data-chunks++ and the - pointer to the data-chunk-table **/ - node.number_of_data_chunks++ ; - node.data_chunks.block = dct_block_offset.block ; - node.data_chunks.offset = dct_block_offset.offset ; - ADFI_write_node_header( file_index, &block_offset, &node, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - free( data_chunk_table ) ; - } /* end else */ - -#if !LINUX_NFS_OPT -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -#endif - -tEnd(&gADF_Write_All_Data_Timer); -} /* end of ADF_Write_All_Data */ -/* end of file ADF_Write_All_Data.c */ -/* end of file ADF_Write_All_Data.c */ -/* file ADF_Write_Block_Data.c */ -/*********************************************************************** -ADF Write Block Data: - -Write all data to a Node. Writes all the node's data from a contiguous -memory space. - -ADF_Write_All_Data( ID, data, error_return ) -input: const double ID The ID of the node to use. -input: const long b_start The starting point in block in token space -input: const long b_end The ending point in block in token space -input: const char *data The start of the data in memory. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Write_Block_Data( - const double ID, - const long b_start, - const long b_end, - char *data, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset, new_block_offset, dct_block_offset ; -struct NODE_HEADER node ; -struct TOKENIZED_DATA_TYPE - tokenized_data_type[ 1 + (ADF_DATA_TYPE_LENGTH + 1)/3 ] ; -struct DATA_CHUNK_TABLE_ENTRY data_chunk_entry_table[2], *data_chunk_table ; - -char file_format, machine_format ; -int file_bytes, memory_bytes ; -long total_bytes, bytes_written, bytes_to_write = 0; -int i, j ; -char tag[TAG_SIZE+1] ; -struct DISK_POINTER data_start, chunk_start, end_of_chunk_tag ; -long start_offset ; -long chunk_size, chunk_end_byte ; -long start_byte, end_byte, block_bytes ; -double LID ; - -if( data == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -tStart(&gADF_Write_Block_Data_Timer); -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get the datatype length **/ -ADFI_evaluate_datatype( file_index, node.data_type, &file_bytes, &memory_bytes, - tokenized_data_type, &file_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Calculate the total number of data bytes **/ -total_bytes = file_bytes ; -for( j=0; j<(int)node.number_of_dimensions; j++ ) - total_bytes *= node.dimension_values[j] ; -if( total_bytes == 0 ) { - *error_return = ZERO_DIMENSIONS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Calculate the starting and ending range in the file **/ -start_byte = file_bytes * (b_start-1) ; -end_byte = file_bytes * b_end ; -if ( start_byte < 0 || start_byte > end_byte || end_byte > total_bytes ) { - *error_return = START_OUT_OF_DEFINED_RANGE ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -block_bytes = end_byte - start_byte ; - - /** If there currently is NO data, allocate disk space for it **/ -if( node.number_of_data_chunks == 0 ) { - ADFI_file_malloc( file_index, - total_bytes + TAG_SIZE + TAG_SIZE + DISK_POINTER_SIZE, - &node.data_chunks, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write the new data **/ - ADFI_write_data_chunk( file_index, &node.data_chunks, tokenized_data_type, - file_bytes, total_bytes, start_byte, block_bytes, data, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Record the modified the node-header **/ - node.number_of_data_chunks = 1 ; - ADFI_write_node_header( file_index, &block_offset, &node, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -else if( node.number_of_data_chunks == 1 ) { - /** Get the data length **/ - ADFI_read_chunk_length( file_index, &node.data_chunks, tag, - &end_of_chunk_tag, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - tag[TAG_SIZE] = '\0' ; - - /** Check start-of-chunk tag **/ - if( ADFI_stridx_c( tag, data_chunk_start_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Point to the start of the data **/ - data_start.block = node.data_chunks.block ; - data_start.offset = node.data_chunks.offset + TAG_SIZE + DISK_POINTER_SIZE ; - ADFI_adjust_disk_pointer( &data_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** See if the new data exceedes the existing data space **/ - chunk_size = end_of_chunk_tag.offset - data_start.offset + - (end_of_chunk_tag.block - data_start.block) * DISK_BLOCK_SIZE ; - - - /** If Data grew: Write old size, then allocate more - data-space and write the rest **/ - if( total_bytes > chunk_size ) { - /** Write the part of the new data to existing data-chunk **/ - bytes_written = 0 ; - if ( start_byte <= chunk_size ) { - bytes_to_write = MIN ( block_bytes, (chunk_size-start_byte) ) ; - ADFI_write_data_chunk( file_index, &node.data_chunks, - tokenized_data_type, file_bytes, chunk_size, start_byte, - bytes_to_write, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - bytes_written += bytes_to_write ; - } /* end if */ - - /** Allocate a second data chunk **/ - total_bytes -= chunk_size ; - ADFI_file_malloc( file_index, - total_bytes + TAG_SIZE + TAG_SIZE + DISK_POINTER_SIZE, - &new_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write the rest of the data **/ -/** note: memory_bytes and file_bytes might be different (e.g., if machine - is "IEEE_BIG" and file is "CRAY") in which case data pointer advances - at a different rate from file pointer. **/ - data += (bytes_to_write * memory_bytes ) / file_bytes ; - - if ( bytes_written < block_bytes ) { - bytes_to_write = block_bytes - bytes_written ; - start_offset = MAX ( 0L, (start_byte - chunk_size) ) ; - ADFI_write_data_chunk( file_index, &new_block_offset, - tokenized_data_type, file_bytes, total_bytes, start_offset, - bytes_to_write, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { - ADFI_write_data_chunk( file_index, &new_block_offset, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, NULL, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Allocate a data-chunk-table for two entries **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + 5 * DISK_POINTER_SIZE, - &dct_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write data-chunk-table to disk **/ - data_chunk_entry_table[0].start.block = node.data_chunks.block ; - data_chunk_entry_table[0].start.offset = node.data_chunks.offset ; - /** get the size of the data_chunk for the table end pointer **/ - chunk_start.block = node.data_chunks.block ; - chunk_start.offset = node.data_chunks.offset + TAG_SIZE ; - ADFI_adjust_disk_pointer( &chunk_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - ADFI_read_disk_pointer_from_disk( file_index, - chunk_start.block, chunk_start.offset, - &data_chunk_entry_table[0].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - data_chunk_entry_table[1].start.block = new_block_offset.block ; - data_chunk_entry_table[1].start.offset = new_block_offset.offset ; - chunk_start.block = new_block_offset.block ; - chunk_start.offset = new_block_offset.offset + TAG_SIZE ; - ADFI_adjust_disk_pointer( &chunk_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - /** get the size of the data_chunk for the table end pointer **/ - ADFI_read_disk_pointer_from_disk( file_index, - chunk_start.block, chunk_start.offset, - &data_chunk_entry_table[1].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - ADFI_write_data_chunk_table( file_index, &dct_block_offset, - 2, data_chunk_entry_table, error_return ) ; - - /** Update node header with number of data-chunks = 2 and the - pointer to the data-chunk-table **/ - node.data_chunks.block = dct_block_offset.block ; - node.data_chunks.offset = dct_block_offset.offset ; - node.number_of_data_chunks = 2 ; - ADFI_write_node_header( file_index, &block_offset, &node, error_return ); - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { - /** Write the new data to existing data-chunk **/ - ADFI_write_data_chunk( file_index, &node.data_chunks, - tokenized_data_type, file_bytes, chunk_size, start_byte, - block_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - } /* end else if */ -else { /** Multiple data chunks **/ - /** Allocate memory for the data-chunk-table, with an additional - entry in case we need to grow it - **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( (node.number_of_data_chunks + 1 ) * - sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Read in the table **/ - ADFI_read_data_chunk_table( file_index, &node.data_chunks, - data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** looping on the data-chunks, write the size of the current chunk **/ - chunk_end_byte = 0 ; - bytes_written = 0 ; - for( i=0; i<(int)node.number_of_data_chunks; i++ ) { - chunk_size = (data_chunk_table[i].end.block - - data_chunk_table[i].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[i].end.offset - - data_chunk_table[i].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - chunk_end_byte += chunk_size ; - - /** If start of block not in this chunk then continue **/ - if ( start_byte > chunk_end_byte ) - continue ; - - /** Set offset into the current chunk **/ - if ( start_byte > (chunk_end_byte - chunk_size) ) - /** The start of the block is inside the current chunk so - adjust the offset to the beginning of the block **/ - start_offset = ( start_byte - (chunk_end_byte-chunk_size) ) ; - else - start_offset = 0 ; - - /** Check to be sure we aren't writing too much data **/ - bytes_to_write = chunk_size - start_offset ; - if( bytes_written + bytes_to_write > block_bytes ) { - bytes_to_write = block_bytes - bytes_written ; - } /* end if */ - if( bytes_to_write == 0 || (chunk_end_byte-chunk_size) > end_byte ) - continue ; - - /** Write the chunk **/ - ADFI_write_data_chunk( file_index, &data_chunk_table[i].start, - tokenized_data_type, file_bytes, chunk_size, start_offset, - bytes_to_write, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - -/** note: memory_bytes and file_bytes might be different (e.g., if machine - is "IEEE_BIG" and file is "CRAY") in which case data pointer advances - at a different rate from file pointer. **/ - data += (bytes_to_write * memory_bytes ) / file_bytes ; - - bytes_written += bytes_to_write ; - } /* end for */ - - /** If we are out of data-chunks and have data left, allocate a - new data-chunk in the file. **/ - total_bytes -= chunk_end_byte ; - if( total_bytes > 0 ) { - /** Write data-chunk-table to disk **/ - - /** allocate data space in the file **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + DISK_POINTER_SIZE + - total_bytes, - &data_chunk_table[ node.number_of_data_chunks ].start, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - data_chunk_table[ node.number_of_data_chunks ].end.block = - data_chunk_table[ node.number_of_data_chunks ].start.block ; - data_chunk_table[ node.number_of_data_chunks ].end.offset = - data_chunk_table[ node.number_of_data_chunks ].start.offset + - TAG_SIZE + DISK_POINTER_SIZE + total_bytes ; - ADFI_adjust_disk_pointer( - &data_chunk_table[ node.number_of_data_chunks ].end, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** allocate space for the new data-chunk-entry-table **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + - (2 * (node.number_of_data_chunks + 1) + 1) * DISK_POINTER_SIZE, - &dct_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - ADFI_write_data_chunk_table( file_index, &dct_block_offset, - node.number_of_data_chunks+1, data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - if ( bytes_written < block_bytes ) { - bytes_to_write = block_bytes - bytes_written ; - start_offset = MAX ( 0L, (start_byte - total_bytes) ) ; - ADFI_write_data_chunk( file_index, - &data_chunk_table[node.number_of_data_chunks ].start, - tokenized_data_type, file_bytes, - total_bytes, start_offset, bytes_to_write, - data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { - ADFI_write_data_chunk( file_index, - &data_chunk_table[node.number_of_data_chunks ].start, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, NULL, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Free the old data-chunk-table **/ - ADFI_file_free( file_index, &node.data_chunks, 0, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Update node header with number of data-chunks++ and the - pointer to the data-chunk-table **/ - node.number_of_data_chunks++ ; - node.data_chunks.block = dct_block_offset.block ; - node.data_chunks.offset = dct_block_offset.offset ; - ADFI_write_node_header( file_index, &block_offset, &node, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - free( data_chunk_table ) ; - } /* end else */ - -#if !LINUX_NFS_OPT -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -#endif - -tEnd(&gADF_Write_Block_Data_Timer); -} /* end of ADF_Write_Block_Data */ -/* end of file ADF_Write_Block_Data.c */ -/* file ADF_Write_Data.c */ -/*********************************************************************** -ADF Write Data: - -Write data to a Node, with partial capabilities. See ADF_Read_Data for -description. - -ADF_Write_Data( ID, s_start[], s_end[], s_stride[], m_num_dims, - m_dims[], m_start[], m_end[], m_stride[], data, error_return ) -input: const double ID The ID of the node to use. -input: const int s_start[] The starting dimension values to use in - the database (node). -input: const int s_end[] The ending dimension values to use in - the database (node). -input: const int s_stride[] The stride values to use in the database (node). -input: const int m_num_dims The number of dimensions to use in memory. -input: const int m_dims[] The dimensionality to use in memory. -input: const int m_start[] The starting dimension values to use in memory. -input: const int m_end[] The ending dimension values to use in memory. -input: const int m_stride[] The stride values to use in memory. -input: const char *data The start of the data in memory. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Write_Data( - const double ID, - const int s_start[], - const int s_end[], - const int s_stride[], - const int m_num_dims, - const int m_dims[], - const int m_start[], - const int m_end[], - const int m_stride[], - const char *data, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset, dct_block_offset, relative_block ; -struct DISK_POINTER data_start, new_block_offset ; -struct DISK_POINTER chunk_start, end_of_chunk_tag ; -struct NODE_HEADER node ; -struct DATA_CHUNK_TABLE_ENTRY *data_chunk_table ; -struct TOKENIZED_DATA_TYPE - tokenized_data_type[ 1 + (ADF_DATA_TYPE_LENGTH + 1)/3 ] ; -int current_disk[ADF_MAX_DIMENSIONS] ; -int current_memory[ADF_MAX_DIMENSIONS] ; -unsigned long total_disk_elements, total_memory_elements ; -unsigned long disk_offset, memory_offset ; -int formats_compare ; -char disk_format, machine_format ; -int i ; -int file_bytes = 0 ; -int memory_bytes = 0 ; -char tag[TAG_SIZE+1] ; -unsigned long total_bytes ; -long current_bytes, chunk_total_bytes ; -double LID ; -unsigned long relative_offset, current_chunk, current_chunk_size, - past_chunk_sizes ; - -if( (s_start == NULL) || (s_end == NULL) || (s_stride == NULL) || - (m_dims == NULL) || (m_start == NULL) || (m_end == NULL) || - (m_stride == NULL) || (data == NULL) ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -tStart(&gADF_Write_Data_Timer); -*error_return = NO_ERROR ; -data_chunk_table = 0L ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get datatype length **/ -ADFI_evaluate_datatype( file_index, node.data_type, &file_bytes, &memory_bytes, - tokenized_data_type, &disk_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( (file_bytes == 0) || (node.number_of_dimensions == 0) ) { - *error_return = NO_DATA ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -ADFI_count_total_array_points( node.number_of_dimensions, - node.dimension_values, - s_start, s_end, s_stride, - &total_disk_elements, &disk_offset, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_count_total_array_points( (unsigned int)m_num_dims, - (unsigned int *)m_dims, - m_start, m_end, m_stride, - &total_memory_elements, &memory_offset, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( total_disk_elements != total_memory_elements ) { - *error_return = UNEQUAL_MEMORY_AND_DISK_DIMS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Calculate the total number of data bytes **/ -total_bytes = file_bytes ; -for( i=0; i<(int)node.number_of_dimensions; i++ ) - total_bytes *= node.dimension_values[i] ; -if( total_bytes == 0 ) { - *error_return = ZERO_DIMENSIONS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** check for need of data translation **/ -ADFI_file_and_machine_compare( file_index, tokenized_data_type, - &formats_compare, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** If there currently is NO data, allocate disk space for it **/ -if( node.number_of_data_chunks == 0 ) { - ADFI_file_malloc( file_index, - total_bytes + TAG_SIZE + TAG_SIZE + DISK_POINTER_SIZE, - &node.data_chunks, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** initialize the new disk_space with zero's, then we'll - write the partial data **/ - ADFI_write_data_chunk( file_index, &node.data_chunks, tokenized_data_type, - file_bytes, total_bytes, 0, total_bytes, 0L, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Record the modified the node-header **/ - node.number_of_data_chunks = 1 ; - ADFI_write_node_header( file_index, &block_offset, &node, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - /** If one data chunk, check to see if we need to add a second **/ -else if( node.number_of_data_chunks == 1 ) { - /** Get the data length **/ - ADFI_read_chunk_length( file_index, &node.data_chunks, tag, - &end_of_chunk_tag, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - tag[TAG_SIZE] = '\0' ; - - /** Check start-of-chunk tag **/ - if( ADFI_stridx_c( tag, data_chunk_start_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Point to the start of the data **/ - data_start.block = node.data_chunks.block ; - data_start.offset = node.data_chunks.offset + TAG_SIZE + DISK_POINTER_SIZE ; - ADFI_adjust_disk_pointer( &data_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** See if the new data exceedes the existing data space **/ - chunk_total_bytes = end_of_chunk_tag.offset - data_start.offset + - (end_of_chunk_tag.block - data_start.block) * DISK_BLOCK_SIZE ; - - /** If Data grew: Allocate more data-space and initialize to zero**/ - if( (long int) total_bytes > chunk_total_bytes ) { - /** Allocate memory for the data-chunk-table, with an additional - entry in case we need to grow it **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( (node.number_of_data_chunks + 1 ) * - sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Allocate a second data chunk **/ - total_bytes -= chunk_total_bytes ; - ADFI_file_malloc( file_index, - total_bytes + TAG_SIZE + TAG_SIZE + DISK_POINTER_SIZE, - &new_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Initialize the new data with zeros **/ - ADFI_write_data_chunk( file_index, &new_block_offset, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, 0L, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Allocate a data-chunk-table for two entries **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + 5 * DISK_POINTER_SIZE, - &dct_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write data-chunk-table to disk **/ - data_chunk_table[0].start.block = node.data_chunks.block ; - data_chunk_table[0].start.offset = node.data_chunks.offset ; - chunk_start.block = node.data_chunks.block ; - chunk_start.offset = node.data_chunks.offset + TAG_SIZE ; - ADFI_adjust_disk_pointer( &chunk_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - /** get the size of the data_chunk for the table end pointer **/ - ADFI_read_disk_pointer_from_disk( file_index, - chunk_start.block, chunk_start.offset, - &data_chunk_table[0].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - data_chunk_table[1].start.block = new_block_offset.block ; - data_chunk_table[1].start.offset = new_block_offset.offset ; - chunk_start.block = new_block_offset.block ; - chunk_start.offset = new_block_offset.offset + TAG_SIZE ; - ADFI_adjust_disk_pointer( &chunk_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - /** get the size of the data_chunk for the table end pointer **/ - ADFI_read_disk_pointer_from_disk( file_index, - chunk_start.block, chunk_start.offset, - &data_chunk_table[1].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - ADFI_write_data_chunk_table( file_index, &dct_block_offset, - 2, data_chunk_table, error_return ) ; - - /** Update node header with number of data-chunks = 2 and the - pointer to the data-chunk-table **/ - node.data_chunks.block = dct_block_offset.block ; - node.data_chunks.offset = dct_block_offset.offset ; - node.number_of_data_chunks = 2 ; - ADFI_write_node_header( file_index, &block_offset, &node, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - } /* end else if */ -else { /** Multiple data chunks, check to see if we need to add one mode **/ - /** Allocate memory for the data-chunk-table, with an additional - entry in case we need to grow it **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( (node.number_of_data_chunks + 1 ) * - sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Read in the table **/ - ADFI_read_data_chunk_table( file_index, &node.data_chunks, - data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** looping on the data-chunks, look at the size of the chunks **/ - for( i=0; i<(int)node.number_of_data_chunks; i++ ) { - current_bytes = (data_chunk_table[i].end.block - - data_chunk_table[i].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[i].end.offset - - data_chunk_table[i].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - total_bytes -= current_bytes ; - if( total_bytes <= 0 ) - break ; - } /* end for */ - - /** If we are out of data-chunks and have data left, allocate a - new data-chunk in the file. **/ - if( total_bytes > 0 ) { - /** Write data-chunk-table to disk **/ - - /** allocate data space in the file **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + DISK_POINTER_SIZE + - total_bytes, &data_chunk_table[ node.number_of_data_chunks ].start, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - data_chunk_table[ node.number_of_data_chunks ].end.block = - data_chunk_table[ node.number_of_data_chunks ].start.block ; - data_chunk_table[ node.number_of_data_chunks ].end.offset = - data_chunk_table[ node.number_of_data_chunks ].start.offset + - TAG_SIZE + DISK_POINTER_SIZE + total_bytes ; - ADFI_adjust_disk_pointer( - &data_chunk_table[ node.number_of_data_chunks ].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** allocate space for the new data-chunk-entry-table **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + - (2 * (node.number_of_data_chunks + 1) + 1) * DISK_POINTER_SIZE, - &dct_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - ADFI_write_data_chunk_table( file_index, &dct_block_offset, - node.number_of_data_chunks+1, data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Initialize the new data chunk to zeros **/ - ADFI_write_data_chunk( file_index, - &data_chunk_table[node.number_of_data_chunks ].start, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, 0L, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - /** Free the old data-chunk-table **/ - ADFI_file_free( file_index, &node.data_chunks, 0, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Update node header with number of data-chunks++ and the - pointer to the data-chunk-table **/ - node.number_of_data_chunks++ ; - node.data_chunks.block = dct_block_offset.block ; - node.data_chunks.offset = dct_block_offset.offset ; - ADFI_write_node_header( file_index, &block_offset, &node, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - } /* end else */ - - /** Do single data-chunks here... **/ -if( node.number_of_data_chunks == 1 ) { - /** Point to the start of the data **/ - block_offset.block = node.data_chunks.block ; - block_offset.offset = node.data_chunks.offset + TAG_SIZE + - DISK_POINTER_SIZE + disk_offset * file_bytes ; - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Setup initial indexing **/ - for( i=0; i<(int)node.number_of_dimensions; i++ ) - current_disk[i] = s_start[i] ; - for( i=0; i DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } - - /** Here is where we need to check for spanning multiple data-chunks **/ - - /** Put the data out to disk **/ - if( formats_compare ) { /* directly */ - ADFI_write_file( file_index, block_offset.block, block_offset.offset, - file_bytes, (char *)data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { /* translated */ - ADFI_write_data_translated( file_index, block_offset.block, - block_offset.offset, tokenized_data_type, file_bytes, - file_bytes, (char *)data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Increment disk/memory pointers, for the special case of one dimensional - data we will a simple increment to maximize the throught. Thus for - block writes you can temporarily change to 1D for the read to - improve efficiency. Note total size shouldn't change!! **/ - if( (unsigned)i < total_disk_elements - 1 ) { - if ( node.number_of_dimensions == 1 ) { - disk_offset = s_stride[0]; - current_disk[0] += disk_offset; - if ( current_disk[0] > s_end[0] ) current_disk[0] = s_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - node.number_of_dimensions, node.dimension_values, - s_start, s_end, s_stride, current_disk, &disk_offset, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - if ( m_num_dims == 1 ) { - memory_offset = m_stride[0]; - current_memory[0] += disk_offset; - if ( current_memory[0] > m_end[0] ) current_memory[0] = m_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - (unsigned int)m_num_dims, (unsigned int* )m_dims, - m_start, m_end, m_stride, - current_memory, &memory_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - block_offset.offset += disk_offset * file_bytes ; - if ( block_offset.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Adjust data pointer **/ - data += memory_offset * memory_bytes ; - } /* end if */ - } /* end for */ - } /* end if */ -else { - /** Point to the start of the data **/ - current_chunk = 0 ; - past_chunk_sizes = 0 ; - relative_offset = disk_offset * file_bytes ; - current_chunk_size = (data_chunk_table[ current_chunk ].end.block - - data_chunk_table[ current_chunk ].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[ current_chunk ].end.offset - - data_chunk_table[ current_chunk ].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - - /** Setup initial indexing **/ - for( i=0; i<(int)node.number_of_dimensions; i++ ) - current_disk[i] = s_start[i] ; - for( i=0; i= past_chunk_sizes + current_chunk_size ) { - if( ++current_chunk >= node.number_of_data_chunks ) { - *error_return = INCOMPLETE_DATA ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { - past_chunk_sizes += current_chunk_size ; - current_chunk_size = (data_chunk_table[ current_chunk ].end.block - - data_chunk_table[ current_chunk ].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[ current_chunk ].end.offset - - data_chunk_table[ current_chunk ].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - } /* end else */ - } /* end while */ - - /** Put the data to disk **/ - relative_block.block = data_chunk_table[ current_chunk ].start.block ; - relative_block.offset = data_chunk_table[ current_chunk ].start.offset + - (TAG_SIZE + DISK_POINTER_SIZE) + - (relative_offset - past_chunk_sizes) ; - if ( relative_block.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &relative_block, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Put the data out to disk **/ - if( formats_compare ) { /* directly */ - ADFI_write_file( file_index, - relative_block.block, relative_block.offset, - file_bytes, (char *)data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { /* translated */ - ADFI_write_data_translated( file_index, relative_block.block, - relative_block.offset, tokenized_data_type, file_bytes, - file_bytes, (char *)data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Increment disk and memory pointers **/ - if( (unsigned)i < total_disk_elements - 1 ) { - if ( node.number_of_dimensions == 1 ) { - disk_offset = s_stride[0]; - current_disk[0] += disk_offset; - if ( current_disk[0] > s_end[0] ) current_disk[0] = s_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - node.number_of_dimensions, node.dimension_values, - s_start, s_end, s_stride, current_disk, &disk_offset, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - relative_offset += disk_offset * file_bytes ; - - if ( m_num_dims == 1 ) { - memory_offset = m_stride[0]; - current_memory[0] += disk_offset; - if ( current_memory[0] > m_end[0] ) current_memory[0] = m_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - (unsigned int)m_num_dims, (unsigned int* )m_dims, - m_start, m_end, m_stride, - current_memory, &memory_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Adjust data pointer **/ - data += memory_offset * memory_bytes ; - } /* end if */ - } /* end for */ - } /* end else */ - -if( data_chunk_table != 0L ) - free( data_chunk_table ) ; - -#if !LINUX_NFS_OPT -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -#endif - -tEnd(&gADF_Write_Data_Timer); -} /* end of ADF_Write_Data */ -/* end of file ADF_Write_Data.c */ -/* end of combine 2.0 */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_interface_new.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_interface_new.c deleted file mode 100644 index 009e746cfd..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_interface_new.c +++ /dev/null @@ -1,4172 +0,0 @@ -/* created by combine 2.0 */ -/* file ADF_AAA_var.c */ -/* file ADF_AAA_var.c */ -/*** -File: ADF_interface.c - ---------------------------------------------------------------------- - BOEING - ---------------------------------------------------------------------- - Project: CGNS - Author: Tom Dickens 234-1024 tpd6908@yak.ca.boeing.com - Date: 3/2/1995 - Purpose: The code which implements the ADF-Core capabilities. - ---------------------------------------------------------------------- - ---------------------------------------------------------------------- - -***/ - -/*********************************************************************** - Library and Database "what" strings. -***********************************************************************/ -/** Change the major revision letter in the Library Version for changes - to the API (new public functions, changes to public header files, - changes to existings functions or their defined behavior) - and/or changes to the internal file format resulting in - incompatibilites with previous library versions. Change the - internal revision number for internal changes and bug fixes; - reset to zero for major revision letter changes. **/ - -/** With the original ADF library, there is no binary data for at least - the first 560 bytes, which causes a lot of programs - (mailers, WinZip) to think that the file is text and try to do - a \n -> \n\r conversion. Since this string is only used for the - 'what' command, I am deciding that we don't need this functionality - and am putting binary characters here. Specifically, I am putting - control characters, because while some programs (Evolution/gnome-vfs) - look for unprintable characters, some look for a ratio (Mozilla). **/ - -static char ADF_L_identification[] = "@(#)ADF Library Version E01>\001\002\003\004"; - /* 01234567890123456789012345678901 = 32 */ - -/** Change version database version number every time the library - version changes according to the following philosophy. - -The format: - - AXXxxx - -where: - - A Major revision number. Major internal structure changes. - This number is not expected to change very often if at all - because backward compatibility is only available by explicit - policy decision. - - One alphabetic character. - Range of values: A-Za-z - In unlikely event of reaching z, then can use any other - unused printable ASCII character except blank or symbols - used by "what" command: @, (, #, ), ~, >, \. - - XX Minor revision number. New features and minor changes and - bug fixes. Files are backward but NOT forward compatible. - - Two digit hexadecimal number (uppercase letters). - Range of values: 00 - FF - Reset to 00 with changes in major revision number. - - xxx Incremental number. Incremented with every new version of - library (even if no changes are made to file format). - Files are forward AND backward compatible. - - Three digit hexadecimal number (lowercase letters) - Range of values: 000 to fff - Does not reset. - -Definitions: - - forward compatible Older versions of libraries can read and write - to files created by newer versions of libraries. - - backward compatible Newer versions of libraries can read and write - to files created by older versions of libraries. -**/ - - /* AXXxxx */ -static char ADF_D_identification[] = "@(#)ADF Database>\001\002\003\004\005\006\007\010A02011>"; - /* 01234567890123456789012345678901 = 32 */ - -/*********************************************************************** - Includes -***********************************************************************/ -#ifndef MAKEDEPEND -#include -#include -#include -#if !defined(_WIN32) || (defined(_WIN32) && defined(__NUTC__)) -#include -#else -#include -#endif -#include -#include -#endif - -#include "ADF.h" -#include "ADF_internals.h" -/* This was moved from ADF_internals.h since they are only used here - and leaving them here gives warning messages when the other .c files - are compiled. WRO 2005-Jan-11 */ -static char data_chunk_start_tag[] = "DaTa" ; - -#if defined(_WIN32) && !defined(__NUTC__) -#ifndef MAKEDEPEND -#include -#endif -#ifndef F_OK -#define R_OK 004 /* Test for Read permission */ -#define W_OK 002 /* Test for Write permission */ -#define X_OK 001 /* Test for eXecute permission */ -#define F_OK 000 /* Test for existence of File */ -#endif -#endif - - -/*********************************************************************** - Error strings - These strings must be kept in sync with the error defines in ADF.h. -***********************************************************************/ -const char *ADF_error_string[] = { - "ADF -1: No Error.", - "ADF 1: Integer number is less than given minimum value.", - "ADF 2: Integer number is greater than given maximum value.", - "ADF 3: String length of zero or blank string detected.", - "ADF 4: String length longer than maximum allowable length.", - "ADF 5: String is not an ASCII-HEX string.", - "ADF 6: Too many ADF files opened.", - "ADF 7: ADF file status was not recognized.", - "ADF 8: ADF file-open error.", - "ADF 9: ADF file not currently opened.", - "ADF 10: ADF file index out of legal range.", - "ADF 11: Block/offset out of legal range.", - "ADF 12: A string pointer is NULL.", - "ADF 13: FSEEK error.", - "ADF 14: FWRITE error.", - "ADF 15: FREAD error.", - "ADF 16: Internal error: Memory boundary tag bad.", - "ADF 17: Internal error: Disk boundary tag bad.", - "ADF 18: File Open Error: NEW - File already exists.", - "ADF 19: ADF file format was not recognized.", - "ADF 20: Attempt to free the RootNode disk information.", - "ADF 21: Attempt to free the FreeChunkTable disk information.", - "ADF 22: File Open Error: OLD - File does not exist.", - "ADF 23: Entered area of Unimplemented Code...", - "ADF 24: Sub-Node.entries is bad.", - "ADF 25: Memory allocation failed.", - "ADF 26: Duplicate child name under a parent node.", - "ADF 27: Node has no dimensions.", - "ADF 28: Node's number-of-dimensions is not in legal range.", - "ADF 29: Specified child is NOT a child of the specified parent.", - "ADF 30: Data-Type is too long.", - "ADF 31: Invalid Data-Type.", - "ADF 32: A pointer is NULL.", - "ADF 33: Node has no data associated with it.", - "ADF 34: Error zeroing out memory.", - "ADF 35: Requested data exceeds actual data available.", - "ADF 36: Bad end value.", - "ADF 37: Bad stride value.", - "ADF 38: Minimum values is greater than the maximum value.", - "ADF 39: The format of this machine does not match a known signature.", - "ADF 40: Cannot convert to or from an unknown Native format.", - "ADF 41: The two conversion formats are equal, no conversion done.", - "ADF 42: The data format is not support on a particular machine.", - "ADF 43: File Close error.", - "ADF 44: Numeric overflow/underflow in data conversion.", - "ADF 45: Bad start value.", - "ADF 46: A value of zero is not allowable.", - "ADF 47: Bad dimension value.", - "ADF 48: Error state must be either a 0 (zero) or a 1 (one).", - "ADF 49: Dimensional specifications for disk and memory are unequal.", - "ADF 50: Too many link level used. May be caused by a recursive link.", - "ADF 51: The node is not a link. It was expected to be a link.", - "ADF 52: The linked-to node does not exist.", - "ADF 53: The ADF file of a linked-node is not accessable.", - "ADF 54: A node-id of 0.0 is not valid.", - "ADF 55: Incomplete Data when reading multiple data blocks.", - "ADF 56: Node name contains invalid characters.", - "ADF 57: ADF file version incompatible with this library version.", - "ADF 58: Nodes are not from the same file.", - "ADF 59: Priority Stack Error.", - "ADF 60: Machine format and file format are incompatable.", - "ADF 61: FFLUSH error", - "ADF 62: The node ID pointer is NULL.", - "ADF x: Last error mesage" - } ; - -/*********************************************************************** - Global Variables: -***********************************************************************/ -static int ADF_abort_on_error = FALSE ; -static char link_separator[MAXIMUM_FILES][2] ; - -#define CHECK_ADF_ABORT( error_flag ) if( error_flag != NO_ERROR ) { \ - if( ADF_abort_on_error == TRUE ) { \ - ADF_Error_Message( error_flag, 0L );\ - ADFI_Abort( error_flag) ; } \ - else { return ; } } -/* Added to remove memory leaks in ADF_Get_Node_ID */ -#define CHECK_ADF_ABORT1( error_flag ) if( error_flag != NO_ERROR ) { \ - free (name_tmp); \ - if( ADF_abort_on_error == TRUE ) { \ - ADF_Error_Message( error_flag, 0L );\ - ADFI_Abort( error_flag) ; } \ - else { return ; } } - -/*********************************************************************** -Data Query: -Note: If the node is a link, the data query will occur on the linked-to -node, not the node which is the link. -Internal Implementation: A linked node will have a data-type of "LK", -dimension of 1 and a dimension value of the length of a data string -containing the file-path and the node-path within the file. The -routines ADF_Is_Link and ADF_Get_Link_Path allow viewing of a link's -data-type and data. -***********************************************************************/ -/*********************************************************************** -Data I/O: -A 1-based system is used with all index values (the first element has an -index of 1, not 0). -***********************************************************************/ -/* end of file ADF_AAA_var.c */ -/* end of file ADF_AAA_var.c */ -/* file ADF_Children_Names.c */ -/*********************************************************************** -ADF Children names: - -Get Children names of a Node. Return the name of children nodes -directly associated with a parent node. The names of the children -are NOT guaranteed to be returned in any particular order. If a new -child is added, it is NOT guaranteed to be returned as the last child. - -Null-terminated names will be written into the names array and thus -there needs to be room for the null character. As an example, -the array can be defined as: - - char names[IMAX_NUM][IMAX_NAME_LENGTH+1]; - -where IMAX_NUM and IMAX_NAME_LENGTH are defined by the using application -and correspond to this function's "imax_num" and "imax_name_len" parameters -respectively. "imax_name_len" is the maximum length of a name to be copied -into the names array. This value can be equal to ADF_NAME_LENGTH but does -not have to be. However, the name dimension of the array MUST be declared -to be "imax_name_len" + 1. The name will be returned truncated (but still -null-terminated) if the actual name is longer than "imax_name_len" and -if "imax_name_len" is less than ADF_NAME_LENGTH. - -Note that the names array parameter is declared as a single dimension -character array inside this function. Therefore, use a (char *) cast to -cast a two dimensional array argument. - -ADF_Children_Names( PID, istart, imax_num, imax_name_len, inum_ret, - names, error_return ) -input: const double PID The ID of the Node to use. -input: const int istart The Nth child's name to start with (first is 1). -input: const int imax_num Maximum number of names to return. -input: const int imax_name_len Maximum Length of a name to return. -output: int *inum_ret The number of names returned. -output: char *names The returned names (cast with (char *)). -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -NUMBER_LESS_THAN_MINIMUM -***********************************************************************/ -void ADF_Children_Names( - const double PID, - const int istart, - const int imax_num, - const int imax_name_len, - int *inum_ret, - char *names, - int *error_return ) -{ -int i ; -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -struct SUB_NODE_TABLE_ENTRY sub_node_table_entry ; -double LID ; - -*error_return = NO_ERROR ; - -if( inum_ret == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -*inum_ret = 0 ; - -if( names == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( (istart <=0) || (imax_num <= 0) || (imax_name_len <= 0) ) { - *error_return = NUMBER_LESS_THAN_MINIMUM ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -ADFI_chase_link( PID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Check for zero children, return if 0 **/ -if( node.num_sub_nodes == 0 ) { - return ; - } /* end if */ - - /** point to the first child wanted **/ -block_offset.block = node.sub_node_table.block ; -block_offset.offset = node.sub_node_table.offset + - (TAG_SIZE + DISK_POINTER_SIZE + - (ADF_NAME_LENGTH + DISK_POINTER_SIZE) * (istart-1)) ; - - /** Return the data for the requested children **/ -for( i=(istart-1); i< MIN(istart-1+imax_num, (int) node.num_sub_nodes); i++ ) { - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Read the sun-node entry table **/ - ADFI_read_sub_node_table_entry( file_index, &block_offset, - &sub_node_table_entry, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Convert the child's name from blank-filled into a C string **/ - ADFI_string_2_C_string( sub_node_table_entry.child_name, - MIN(imax_name_len,ADF_NAME_LENGTH), - &names[(i-(istart-1))*(imax_name_len+1)], - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Increment the disk-pointer and the number of names returned **/ - block_offset.offset += (ADF_NAME_LENGTH + DISK_POINTER_SIZE) ; - *inum_ret = *inum_ret + 1 ; - } /* end for */ -} /* end of ADF_Children_Names */ -/* end of file ADF_Children_Names.c */ -/* file ADF_Children_IDs.c */ -/*********************************************************************** -ADF Children IDs: - -Get Children node IDs of a Node. Return the node IDs of children nodes -directly associated with a parent node. - -ADF_Children_IDs( PID, istart, imax_num, inum_ret, IDs, error_return) -input: const double PID The ID of the Node to use. -input: const int istart The Nth child's name to start with (first is 1). -input: const int imax_num Maximum number of names to return. -output: int *inum_ret The number of names returned. -output: double *IDs The returned node IDs -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -NUMBER_LESS_THAN_MINIMUM -***********************************************************************/ -void ADF_Children_IDs ( - const double PID, - const int istart, - const int imax_num, - int *inum_ret, - double *IDs, - int *error_return ) -{ -int i ; -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -struct SUB_NODE_TABLE_ENTRY sub_node_table_entry ; -double LID ; - -*error_return = NO_ERROR ; - -if( inum_ret == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -*inum_ret = 0 ; - -if( IDs == NULL ) { - *error_return = NULL_NODEID_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( (istart <=0) || (imax_num <= 0) ) { - *error_return = NUMBER_LESS_THAN_MINIMUM ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -ADFI_chase_link( PID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Check for zero children, return if 0 **/ -if( node.num_sub_nodes == 0 ) { - return ; - } /* end if */ - - /** point to the first child wanted **/ -block_offset.block = node.sub_node_table.block ; -block_offset.offset = node.sub_node_table.offset + - (TAG_SIZE + DISK_POINTER_SIZE + - (ADF_NAME_LENGTH + DISK_POINTER_SIZE) * (istart-1)) ; - - /** Return the data for the requested children **/ -for( i=(istart-1); i< MIN(istart-1+imax_num, (int) node.num_sub_nodes); i++ ) { - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Read the sub-node entry table **/ - ADFI_read_sub_node_table_entry( file_index, &block_offset, - &sub_node_table_entry, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Get the ID from the sub-node table **/ - ADFI_file_block_offset_2_ID( file_index, - sub_node_table_entry.child_location.block, - sub_node_table_entry.child_location.offset, - &IDs[i-(istart-1)], error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Increment the disk-pointer and the number of IDs returned **/ - block_offset.offset += (ADF_NAME_LENGTH + DISK_POINTER_SIZE) ; - *inum_ret = *inum_ret + 1 ; - } /* end for */ -} /* end of ADF_Children_IDs */ -/* end of file ADF_Children_IDs.c */ -/* file ADF_Create.c */ -/*********************************************************************** -ADF Create: - -Create a Node. Create a new node (not a link-node) as a child of a -given parent. Default values in this new node are: - label=blank, - number of sub-nodes = 0, - data-type = "MT", - number of dimensions = 0, - data = NULL. - -ADF_Create( PID, name, ID, error_return ) -input: const double PID The ID of the parent node, to whom we - are creating a new child node. -input: const char *name The name of the new child. -output: double *ID The ID of the newly created node. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADF_Create( - const double PID, - const char *name, - double *ID, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER parent_block_offset, child_block_offset ; -struct DISK_POINTER sub_node_entry_location ; -struct NODE_HEADER parent_node, child_node ; -struct SUB_NODE_TABLE_ENTRY sub_node_entry ; -int i, name_length, name_start, found ; -double LID ; - -ADFI_check_string_length( name, ADF_NAME_LENGTH, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( ID == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( PID, &LID, &file_index, &parent_block_offset, - &parent_node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - - /** Initialize node header **/ -ADFI_fill_initial_node_header( &child_node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Skip any leading blanks in the name **/ -name_start = 0 ; -while( name[ name_start ] == ' ' ) { - name_start++ ; - } /* end while */ -name_length = strlen( &name[ name_start ] ) ; -if( name_length > ADF_NAME_LENGTH ) { - *error_return = STRING_LENGTH_TOO_BIG ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Check for uniqueness and legality of the name **/ -ADFI_check_4_child_name( file_index, &parent_block_offset, - &name[ name_start ], &found, &sub_node_entry_location, - &sub_node_entry, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -if( found == 1 ) { - *error_return = DUPLICATE_CHILD_NAME ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -for ( i=0; i < name_length; i++ ) { - if ( ! isprint ( name[ name_start + i ] ) || - name[ name_start + i ] == '/' ) { - *error_return = INVALID_NODE_NAME; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - } /* end for */ - - /** Assign the name to the new node **/ -strncpy( child_node.name, &name[ name_start ], name_length ) ; - - /** Allocate disk space for the new node **/ -ADFI_file_malloc( file_index, NODE_HEADER_SIZE, &child_block_offset, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Write out the new node header **/ -ADFI_write_node_header( file_index, &child_block_offset, &child_node, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** OK, new node is on disk. Now, update the list of - children for the parent... - **/ -ADFI_add_2_sub_node_table( file_index, &parent_block_offset, - &child_block_offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Return the ID of the new child **/ -ADFI_file_block_offset_2_ID( file_index, child_block_offset.block, - child_block_offset.offset, ID, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -/** Write modification time in ADF_Close, otherwise NFS performance is - even worse than normal -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; */ - -} /* end of ADF_Create */ -/* end of file ADF_Create.c */ -/* file ADF_Database_Close.c */ -/*********************************************************************** -ADF Database Close: - -Close an opened database. If the ADF database spans multiple files, -then all files used will also be closed. If an ADF file which is -linked to by this database is also opened through another -database, only the opened file stream associated with this database -will be closed. - -ADF_Database_Close( Root_ID, error_return ) -input: const double Root_ID Root-ID of the ADF database. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Database_Close( - const double Root_ID, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; - -*error_return = NO_ERROR ; - - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( Root_ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Write modification time in ADF_Database_Close but nowhere else, - otherwise NFS performance is even worse than normal */ -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Close the ADF file (which may close other sub-files) **/ -ADFI_close_file( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -} /* end of ADF_Database_Close */ -/* end of file ADF_Database_Close.c */ -/* file ADF_Database_Delete.c */ -/*********************************************************************** -ADF Database Delete: - -Delete an existing database. This will delete one or more ADF files -which are linked together under file top ADF file named "filename". - -ADF_Database_Delete( filename, error_return ) -input: char *filename Filename of the ADF database to delete. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Database_Delete( - const char *filename, - int *error_return ) -{ -ADFI_check_string_length( filename, ADF_FILENAME_LENGTH, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -fprintf(stderr,"Subroutine ADF_Database_Delete is not yet implemented...\n" ) ; -*error_return = UNIMPLEMENTED_CODE ; -CHECK_ADF_ABORT( *error_return ) ; -} /* end of ADF_Database_Delete */ -/* end of file ADF_Database_Delete.c */ -/* file ADF_Database_Garbage_Collection.c */ -/*********************************************************************** -ADF Database Garbage Collection: - -Garbage Collection. This capability will most likely be implemented -internally and will not be user-callable. - -ADF_Database_Garbage_Collection( ID, error_return ) -input: const double ID The ID of a node in the ADF file in which - to do garbage collection. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Database_Garbage_Collection( - const double ID, - int *error_return ) -{ -fprintf(stderr, -"Subroutine ADF_Database_Garbage_Collection is not yet implemented...\n" ) ; -*error_return = UNIMPLEMENTED_CODE ; -CHECK_ADF_ABORT( *error_return ) ; -} /* end of ADF_Database_Garbage_Collection */ - -/* end of file ADF_Database_Garbage_Collection.c */ -/* file ADF_Database_Get_Format.c */ -/*********************************************************************** -ADF Database Get Format: - -Get the data format used in an existing database. - -ADF_Database_Get_Format( Root_ID, format, error_return ) -input: const double Root_ID The root_ID of the ADF file. -output: char *format See format for ADFDOPN. Maximum of 20 - characters returned. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Database_Get_Format( - const double Root_ID, - char *format, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct FILE_HEADER file_header ; - -if( format == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( Root_ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get node_header for the node **/ -ADFI_read_file_header( file_index, &file_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -#define EVAL_2_BYTES( C0, C1 ) (((C0)<<8)+((C1))) - -switch( EVAL_2_BYTES( file_header.numeric_format, file_header.os_size ) ) { - case EVAL_2_BYTES( 'B', 'L' ) : - strcpy( format, IEEE_BIG_32_FORMAT_STRING ) ; - - break ; - - case EVAL_2_BYTES( 'L', 'L' ) : - strcpy( format, IEEE_LITTLE_32_FORMAT_STRING ) ; - break ; - - case EVAL_2_BYTES( 'B', 'B' ) : - strcpy( format, IEEE_BIG_64_FORMAT_STRING ) ; - - break ; - - case EVAL_2_BYTES( 'L', 'B' ) : - strcpy( format, IEEE_LITTLE_64_FORMAT_STRING ) ; - break ; - - case EVAL_2_BYTES( 'C', 'B' ) : - strcpy( format, CRAY_FORMAT_STRING ) ; - break ; - - case EVAL_2_BYTES( 'N', 'L' ) : - case EVAL_2_BYTES( 'N', 'B' ) : - strcpy( format, NATIVE_FORMAT_STRING ) ; - break ; - - default: - *error_return = ADF_FILE_FORMAT_NOT_RECOGNIZED ; - return ; - - } /* end switch */ - -} /* end of ADF_Database_Get_Format */ -/* end of file ADF_Database_Get_Format.c */ -/* file ADF_Database_Open.c */ -/*********************************************************************** -ADF Database Open: - -Open a database. Open either a new or an existing ADF file. If links to -other ADF files are used, these additional file will be opened -automatically as required. - -ADF_Database_Open( filename, status, format, root_ID, error_return) -input: const char *filename Not used if status SCRATCH is used. - Filename must be a legal name and may include a relative or - absolute path. It must be directly usable by the C fopen() - system routine. - -input: const char *status_in Like FORTRAN OPEN() status. - Allowable values are: - READ_ONLY - File must exist. Writing NOT allowed. - OLD - File must exist. Reading and writing allowed. - NEW - File must not exist. - SCRATCH - New file. Filename is ignored. - UNKNOWN - OLD if file exists, else NEW is used. - -input: const char *format Specifies the numeric format for the - file. If blank or NULL, the machine's native format is - used. This field is only used when a file is created. - NATIVE - Determine the format on the machine. If the - native format is not one of the formats - supported, the created file cannot be used on - other machines. - IEEE_BIG - Use the IEEE big ENDIAN format. - IEEE_LITTLE - Use the IEEE little ENDIAN format. - CRAY - Use the native Cray format. - -output: double *root_ID Root-ID of the opened ADF database. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -ADF_FILE_STATUS_NOT_RECOGNIZED -REQUESTED_NEW_FILE_EXISTS -FILE_OPEN_ERROR -***********************************************************************/ -void ADF_Database_Open( - const char *filename, - const char *status_in, - const char *format, - double *Root_ID, - int *error_return ) -{ -int iret ; -int error_dummy ; -char machine_format, format_to_use, os_to_use ; -char *status ; -int formats_compare ; -unsigned int file_index ; -unsigned int file_minor_version, lib_minor_version ; -struct FILE_HEADER file_header ; -struct NODE_HEADER node_header ; -struct FREE_CHUNK_TABLE free_chunk_table ; - -file_header.tag0[0] = '\0' ; - -status = (char *)status_in ; -if( status == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( Root_ID == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** DO NOT Check filename for NULL here, it may NOT be used... **/ - -*error_return = NO_ERROR ; - - /** Get this machine's numeric format **/ - ADFI_figure_machine_format( format, &machine_format, &format_to_use, - &os_to_use, error_return ) ; - -if( ADFI_stridx_c( status, "SCRATCH" ) != 0 ) { - ADFI_check_string_length( filename, ADF_FILENAME_LENGTH, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -ADFI_check_string_length( status, ADF_STATUS_LENGTH, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Determine the requested STATUS **/ -if( ADFI_stridx_c( status, "UNKNOWN" ) == 0 ) { - /** Determine the assessability of the filename **/ - iret = access( filename, F_OK ) ; - if( iret != 0 ) /* File does not exist, set status to NEW */ - status = "NEW" ; - else - status = "OLD" ; - } /* end else if */ - -if( (ADFI_stridx_c( status, "READ_ONLY" ) == 0) || - (ADFI_stridx_c( status, "OLD" ) == 0) ) { - /** Determine the assessability of the filename **/ - iret = access( filename, F_OK ) ; - if( iret != 0 ) { /* File does not exist, this is BAD for OLD */ - *error_return = REQUESTED_OLD_FILE_NOT_FOUND ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** open the file **/ - ADFI_open_file( filename, status, -1, &file_index, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else if */ - -else if( (ADFI_stridx_c( status, "NEW" ) == 0) || - (ADFI_stridx_c( status, "SCRATCH" ) == 0) ) { - /** Determine the assessability of the filename **/ - if( ADFI_stridx_c( status, "NEW" ) == 0 ) { - iret = access( filename, F_OK ) ; - if( iret == 0 ) { /* File exists, this is BAD for NEW */ - *error_return = REQUESTED_NEW_FILE_EXISTS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - if( errno != ENOENT ) { - *error_return = FILE_OPEN_ERROR ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - } /* end if */ - - /** Compose the file header **/ - ADFI_fill_initial_file_header( format_to_use, os_to_use, - ADF_D_identification, - &file_header, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Open the new file **/ - ADFI_open_file( filename, status, -1, &file_index, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** write out the file header **/ - ADFI_write_file_header( file_index, &file_header, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Compose Initial root-node header **/ - ADFI_fill_initial_node_header( &node_header, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - strncpy( node_header.name, ROOT_NODE_NAME, strlen( ROOT_NODE_NAME )) ; - strncpy( node_header.label, ROOT_NODE_LABEL, strlen( ROOT_NODE_LABEL ) ) ; - - /** Write out the root-node header **/ - ADFI_write_node_header( file_index, &file_header.root_node, - &node_header, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Compose Initial Free-Chunk Table **/ - ADFI_fill_initial_free_chunk_table( &free_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write out Free-Chunk Table **/ - ADFI_write_free_chunk_table( file_index, &free_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else if */ - -else { - *error_return = ADF_FILE_STATUS_NOT_RECOGNIZED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Initilaize the link separator for the file **/ -strcpy ( link_separator[file_index], ">" ) ; - - /** Read the header of the ADF file **/ -if( file_header.tag0[0] == '\0' ) { - ADFI_read_file_header( file_index, &file_header, error_return ) ; - if ( *error_return != NO_ERROR ) goto Open_Error ; - - /** Check Database version numbers for compatibility **/ - if( file_header.what[25] != ADF_D_identification[25] ) { -/* Look at major revision letter: version in file must equal what - this library would write unless there is a policy decision to - support both versions. */ - - *error_return = INVALID_VERSION ; - if ( *error_return != NO_ERROR ) goto Open_Error ; - } /* end if */ - - if( file_header.what[28] == '>' ) - { -/* we have an old file created before this version numbering scheme - was instituted - probably will not work */ - *error_return = INVALID_VERSION ; - if ( *error_return != NO_ERROR ) goto Open_Error ; - } - else /* check version number for file format compatibility */ - { -/* Look at minor revision number: version in file must be less than - or equal to what this library would write. */ - - ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &file_header.what[26], - &file_minor_version, error_return) ; - if ( *error_return != NO_ERROR ) goto Open_Error ; - - ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &ADF_D_identification[26], - &lib_minor_version, error_return) ; - if ( *error_return != NO_ERROR ) goto Open_Error ; - if( file_minor_version > lib_minor_version ) { - *error_return = INVALID_VERSION ; - if ( *error_return != NO_ERROR ) goto Open_Error ; - } /* end if */ - - if( file_minor_version < lib_minor_version ) { - /** If a new feature is added which requires that the file version - be changed then it is done here. Care must be take not to - break forward compatibility by changing the file version. Thus - new features may not be available for older file versions. - For instance version A1 files cannot be upgraded to version - A2 and above since a change was made to how links were store - and the file version is used to decide how to treat links. **/ - if ( ADF_D_identification[25] == 'A' && file_minor_version > 1 ) { - ADFI_remember_version_update( file_index, ADF_D_identification, - error_return ) ; - - if ( *error_return != NO_ERROR ) goto Open_Error ; - } /* end if */ - - /** The link separator was changed from " " to ">" in order - to support blanks in filenames under Windows. This change - is for version A02 and higher **/ - if ( ADF_D_identification[25] == 'A' && file_minor_version < 2 ) { - strcpy ( link_separator[file_index], " " ) ; - } /* end if */ - - } /* end if */ - } /* end if */ - } /* end if */ - - /** get the root ID for the user **/ -ADFI_file_block_offset_2_ID( file_index, file_header.root_node.block, - file_header.root_node.offset, Root_ID, error_return ) ; -if ( *error_return != NO_ERROR ) goto Open_Error ; - - /** Remember the file's data format **/ -ADFI_remember_file_format( file_index, file_header.numeric_format, - file_header.os_size, error_return ) ; -if ( *error_return != NO_ERROR ) goto Open_Error ; - - /** check machine modes, if machine is native the file must be !! **/ -ADFI_file_and_machine_compare( file_index, NULL, &formats_compare, - error_return ) ; -if ( *error_return != NO_ERROR ) goto Open_Error ; - - return ; - - Open_Error: - /** Close the ADF file and free its index **/ -ADFI_close_file( file_index, &error_dummy ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Database_Open */ -/* end of file ADF_Database_Open.c */ -/* file ADF_Database_Set_Format.c */ -/*********************************************************************** -ADF Database Set Format: - -Set the data format used in an existing database. - Note: Use with extreme caution. Needed only - for data conversion utilities and NOT intended - for the general user!!! - -ADF_Database_Set_Format( Root_ID, format, error_return ) -input: const double Root_ID The root_ID if the ADF file. -input: const char *format See format for ADFDOPN. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Database_Set_Format( - const double Root_ID, - const char *format, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct FILE_HEADER file_header ; -char machine_format, format_to_use, os_to_use ; - -ADFI_check_string_length( format, ADF_FORMAT_LENGTH, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( Root_ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get node_header for the node **/ -ADFI_read_file_header( file_index, &file_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_figure_machine_format( format, &machine_format, &format_to_use, - &os_to_use, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -file_header.numeric_format = format_to_use ; -file_header.os_size = os_to_use ; - - /** Get modification date to be updated with the header **/ -ADFI_get_current_date ( file_header.modification_date ); - - /** Now write the disk header out... **/ -ADFI_write_file_header( file_index, &file_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_remember_file_format( file_index, format_to_use, os_to_use, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Database_Set_Format */ -/* end of file ADF_Database_Set_Format.c */ -/* file ADF_Database_Version.c */ -/*********************************************************************** -ADF Database Version: - -Get ADF File Version ID. This is the version number of the ADF library -routines which created an ADF database. Modified ADF databases -will take on the version ID of the current ADF library version if -it is higher than the version indicated in the file. - The format of the version ID is: "ADF Database Version 000.01" - -ADF_Database_Version( Root_ID, version, creation_date, modification_date, - error_return ) -input: const double Root_ID The ID of the root node in the ADF file. -output: char *version A 32-byte character string containing the - version ID. -output: char *creation_date A 32-byte character string containing the - creation date of the file. -output: char *modification_date A 32-byte character string containing the - last modification date of the file. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Database_Version( - const double Root_ID, - char *version, - char *creation_date, - char *modification_date, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct FILE_HEADER file_header ; - -if( (version == NULL) || (creation_date == NULL) || - (modification_date == NULL) ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( Root_ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get node_header for the node **/ -ADFI_read_file_header( file_index, &file_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -*error_return = NO_ERROR ; - /** Convert the "what" string into a C string **/ -ADFI_string_2_C_string( &file_header.what[4], strcspn ( file_header.what, ">" ) - 4, - version, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Convert the creation date string into a C string **/ -ADFI_string_2_C_string( file_header.creation_date, 28, - creation_date, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Convert the modification date string into a C string **/ -ADFI_string_2_C_string( file_header.modification_date, 28, - modification_date, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Database_Version */ -/* end of file ADF_Database_Version.c */ -/* file ADF_Delete.c */ -/*********************************************************************** -ADF Delete: - -Delete a Node. If the node is NOT a link, then the specified node and all -sub-nodes anywhere under it are also deleted. For a link, and also -for links farther down in the tree, the link-node will be deleted, -but the node which the link is linked to is not affected. When a -node is deleted, other link-nodes which point to it are left -dangling. For example, if N13 is deleted, then L1 and L2 point to a -non-existing node. This is OK until L1 and L2 are used. - -ADF_Delete( PID, ID, error_return ) -input: const double PID The ID of the node's parent. -input: const double ID The ID of the node to use. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Delete( - const double PID, - const double ID, - int *error_return ) -{ -int num_ids , i, link_path_length ; -double *ids ; -unsigned int file_index ; -struct DISK_POINTER parent ; -struct DISK_POINTER child ; -struct NODE_HEADER node_header ; - - /** Don't use ADFI_chase_link() - delete link nodes but NOT the - nodes they are linked too **/ - -ADFI_ID_2_file_block_offset( ID, &file_index, &child.block, &child.offset, - error_return ) ; - -CHECK_ADF_ABORT( *error_return ) ; - -ADF_Is_Link( ID, &link_path_length, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_read_node_header( file_index, &child, &node_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Delete node data **/ - -if( link_path_length > 0 ) { /** this node IS a link **/ - /** Delete the link path data for this node **/ - ADFI_delete_data( file_index, &node_header, error_return ) ; - } -else { /** this node is NOT a link **/ - - /** Recursively delete all sub-nodes (children) of this node **/ - ADFI_get_direct_children_ids( file_index, &child, &num_ids, &ids, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - for( i=0; i 0 ) { - free( ids ) ; - } /* end if */ - - /** Delete all data for this node **/ - - ADF_Put_Dimension_Information( ID, "MT", 0, (int *)0, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if-else */ - - - /** Disassociate node from parent **/ -ADFI_ID_2_file_block_offset( PID, &file_index, - &parent.block, &parent.offset, error_return ) ; - /* file_index should be same as before since parent and child - should be in the same file */ -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_delete_from_sub_node_table( file_index, &parent, &child, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Delete this node's sub node table **/ -if( node_header.entries_for_sub_nodes > 0 ) { - ADFI_delete_sub_node_table( file_index, &node_header.sub_node_table, - node_header.entries_for_sub_nodes, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Delete node header from disk **/ -ADFI_file_free( file_index, &child, 0, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -/** Write modification time in ADF_Database_Close, otherwise NFS performance is - even worse than normal -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; */ - -} /* end of ADF_Delete */ -/* end of file ADF_Delete.c */ -/* file ADF_Error_Message.c */ -/*********************************************************************** -ADF Error message: - -Return Error Message. Given an error_return from an ADF routine, -get a textual description of the error. - -ADF_Error_Message( error_return, error_string ) -input: const int error_return An ADF-generated error code. -output: char *error_string An 80-byte description of the specified error. - If the number is NULL, then print out error message. -***********************************************************************/ -void ADF_Error_Message( - const int error_return_input, - char *error_string ) -{ -char err_msg_str[ADF_MAX_ERROR_STR_LENGTH+1] ; - - /** If return pointer is NULL, print message to stdout **/ -if( error_string == NULL ) { - ADF_Error_Message( error_return_input, err_msg_str ) ; - fprintf(stderr,"%s\n", err_msg_str ) ; - return ; - } /* end if */ - - /** NO_ERROR is NOT zero for pointer-assignment checking **/ -if( error_return_input == NO_ERROR ) { - strcpy( error_string, ADF_error_string[ 0 ] ) ; - } /* end if */ - /** Check range of error code **/ -else if( (error_return_input <= 0) || - ((unsigned)error_return_input >= sizeof( ADF_error_string )/sizeof(char *) - 1 ) ) { - sprintf( error_string, "ADF: Unrecognized error number %d.", - error_return_input ) ; - } /* end else if */ - /** Error-code good, copy it for the user **/ -else { - strcpy( error_string, ADF_error_string[error_return_input] ) ; - } /* end else */ -} /* end of ADF_Error_Message */ -/* end of file ADF_Error_Message.c */ -/* file ADF_Flush_to_Disk.c */ -/*********************************************************************** -ADF Flush to Disk: - -Flush data to disk. This routine is used force any modified information -to be flushed to the physical disk. This ensures that data will not -be lost if a program aborts. This control of when to flush all data -to disk is provided to the user rather than to flush the data every -time it is modified, which would result in reduced performance. - -ADF_Flush_to_Disk( ID, error_return ) -input: const double ID The ID of a node in the ADF file to flush. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Flush_to_Disk( - const double ID, - int *error_return ) -{ -double LID ; -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; - - ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - ADFI_fflush_file( file_index, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; -} /* end of ADF_Flush_to_Disk */ -/* end of file ADF_Flush_to_Disk.c */ -/* file ADF_Get_Data_Type.c */ -/*********************************************************************** -ADF Get Data Type: - -Get Data Type. Return the 32 character string in a node's data-type field. -In C, the name will be null terminated after the last non-blank character. -A maximum of 33 characters may be used (32 for the name plus 1 for the null). - -ADF_Get_Data_Type( ID, data_type, error_return ) -input: const double ID The ID of the node to use. -output: char *data_type The 32-character data-type of the node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Data_Type( - const double ID, - char *data_type, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -double LID ; - -if( data_type == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Copy the blank-filled data-type into a C string **/ -ADFI_string_2_C_string( node.data_type, ADF_DATA_TYPE_LENGTH, data_type, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Get_Data_Type */ -/* end of file ADF_Get_Data_Type.c */ -/* file ADF_Get_Dimension_Values.c */ -/*********************************************************************** -ADF Get Dimension Values: - -Get Dimension Values. Return the dimension values for a node. Values -will be in the range of 1 to 100,000. Values will only be returned -for the number of dimensions defined in the node. If the number -of dimensions for the node is zero, an error is returned. - -ADF_Get_Dimension_Values( ID, dim_vals, error_return ) -input: const double ID The ID of the node to use. -output: int dim_vals[] Array for returned dimension values. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Dimension_Values( - const double ID, - int dim_vals[], - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -int i ; -double LID ; - -if( dim_vals == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Check for zero dimensions **/ -if( node.number_of_dimensions == 0 ) { - *error_return = ZERO_DIMENSIONS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Check for too-large-of dimensions **/ -if( node.number_of_dimensions > ADF_MAX_DIMENSIONS ) { - *error_return = BAD_NUMBER_OF_DIMENSIONS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Copy the dimension information **/ -for( i=0; i<(int)node.number_of_dimensions; i++ ) - dim_vals[i] = node.dimension_values[i] ; - -} /* end of ADF_Get_Dimension_Values */ -/* end of file ADF_Get_Dimension_Values.c */ -/* file ADF_Get_Error_State.c */ -/*********************************************************************** -ADF Get Error State: - -Get Error State. Return the current error state. - -ADF_Get_Error_State( error_state, error_return ) -output: int *error_state Flag for ABORT on error (1) or return error - status (0). -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Error_State( - int *error_state, - int *error_return ) -{ -if( error_state == 0L ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -if( ADF_abort_on_error == TRUE ) - *error_state = 1 ; -else - *error_state = 0 ; - -} /* end of ADF_Get_Error_State */ -/* end of file ADF_Get_Error_State.c */ -/* file ADF_Get_Label.c */ -/*********************************************************************** -ADF Get Label: - -Return the 32 character string in a node's label field. - -ADF_Get_Label( ID, label, error_return ) -input: const double ID The ID of the node to use. -output: char *label The 32-character label of the node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Label( - const double ID, - char *label, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -double LID ; - -if( label == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Copy the blank-filled label type into a C string **/ -ADFI_string_2_C_string( node.label, ADF_LABEL_LENGTH, label, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Get_Label */ -/* end of file ADF_Get_Label.c */ -/* file ADF_Get_Link_Path.c */ -/*********************************************************************** -ADF Get Link path: - -Get path information from a link. If the node is a link-node, return -the path information. Else, return an error. If the link is in the same -file, then the filename returned is zero length. - -ADF_Get_Link_Path( ID, file, name_in_file, error_return ) -input: const double ID The ID of the node to use. -output: char *file The returned filename -output: char *name_in_file The returned name of node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Link_Path( - const double ID, - char *file, - char *name_in_file, - int *error_return ) -{ -unsigned int file_index ; -int file_bytes, machine_bytes, total_bytes ; -char file_format, machine_format ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node_header ; -struct TOKENIZED_DATA_TYPE tokenized_data_type[ 2 ] ; -char link_data[ADF_FILENAME_LENGTH + ADF_MAX_LINK_DATA_SIZE + 1 + 1] ; -size_t lenfilename ; - -if( file == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( name_in_file == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get node_header for the node **/ -ADFI_read_node_header( file_index, &block_offset, &node_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( (node_header.data_type[0] != 'L') || (node_header.data_type[1] != 'K')) { - *error_return = NODE_IS_NOT_A_LINK ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Get tokenized datatype **/ -ADFI_evaluate_datatype( file_index, node_header.data_type, - &file_bytes, &machine_bytes, tokenized_data_type, - &file_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -total_bytes = file_bytes * node_header.dimension_values[0] ; -ADFI_read_data_chunk( file_index, &node_header.data_chunks, - tokenized_data_type, file_bytes, total_bytes, - 0, total_bytes, link_data, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /* NULL terminate the string */ -link_data[ node_header.dimension_values[0] ] = '\0' ; - -file[0] = '\0' ; -name_in_file[0] = '\0' ; - - /** look for file/link delimiter **/ -lenfilename = strcspn ( link_data, link_separator[file_index] ) ; - -if ( lenfilename == 0 ) /** no filename **/ -{ - strcpy( name_in_file, &link_data[1] ); -} -else if ( lenfilename > 0 && lenfilename == strlen( link_data ) ) -{ - strcpy( file, link_data) ; /** no link ? **/ -} -else -{ - strncpy( file, link_data, lenfilename) ; - file[lenfilename] = '\0'; - strcpy( name_in_file, &link_data[lenfilename+1] ); -} /* end if */ - -} /* end of ADF_Get_Link_Path */ -/* end of file ADF_Get_Link_Path.c */ -/* file ADF_Get_Name.c */ -/*********************************************************************** -ADF get name: - -Get Name of a Node. Given a node's ID, return the 32 character name of -that node. - -ADF_Get_Name( ID, name, error_return ) -input: const double ID The ID of the node to use. -output: char *name The simple name of the node (no path info). -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Name( - const double ID, - char *name, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; - -if( name == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get node_header for the node **/ -ADFI_read_node_header( file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Copy the blank-filled name into a C string **/ -ADFI_string_2_C_string( node.name, ADF_NAME_LENGTH, name, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Get_Name */ -/* end of file ADF_Get_Name.c */ -/* file ADF_Get_Node_ID.c */ -/*********************************************************************** -ADF get Node ID: - -Get Unique-Identifier of a Node. Given a parent node ID and a name of -a child node, this routine returns the ID of the child. If the child -node is a link, the ID of the link node is returned (not the ID of the -linked-to node) - otherwise there would be no way to obtain the ID -of a link node. - -The child name may be a simple name or a compound path name. -If the name is a compound path name and it begins with a '/', -then the parent node ID may be any valid ID in the same database -as the first node in the path. If the name is only "/" and the -parent ID is any valid ID in the database, the root ID is returned. -If the name is a compound path name and does not begin with a '/', -then the parent node ID is the ID of the parent of the first node -in the path. If the path name contains a link node (except for -the ending leaf node), then the link is followed. - - -ADF_Get_Node_ID( PID, name, ID, error_return ) -input: const double PID The ID of name's parent. -input: const char *name The name of the node. Compound - names including path information use a slash "/" notation between - node names. If a leading slash is used, then PID can be any - valid node ID in the ADF database of the first name in the path. - -output: double *ID The ID of the named node. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADF_Get_Node_ID( - const double PID, - const char *name, - double *ID, - int *error_return ) -{ -double LID ; -int found ; -int name_length ; -unsigned int file_index ; -struct DISK_POINTER parent_block_offset, sub_node_entry_location ; -struct SUB_NODE_TABLE_ENTRY sub_node_entry ; -struct NODE_HEADER node_header ; -char *name_tmp, *name_ptr, *name_pos ; - -if( name == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -name_length = strlen( name ) ; -if( name_length == 0 ) { - *error_return = STRING_LENGTH_ZERO ; - return ; - } /* end if */ - -if( ID == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -*ID = PID ; /** initialize the ID variable to use in intermediate steps **/ - -if( name[0] == '/' ) { /** start at the root node **/ - /** according to user documentation, PID can be any valid node - in the database, but we need to use it to get the root ID - in order to start at the top **/ - - ADF_Get_Root_ID( PID, ID, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** This is the root-node, return the Root-ID **/ - if( name[ 1 ] == '\0' ) { - return ; /** NOT an error, just done and need to get out **/ - } /* end if */ - } /* end if */ - -name_tmp = (char *) malloc( (name_length + 1) * sizeof( char ) ) ; -if( name_tmp == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -strcpy( name_tmp, name ) ; - - /** start search for tokens (names separated by '/') **/ -name_pos = name_tmp ; -name_ptr = ADFI_strtok( name_tmp, &name_pos, "/" ) ; -if( name_ptr == NULL ) { /** this should never happen but check anyway **/ - *error_return = INVALID_NODE_NAME ; - CHECK_ADF_ABORT1( *error_return ) ; - } /* end if */ - - /** Get file-index, etc. to start. Note: Parent ID may be a link **/ -ADFI_chase_link( *ID, &LID, &file_index, - &parent_block_offset, &node_header, error_return ) ; -CHECK_ADF_ABORT1( *error_return ) ; -*ID = LID ; - - /** Track through the possible compound name string **/ -while( name_ptr ) { - - /** Find this child under the current parent **/ - ADFI_check_4_child_name( file_index, &parent_block_offset, name_ptr, &found, - &sub_node_entry_location, &sub_node_entry, error_return ) ; - CHECK_ADF_ABORT1( *error_return ) ; - - if( found == 0 ) { /** Child NOT found **/ - *error_return = CHILD_NOT_OF_GIVEN_PARENT ; - CHECK_ADF_ABORT1( *error_return ) ; - } /* end if */ - - /** create the child ID **/ - ADFI_file_block_offset_2_ID( file_index, - sub_node_entry.child_location.block, - sub_node_entry.child_location.offset, ID, error_return ) ; - - /** Get the next node-name token (NULL if no more). This is needed - for the while-loop check and normally would be done at the - end of the loop, but it is useful in the next step to see if - there are any more branches in the path. **/ - name_ptr = ADFI_strtok( name_tmp, &name_pos, "/" ) ; - - /** If this node is the last in the path it may be a link, but - there needs to be a mechanism by which a link's ID can - be determined and so we cannot follow the link at this time. **/ - if( name_ptr != NULL ) { - /* Make sure we have a real ID so we can continue the search */ - ADFI_chase_link( *ID, &LID, &file_index, &parent_block_offset, - &node_header, error_return ) ; - CHECK_ADF_ABORT1( *error_return ) ; - *ID = LID ; - - /** This child now becomes the parent. Do it again... **/ - ADFI_ID_2_file_block_offset( *ID, &file_index, - &parent_block_offset.block, - &parent_block_offset.offset, - error_return ) ; - CHECK_ADF_ABORT1( *error_return ) ; - } /* end if */ - - } /* end while */ - -free( name_tmp ) ; - -} /* end of ADF_Get_Node_ID */ -/* end of file ADF_Get_Node_ID.c */ -/* file ADF_Get_Number_of_Dimensions.c */ -/*********************************************************************** -ADF Get Number of Dimensions: - -Get Number of Dimensions. Return the number of data dimensions -used in a node. Valid values are from 0 to 12. - -ADF_Get_Number_of_Dimensions( ID, num_dims, error_return) -input: const double ID The ID of the node to use. -output: int *num_dims The returned number of dimensions. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Number_of_Dimensions( - const double ID, - int *num_dims, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -double LID ; - -if( num_dims == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, - &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Return the number of dimensions **/ -*num_dims = node.number_of_dimensions ; - -} /* end of ADF_Get_Number_of_Dimensions */ -/* end of file ADF_Get_Number_of_Dimensions.c */ -/* file ADF_Get_Root_ID.c */ -/*********************************************************************** -ADF_Get_Root_ID: - Get root-ID for an ADF system from any ID in the system. - -input: const double ID The ID of the node to use. -output: *double Root_ID The returned ID of the root node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Root_ID( - const double ID, - double *Root_ID, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct FILE_HEADER file_header ; - -if( Root_ID == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Get the file ID **/ -ADFI_ID_2_file_block_offset( ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Use the file header to find the root ID **/ -ADFI_read_file_header( file_index, &file_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Format the root ID **/ -ADFI_file_block_offset_2_ID( file_index, file_header.root_node.block, - file_header.root_node.offset, Root_ID, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Get_Root_ID */ -/* end of file ADF_Get_Root_ID.c */ -/* file ADF_Is_Link.c */ -/*********************************************************************** -ADF Is Link: - -Test if a Node is a link. If the actual data-type of the node is "LK" -(created with ADF_Link), return the link path length. Otherwise, -return 0. - -ADF_Is_Link( ID, link_path_length, error_return ) -input: const double ID The ID of the node to use. -output: int *link_path_length 0 if the node is NOT a link. If the - node is a link, the length of the path string is returned. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Is_Link( - const double ID, - int *link_path_length, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node_header ; - -if( link_path_length == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get node_header for the node **/ -ADFI_read_node_header( file_index, &block_offset, &node_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( (node_header.data_type[0] == 'L') && (node_header.data_type[1] == 'K')) - *link_path_length = node_header.dimension_values[0] ; -else - *link_path_length = 0 ; - -} /* end of ADF_Is_Link */ -/* end of file ADF_Is_Link.c */ -/* file ADF_Library_Version.c */ -/*********************************************************************** -ADF Library Version: - -Get ADF Library Version ID. This is the version number of the ADF -library routines which your program is currently using. - The format of the version ID is: "ADF Library Version 000.01" - -ADF_Library_Version( version, error_return ) -output: char *version A 32-byte character string containing - the ADF Library version ID information. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Library_Version( - char *version, - int *error_return ) -{ - -int lversion; - -if( version == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Copy the proper portion of the "what" string **/ -strcpy ( version, &ADF_L_identification[4] ) ; -lversion = strlen ( version ) ; -version[lversion-1] = '\0' ; /** remove trailing "what" delimiter ('>') **/ -} /* end of ADF_Library_Version */ -/* end of file ADF_Library_Version.c */ -/* file ADF_Link.c */ -/*********************************************************************** -ADF Link: - -Create a link. Note: The Node linked to does not have to exist when the -link is created (but it may exist and that is OK). However, when -the link is used, an error will occur if the linked to node does not -exist. - -ADF_Link( PID, name, file, name_in_file, ID, error_return ) -input: const double PID The ID of the Node's parent. -input: const char *name The name of the link node. -input: const char *file The filename to use for the link (directly - usable by a C open() routine). If blank (null), - the link will be within the same file. - -input: const char *name_in_file The name of the node which - the link will point to. This can be a simple or compound name. - -output: double ID The returned ID of the link-node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Link( - const double PID, - const char *name, - const char *file_name, - const char *name_in_file, - double *ID, - int *error_return ) -{ -char link_data[ADF_FILENAME_LENGTH + - ADF_MAX_LINK_DATA_SIZE + 2] ; -int null_filename = FALSE ; -int filename_length, linked_to_length, data_length ; -int dim_vals[1] ; -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node_header ; - - /** Don't check file since it can be a NULL pointer **/ - -ADFI_check_string_length( name, ADF_NAME_LENGTH, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_check_string_length( name_in_file, ADF_MAX_LINK_DATA_SIZE, error_return ); -CHECK_ADF_ABORT( *error_return ) ; - -ADF_Is_Link( PID, &linked_to_length, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -if ( linked_to_length > 0 ) { - *error_return = LINKS_TOO_DEEP ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Create the node in the normal way **/ -ADF_Create( PID, name, ID, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( *ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Add the file and linked-to name as data in the child **/ -ADFI_check_string_length( file_name, ADF_FILENAME_LENGTH, error_return ) ; -if( *error_return != NO_ERROR ) { - null_filename = TRUE ; - filename_length = 0 ; - } /* end if */ -else { - filename_length = strlen( file_name) ; - } /* end else */ -linked_to_length = strlen( name_in_file ) ; - -data_length = filename_length + linked_to_length + 1 ; -if( data_length > ADF_FILENAME_LENGTH + ADF_MAX_LINK_DATA_SIZE + 1 ) { - *error_return = STRING_LENGTH_TOO_BIG ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( null_filename == TRUE ) { - sprintf( link_data, "%s%s", link_separator[file_index], name_in_file ) ; - } /* end if */ -else { - sprintf( link_data, "%s%s%s", file_name, link_separator[file_index], - name_in_file ) ; - } /* end else */ - - /** We must use a datatype of "C1" to put the data into this node. - With a datatype of "Lk" (a link), the written data will go - into the linked-to node (that's the whole point). To set - this up we must be careful... - **/ -dim_vals[0] = data_length ; -ADF_Put_Dimension_Information( *ID, "C1", 1, dim_vals, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADF_Write_All_Data( *ID, link_data, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Change the datatype to be LK, without deleting the data. - We can't use ADF_Put_Dimension_Information since the change - of datatype will delete the data. We must do this manually. - **/ - -ADFI_read_node_header( file_index, &block_offset, &node_header, error_return ); -CHECK_ADF_ABORT( *error_return ) ; - -if( (node_header.data_type[0] != 'C') || (node_header.data_type[1] != '1') || - (node_header.data_type[2] != ' ') ) { - *error_return = INVALID_DATA_TYPE ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -node_header.data_type[0] = 'L' ; -node_header.data_type[1] = 'K' ; -ADFI_write_node_header( file_index, &block_offset, &node_header, error_return ); -CHECK_ADF_ABORT( *error_return ) ; - -/** Write modification time in ADF_Database_Close, otherwise NFS performance is - even worse than normal -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; */ - -} /* end of ADF_Link */ -/* end of file ADF_Link.c */ -/* file ADF_Move_Child.c */ -/*********************************************************************** -ADF Move Child: - -Change Parent (move a Child Node). The node and the 2 parents must -all exist within a single ADF file. If the node is pointed to by a -link-node, changing the node's parent will break the link. - -ADF_Move_Child( PID, ID, NPID, error_return ) -input: double PID The ID of the Node's parent. -input: double ID The ID of the node to use. -input: double NPID The ID of the Node's New Parent -output: int *error_return Error return. -***********************************************************************/ -void ADF_Move_Child( - const double PID, - const double ID, - const double NPID, - int *error_return ) -{ - -unsigned int parent_file_index, child_file_index, - new_parent_file_index, file_index ; -char child_name[ ADF_NAME_LENGTH ] ; -int found ; -struct DISK_POINTER parent, child, new_parent, sub_node_entry_location ; -struct SUB_NODE_TABLE_ENTRY sub_node_entry ; - -*error_return = NO_ERROR ; - -ADFI_ID_2_file_block_offset( PID, &parent_file_index, &parent.block, - &parent.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_ID_2_file_block_offset( ID, &child_file_index, &child.block, - &child.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( child_file_index != parent_file_index ) { - *error_return = NODES_NOT_IN_SAME_FILE ; - CHECK_ADF_ABORT( *error_return ) ; - } - -ADFI_ID_2_file_block_offset( NPID, &new_parent_file_index, &new_parent.block, - &new_parent.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( new_parent_file_index != parent_file_index ) { - *error_return = NODES_NOT_IN_SAME_FILE ; - CHECK_ADF_ABORT( *error_return ) ; - } - -file_index = parent_file_index ; /* use a shorter, more generic name - - file indices should now be the same - for all 3 nodes */ - - /** check that child is really a child of parent **/ -ADF_Get_Name( ID, child_name, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_check_4_child_name( file_index, &parent, child_name, &found, - &sub_node_entry_location, &sub_node_entry, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( found == 0 ) { /* child not found */ - *error_return = CHILD_NOT_OF_GIVEN_PARENT ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** add child to its new parent's sub node table **/ -ADFI_add_2_sub_node_table( file_index, &new_parent, &child, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** remove child from its old parent's sub node table **/ -ADFI_delete_from_sub_node_table( file_index, &parent, &child, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Move_Child */ -/* end of file ADF_Move_Child.c */ -/* file ADF_Number_of_Children.c */ -/*********************************************************************** -ADF Number of Children; - -Get Number of Children of a Node. Return the number of children -nodes directly associated with a parent node. - -ADF_Number_of_Children( ID, num_children, error_return ) -input: const double ID The ID of the node to use. -output: int *num_children The number of children directly - associated with this node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Number_of_Children( - const double ID, - int *num_children, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -double LID ; - -if( num_children == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Return the number of children **/ -*num_children = node.num_sub_nodes ; -} /* end of ADF_Number_of_Children */ -/* end of file ADF_Number_of_Children.c */ -/* file ADF_Put_Dimension_Information.c */ -/*********************************************************************** -ADF Put Dimension Information: - -Set/change the data-type and Dimension Information of a Node. Valid -user-definable data-types are: - -No data MT -Integer 32 I4 -Integer 64 I8 -Unsigned Int 32 U4 -Unsigned Int 64 U8 -Real 32 R4 -Real 64 R8 -Complex 64 X4 -Complex 128 X8 -Character (unsigned byte) C1 -Byte (unsigned byte) B1 -Compound data-types can be used which combine types -("I4,I4,R8"), define an array ("I4[25]"), or a combination of these -("I4,C1[20],R8[3]"). -dims can be a number from 0 to 12. - -dim_vals is an array of integers. The number of integers used is -determined by the dims argument. If dims is zero, the dim_values -are not used. Valid range for dim_values are from 1 to 2,147,483,648. -The total data size, calculated by the data-type-size times the -dimension value(s), cannot exceed 2,147,483,648. - -Note: When this routine is called and the data-type or the -number of dimensions changes, any data currently associated -with the node is lost!! The dimension values can be changed and -the data space will be extended as needed. - -ADF_Put_Dimension_Information( ID, data_type, dims, dim_vals, error_return ) -input: const double ID The ID of the node. -input: const char *data-type The data-type to use. -input: const int dims The number of dimensions this node has. -input: const int dim_vals[] The dimension values for this node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Put_Dimension_Information( - const double ID, - const char *data_type, - const int dims, - const int dim_vals[], - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -struct TOKENIZED_DATA_TYPE - tokenized_data_type[ 1 + (ADF_DATA_TYPE_LENGTH + 1)/3 ] ; -char file_format, machine_format ; -int file_bytes[2], machine_bytes[2] ; -int data_bytes, old_data_bytes ; -int i, datatype_length ; -int preserve_data = FALSE ; -double LID ; - -ADFI_check_string_length( data_type, ADF_DATA_TYPE_LENGTH, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( dim_vals == NULL && dims > 0 ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Check new datatype **/ -ADFI_evaluate_datatype( file_index, data_type, - &file_bytes[0], &machine_bytes[0], - tokenized_data_type, &file_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Look at old datatype **/ -ADFI_evaluate_datatype( file_index, node.data_type, - &file_bytes[1], &machine_bytes[1], - tokenized_data_type, &file_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Calculate new data-size **/ -if( dims < 0 ) { - *error_return = NUMBER_LESS_THAN_MINIMUM ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -if( dims > ADF_MAX_DIMENSIONS) { - *error_return = BAD_NUMBER_OF_DIMENSIONS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** If the number of dimensions is zero, set data-bytes to zero **/ -if( dims == 0 ) - data_bytes = 0 ; -else { /** Calculate the total number of bytes in the data **/ - for( data_bytes=file_bytes[0], i=0; i ADF_NAME_LENGTH ) { - *error_return = STRING_LENGTH_TOO_BIG ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( name_length == 0 ) { - *error_return = STRING_LENGTH_ZERO ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Need to check for uniqueness and legality of the name **/ -ADFI_check_4_child_name( file_index, &parent_block_offset, - &name[ name_start ], &found, &sub_node_entry_location, - &sub_node_entry, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( found == 1 ) { - *error_return = DUPLICATE_CHILD_NAME ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -for ( i=0; i < name_length; i++ ) { - if ( ! isprint ( name[ name_start + i ] ) || - name[ name_start + i ] == '/' ) { - *error_return = INVALID_NODE_NAME; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - } /* end for */ - - /** Confirm that child is from the parent **/ -ADFI_check_4_child_name( file_index, &parent_block_offset, - child_node.name, &found, &sub_node_entry_location, - &sub_node_entry, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( found == 0 ) { - *error_return = CHILD_NOT_OF_GIVEN_PARENT ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( (child_block_offset.block != sub_node_entry.child_location.block) || - (child_block_offset.offset != sub_node_entry.child_location.offset) ) { - *error_return = CHILD_NOT_OF_GIVEN_PARENT ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Copy the name **/ -name_length = strlen( name ) ; -for( i=0; i total_bytes ) { - bytes_to_read = total_bytes - bytes_read ; - } /* end if */ - if( bytes_to_read == 0 ) - break ; - ADFI_read_data_chunk( file_index, &data_chunk_table[i].start, - tokenized_data_type, file_bytes, bytes_to_read, 0, - bytes_to_read, data_pointer, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - -/** note: memory_bytes and file_bytes might be different (e.g., if machine - is "IEEE_BIG" and file is "CRAY") in which case data pointer advances - at a different rate from file pointer. **/ - data_pointer += (bytes_to_read * memory_bytes) / file_bytes ; - bytes_read += bytes_to_read ; - } /* end for */ - free( data_chunk_table ) ; - if( bytes_read < total_bytes ) { - *error_return = INCOMPLETE_DATA ; - memset( data_pointer, 0, total_bytes - bytes_read ) ; - } /* end if */ - } /* end else */ - -} /* end of ADF_Read_All_Data */ -/* end of file ADF_Read_All_Data.c */ -/* file ADF_Read_Block_Data.c */ -/*********************************************************************** -ADF Read Block Data: - -Read a continous block of data from a Node. Reads a block the node's data -and returns it into a contiguous memory space. - -ADF_Read_Block_Data( ID, data, error_return ) -input: const double ID The ID of the node to use. -input: const long b_start The starting point in block in token space -input: const long b_end The ending point in block in token space -output: char *data The start of the data in memory. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Read_Block_Data( - const double ID, - const long b_start, - const long b_end, - char *data, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -struct TOKENIZED_DATA_TYPE - tokenized_data_type[ 1 + (ADF_DATA_TYPE_LENGTH + 1)/3 ] ; -struct DATA_CHUNK_TABLE_ENTRY *data_chunk_table ; -char *data_pointer ; - -char file_format, machine_format ; -int file_bytes, memory_bytes, bytes_to_read ; -long total_bytes, bytes_read, start_offset ; -long chunk_size, chunk_end_byte ; -long start_byte, end_byte, block_bytes ; -int i, j ; -double LID ; - -if( data == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get datatype size **/ -ADFI_evaluate_datatype( file_index, node.data_type, &file_bytes, &memory_bytes, - tokenized_data_type, &file_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( (file_bytes == 0) || (node.number_of_dimensions == 0) ) { - *error_return = NO_DATA ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Calculate total number of bytes in the data **/ -total_bytes = file_bytes ; -for( j=0; j<(int)node.number_of_dimensions; j++ ) - total_bytes *= node.dimension_values[j] ; -if( total_bytes == 0 ) { - *error_return = ZERO_DIMENSIONS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Calculate the starting and ending range in the file **/ -start_byte = file_bytes * (b_start-1) ; -end_byte = file_bytes * b_end ; -if ( start_byte < 0 || start_byte > end_byte || end_byte > total_bytes ) { - *error_return = START_OUT_OF_DEFINED_RANGE ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -block_bytes = end_byte - start_byte ; - - /** If there is NO DATA, fill data space with zeros, return error **/ -if( node.number_of_data_chunks == 0 ) { - memset( data, 0, block_bytes*memory_bytes/file_bytes ) ; - *error_return = NO_DATA ; - return ; /** NO_DATA is really a warning, so don't check & abort... **/ - } /* end if */ - - /** Read the data from disk **/ -else if( node.number_of_data_chunks == 1 ) { - ADFI_read_data_chunk( file_index, &node.data_chunks, tokenized_data_type, - file_bytes, total_bytes, start_byte, block_bytes, - data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else if */ -else { - /** Allocate memory for the required table space in memory **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( node.number_of_data_chunks * sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Read in the table **/ - ADFI_read_data_chunk_table( file_index, &node.data_chunks, - data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Read data from each entry in the table **/ - bytes_read = 0 ; - chunk_end_byte = 0 ; - data_pointer = data ; - for( i=0; i<(int)node.number_of_data_chunks; i++ ) { - chunk_size = - (data_chunk_table[i].end.block - data_chunk_table[i].start.block) * - DISK_BLOCK_SIZE + - (data_chunk_table[i].end.offset - data_chunk_table[i].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - - /** Check to be sure we don't think the chunk is bigger than it is - (shrinking a data block can cause this) - **/ - if( chunk_end_byte + chunk_size > total_bytes ) { - chunk_size = total_bytes - chunk_end_byte ; - } /* end if */ - if( chunk_size == 0 ) - break ; - - chunk_end_byte += chunk_size ; - - /** If start of block not in this chunk then continue **/ - if ( start_byte > chunk_end_byte ) - continue ; - - /** Set offset into the current chunk **/ - if ( start_byte > (chunk_end_byte - chunk_size) ) - /** The start of the block is inside the current chunk so - adjust the offset to the beginning of the block **/ - start_offset = ( start_byte - (chunk_end_byte-chunk_size) ) ; - else - start_offset = 0 ; - - /** Calculate the number of bytes needed in this chunk **/ - bytes_to_read = chunk_size - start_offset ; - if( bytes_read + bytes_to_read > block_bytes ) { - bytes_to_read = block_bytes - bytes_read ; - } /* end if */ - if( bytes_to_read == 0 || (chunk_end_byte-chunk_size) > end_byte ) - break ; - - ADFI_read_data_chunk( file_index, &data_chunk_table[i].start, - tokenized_data_type, file_bytes, chunk_size, start_offset, - bytes_to_read, data_pointer, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - -/** note: memory_bytes and file_bytes might be different (e.g., if machine - is "IEEE_BIG" and file is "CRAY") in which case data pointer advances - at a different rate from file pointer. **/ - data_pointer += (bytes_to_read * memory_bytes) / file_bytes ; - bytes_read += bytes_to_read ; - } /* end for */ - free( data_chunk_table ) ; - if( bytes_read < block_bytes ) { - *error_return = INCOMPLETE_DATA ; - memset( data_pointer, 0, total_bytes - bytes_read ) ; - } /* end if */ - } /* end else */ - -} /* end of ADF_Read_Block_Data */ -/* end of file ADF_Read_Block_Data.c */ -/* file ADF_Read_Data.c */ -/*********************************************************************** -ADF Read Data: - -Read data from a node, with partial capabilities. The partial -capabilities are both in the node's data and also in memory. -Vectors of integers are used to indicate the data to be accessed -from the node, and another set of integer vectors is used to -describe the memory location for the data. - Note: If the data-type of the node is a compound data-type ("I4[3],R8") -for example, the partial capabilities will access one or more of -these 20-byte data entities. You cannot access a subset of an -occurrence of the data-type. - -ADF_Read_Data( ID, s_start[], s_end[], s_stride[], m_num_dims, - m_dims[], m_start[], m_end[], m_stride[], data, error_return ) -input: const double ID The ID of the node to use. -input: const int s_start[] The starting dimension values to use in - the database (node). -input: const int s_end[] The ending dimension values to use in - the database (node). -input: const int s_stride[] The stride values to use in the database (node). -input: const int m_num_dims The number of dimensions to use in memory. -input: const int m_dims[] The dimensionality to use in memory. -input: const int m_start[] The starting dimension values to use in memory. -input: const int m_end[] The ending dimension values to use in memory. -input: const int m_stride[] The stride values to use in memory. -output: char *data The start of the data in memory. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Read_Data( - const double ID, - const int s_start[], - const int s_end[], - const int s_stride[], - const int m_num_dims, - const int m_dims[], - const int m_start[], - const int m_end[], - const int m_stride[], - char *data, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset, relative_block ; -struct NODE_HEADER node ; -struct TOKENIZED_DATA_TYPE - tokenized_data_type[ 1 + (ADF_DATA_TYPE_LENGTH + 1)/3 ] ; -int current_disk[ADF_MAX_DIMENSIONS] ; -int current_memory[ADF_MAX_DIMENSIONS] ; -unsigned long total_disk_elements, total_memory_elements ; -unsigned long disk_offset, memory_offset ; -char disk_format, machine_format ; -int formats_compare ; -int i ; -int file_bytes = 0 ; -int memory_bytes = 0 ; -int no_data = FALSE ; -double LID ; -unsigned long relative_offset, current_chunk, current_chunk_size, - past_chunk_sizes ; -struct DATA_CHUNK_TABLE_ENTRY *data_chunk_table ; - -if( (s_start == NULL) || (s_end == NULL) || (s_stride == NULL) || - (m_dims == NULL) || (m_start == NULL) || (m_end == NULL) || - (m_stride == NULL) || (data == NULL) ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get datatype length **/ -ADFI_evaluate_datatype( file_index, node.data_type, &file_bytes, &memory_bytes, - tokenized_data_type, &disk_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( (file_bytes == 0) || (node.number_of_dimensions == 0) ) { - *error_return = NO_DATA ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -ADFI_count_total_array_points( node.number_of_dimensions, - node.dimension_values, - s_start, s_end, s_stride, - &total_disk_elements, &disk_offset, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_count_total_array_points( (unsigned int)m_num_dims, - (unsigned int *)m_dims, - m_start, m_end, m_stride, - &total_memory_elements, &memory_offset, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( total_disk_elements != total_memory_elements ) { - *error_return = UNEQUAL_MEMORY_AND_DISK_DIMS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -ADFI_file_and_machine_compare( file_index, tokenized_data_type, - &formats_compare, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Check to see if there is actual data to use **/ -if( node.number_of_data_chunks == 0 ) { - no_data = TRUE ; - } /* end if */ - /** Check for multiple data-chunks **/ -else if( node.number_of_data_chunks == 1 ) { /** A single data chunk **/ - /** Point to the start of the data **/ - block_offset.block = node.data_chunks.block ; - block_offset.offset = node.data_chunks.offset + TAG_SIZE + - DISK_POINTER_SIZE + disk_offset * file_bytes ; - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else if */ -else if( node.number_of_data_chunks > 1 ) { /** Multiple data chunks **/ - current_chunk = 0 ; - past_chunk_sizes = 0 ; - relative_offset = disk_offset * file_bytes ; - /** Allocate memory for the required table space in memory **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( node.number_of_data_chunks * sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Read in the table **/ - ADFI_read_data_chunk_table( file_index, &node.data_chunks, - data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - current_chunk_size = (data_chunk_table[ current_chunk ].end.block - - data_chunk_table[ current_chunk ].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[ current_chunk ].end.offset - - data_chunk_table[ current_chunk ].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - - } /* end else if */ - - /** Setup initial indexing **/ -for( i=0; i<(int)node.number_of_dimensions; i++ ) - current_disk[i] = s_start[i] ; -for( i=0; i DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - if( formats_compare ) { - /** Read the data off of disk directly **/ - ADFI_read_file( file_index, block_offset.block, block_offset.offset, - file_bytes, (char *)data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { /** Read and translate data **/ - ADFI_read_data_translated( file_index, block_offset.block, - block_offset.offset, tokenized_data_type, file_bytes, - file_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Increment disk pointers, for the special case of one dimensional - data we will a simple increment to maximize the throught. Thus for - block reads you can temporarily change to 1D for the read to - improve efficiency. Note total size shouldn't change!! **/ - if( (unsigned)i < total_disk_elements - 1 ) { - if ( node.number_of_dimensions == 1 ) { - disk_offset = s_stride[0]; - current_disk[0] += disk_offset; - if ( current_disk[0] > s_end[0] ) current_disk[0] = s_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - node.number_of_dimensions, node.dimension_values, - s_start, s_end, s_stride, current_disk, &disk_offset, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - block_offset.offset += disk_offset * file_bytes ; - if ( block_offset.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - } /* end if */ - } /* end else if */ - else if( node.number_of_data_chunks > 1 ) { /** Multiple data chunks **/ - while( relative_offset >= past_chunk_sizes + current_chunk_size ) { - if( ++current_chunk >= node.number_of_data_chunks ) { - *error_return = INCOMPLETE_DATA ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { - past_chunk_sizes += current_chunk_size ; - current_chunk_size = (data_chunk_table[ current_chunk ].end.block - - data_chunk_table[ current_chunk ].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[ current_chunk ].end.offset - - data_chunk_table[ current_chunk ].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - } /* end else */ - } /* end while */ - - /** Get the data off of disk **/ - relative_block.block = data_chunk_table[ current_chunk ].start.block ; - relative_block.offset = data_chunk_table[ current_chunk ].start.offset + - (TAG_SIZE + DISK_POINTER_SIZE) + - (relative_offset - past_chunk_sizes) ; - if ( relative_block.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &relative_block, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } - - if( formats_compare ) { - /** Read the data off of disk directly **/ - ADFI_read_file( file_index, relative_block.block, relative_block.offset, - file_bytes, (char *)data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { /** Read and translate data **/ - ADFI_read_data_translated( file_index, relative_block.block, - relative_block.offset, tokenized_data_type, file_bytes, - file_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Increment disk pointers **/ - if( (unsigned)i < total_disk_elements - 1 ) { - if ( node.number_of_dimensions == 1 ) { - disk_offset = s_stride[0]; - current_disk[0] += disk_offset; - if ( current_disk[0] > s_end[0] ) current_disk[0] = s_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - node.number_of_dimensions, node.dimension_values, - s_start, s_end, s_stride, current_disk, &disk_offset, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - relative_offset += disk_offset * file_bytes ; - } /* end if */ - } /* end else if */ - - if( (unsigned)i < total_disk_elements - 1 ) { - /** Increment memory pointers **/ - if ( m_num_dims == 1 ) { - memory_offset = m_stride[0]; - current_memory[0] += disk_offset; - if ( current_memory[0] > m_end[0] ) current_memory[0] = m_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - (unsigned int)m_num_dims, (unsigned int* )m_dims, - m_start, m_end, m_stride, - current_memory, &memory_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Adjust data pointer **/ - data += memory_offset * memory_bytes ; - } /* end if */ - } /* end for */ - -if( node.number_of_data_chunks > 1 ) /** Multiple data chunks **/ - free( data_chunk_table ) ; - -} /* end of ADF_Read_Data */ -/* end of file ADF_Read_Data.c */ -/* file ADF_Set_Error_State.c */ -/*********************************************************************** -ADF Set Error State: - -Set Error State. For all ADF calls, set the error handling convention; -either return error codes, or abort the program on an error. The -default state for the ADF interface is to return error codes and NOT abort. - -ADF_Set_Error_State( error_state, error_return ) -input: const int error_state Flag for ABORT on error (1) or return error - status (0). -output: int *error_return Error return. -***********************************************************************/ -void ADF_Set_Error_State( - const int error_state, - int *error_return ) -{ -*error_return = NO_ERROR ; -if( error_state == 0 ) - ADF_abort_on_error = FALSE ; -else if( error_state == 1 ) - ADF_abort_on_error = TRUE ; -else { - *error_return = BAD_ERROR_STATE ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - -} /* end of ADF_Set_Error_State */ -/* end of file ADF_Set_Error_State.c */ -/* file ADF_Set_Label.c */ -/*********************************************************************** -ADF Set Label: - -Set Label. Set the 32 character string in a node's label field. - -ADF_Set_Label( ID, label, error_return ) -input: const double ID The ID of the node to use. -input: const char *label The 32-character label of the node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Set_Label( - const double ID, - const char *label, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -int i, label_length ; -double LID ; - - /** Don't check for NULL or BLANK label, these are OK **/ -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Copy the label **/ -if( label == NULL ) - label_length = 0 ; /* copy none, then blank fill */ -else - label_length = strlen( label ) ; -if( label_length > ADF_LABEL_LENGTH ) { - *error_return = STRING_LENGTH_TOO_BIG ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -for( i=0; i chunk_total_bytes ) { - /** Write the part of the new data to existing data-chunk **/ - ADFI_write_data_chunk( file_index, &node.data_chunks, - tokenized_data_type, file_bytes, chunk_total_bytes, 0, - chunk_total_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Allocate a second data chunk **/ - total_bytes -= chunk_total_bytes ; - ADFI_file_malloc( file_index, - total_bytes + TAG_SIZE + TAG_SIZE + DISK_POINTER_SIZE, - &new_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write the rest of the data **/ -/** note: memory_bytes and file_bytes might be different (e.g., if machine - is "IEEE_BIG" and file is "CRAY") in which case data pointer advances - at a different rate from file pointer. **/ - data += (chunk_total_bytes * memory_bytes ) / file_bytes ; - - ADFI_write_data_chunk( file_index, &new_block_offset, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Allocate a data-chunk-table for two entries **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + 5 * DISK_POINTER_SIZE, - &dct_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write data-chunk-table to disk **/ - data_chunk_entry_table[0].start.block = node.data_chunks.block ; - data_chunk_entry_table[0].start.offset = node.data_chunks.offset ; - chunk_start.block = node.data_chunks.block ; - chunk_start.offset = node.data_chunks.offset + TAG_SIZE ; - ADFI_adjust_disk_pointer( &chunk_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - /** get the size of the data_chunk for the table end pointer **/ - ADFI_read_disk_pointer_from_disk( file_index, - chunk_start.block, chunk_start.offset, - &data_chunk_entry_table[0].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - data_chunk_entry_table[1].start.block = new_block_offset.block ; - data_chunk_entry_table[1].start.offset = new_block_offset.offset ; - chunk_start.block = new_block_offset.block ; - chunk_start.offset = new_block_offset.offset + TAG_SIZE ; - ADFI_adjust_disk_pointer( &chunk_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - /** get the size of the data_chunk for the table end pointer **/ - ADFI_read_disk_pointer_from_disk( file_index, - chunk_start.block, chunk_start.offset, - &data_chunk_entry_table[1].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - ADFI_write_data_chunk_table( file_index, &dct_block_offset, - 2, data_chunk_entry_table, error_return ) ; - - /** Update node header with number of data-chunks = 2 and the - pointer to the data-chunk-table **/ - node.data_chunks.block = dct_block_offset.block ; - node.data_chunks.offset = dct_block_offset.offset ; - node.number_of_data_chunks = 2 ; - ADFI_write_node_header( file_index, &block_offset, &node, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { - /** Write the new data to existing data-chunk **/ - ADFI_write_data_chunk( file_index, &node.data_chunks, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - } /* end else if */ -else { /** Multiple data chunks **/ - /** Allocate memory for the data-chunk-table, with an additional - entry in case we need to grow it - **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( (node.number_of_data_chunks + 1 ) * - sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Read in the table **/ - ADFI_read_data_chunk_table( file_index, &node.data_chunks, - data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** looping on the data-chunks, write the size of the current chunk **/ - for( i=0; i<(int)node.number_of_data_chunks; i++ ) { - current_bytes = (data_chunk_table[i].end.block - - data_chunk_table[i].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[i].end.offset - - data_chunk_table[i].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - /** Limit the number of bytes written by whats left to write. **/ - current_bytes = MIN( current_bytes, total_bytes ) ; - ADFI_write_data_chunk( file_index, &data_chunk_table[i].start, - tokenized_data_type, file_bytes, current_bytes, 0, - current_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - -/** note: memory_bytes and file_bytes might be different (e.g., if machine - is "IEEE_BIG" and file is "CRAY") in which case data pointer advances - at a different rate from file pointer. **/ - data += (current_bytes * memory_bytes ) / file_bytes ; - - total_bytes -= current_bytes ; - if( total_bytes <= 0 ) - break ; - } /* end for */ - - /** If we are out of data-chunks and have data left, allocate a - new data-chunk in the file. **/ - - if( total_bytes > 0 ) { - /** Write data-chunk-table to disk **/ - - /** allocate data space in the file **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + DISK_POINTER_SIZE + - total_bytes, - &data_chunk_table[ node.number_of_data_chunks ].start, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - data_chunk_table[ node.number_of_data_chunks ].end.block = - data_chunk_table[ node.number_of_data_chunks ].start.block ; - data_chunk_table[ node.number_of_data_chunks ].end.offset = - data_chunk_table[ node.number_of_data_chunks ].start.offset + - TAG_SIZE + DISK_POINTER_SIZE + total_bytes ; - ADFI_adjust_disk_pointer( - &data_chunk_table[ node.number_of_data_chunks ].end, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** allocate space for the new data-chunk-entry-table **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + - (2 * (node.number_of_data_chunks + 1) + 1) * DISK_POINTER_SIZE, - &dct_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - ADFI_write_data_chunk_table( file_index, &dct_block_offset, - node.number_of_data_chunks+1, data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - ADFI_write_data_chunk( file_index, - &data_chunk_table[node.number_of_data_chunks ].start, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Free the old data-chunk-table **/ - ADFI_file_free( file_index, &node.data_chunks, 0, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Update node header with number of data-chunks++ and the - pointer to the data-chunk-table **/ - node.number_of_data_chunks++ ; - node.data_chunks.block = dct_block_offset.block ; - node.data_chunks.offset = dct_block_offset.offset ; - ADFI_write_node_header( file_index, &block_offset, &node, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - free( data_chunk_table ) ; - } /* end else */ - -/** Write modification time in ADF_Database_Close, otherwise NFS performance is - even worse than normal -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; */ - -} /* end of ADF_Write_All_Data */ -/* end of file ADF_Write_All_Data.c */ -/* end of file ADF_Write_All_Data.c */ -/* file ADF_Write_Block_Data.c */ -/*********************************************************************** -ADF Write Block Data: - -Write all data to a Node. Writes all the node's data from a contiguous -memory space. - -ADF_Write_All_Data( ID, data, error_return ) -input: const double ID The ID of the node to use. -input: const long b_start The starting point in block in token space -input: const long b_end The ending point in block in token space -input: const char *data The start of the data in memory. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Write_Block_Data( - const double ID, - const long b_start, - const long b_end, - char *data, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset, new_block_offset, dct_block_offset ; -struct NODE_HEADER node ; -struct TOKENIZED_DATA_TYPE - tokenized_data_type[ 1 + (ADF_DATA_TYPE_LENGTH + 1)/3 ] ; -struct DATA_CHUNK_TABLE_ENTRY data_chunk_entry_table[2], *data_chunk_table ; - -char file_format, machine_format ; -int file_bytes, memory_bytes ; -long total_bytes, bytes_written, bytes_to_write ; -int i, j ; -char tag[TAG_SIZE+1] ; -struct DISK_POINTER data_start, chunk_start, end_of_chunk_tag ; -long start_offset ; -long chunk_size, chunk_end_byte ; -long start_byte, end_byte, block_bytes ; -double LID ; - -if( data == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get the datatype length **/ -ADFI_evaluate_datatype( file_index, node.data_type, &file_bytes, &memory_bytes, - tokenized_data_type, &file_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Calculate the total number of data bytes **/ -total_bytes = file_bytes ; -for( j=0; j<(int)node.number_of_dimensions; j++ ) - total_bytes *= node.dimension_values[j] ; -if( total_bytes == 0 ) { - *error_return = ZERO_DIMENSIONS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Calculate the starting and ending range in the file **/ -start_byte = file_bytes * (b_start-1) ; -end_byte = file_bytes * b_end ; -if ( start_byte < 0 || start_byte > end_byte || end_byte > total_bytes ) { - *error_return = START_OUT_OF_DEFINED_RANGE ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -block_bytes = end_byte - start_byte ; - - /** If there currently is NO data, allocate disk space for it **/ -if( node.number_of_data_chunks == 0 ) { - ADFI_file_malloc( file_index, - total_bytes + TAG_SIZE + TAG_SIZE + DISK_POINTER_SIZE, - &node.data_chunks, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write the new data **/ - ADFI_write_data_chunk( file_index, &node.data_chunks, tokenized_data_type, - file_bytes, total_bytes, start_byte, block_bytes, data, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Record the modified the node-header **/ - node.number_of_data_chunks = 1 ; - ADFI_write_node_header( file_index, &block_offset, &node, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -else if( node.number_of_data_chunks == 1 ) { - /** Get the data length **/ - ADFI_read_chunk_length( file_index, &node.data_chunks, tag, - &end_of_chunk_tag, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - tag[TAG_SIZE] = '\0' ; - - /** Check start-of-chunk tag **/ - if( ADFI_stridx_c( tag, data_chunk_start_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Point to the start of the data **/ - data_start.block = node.data_chunks.block ; - data_start.offset = node.data_chunks.offset + TAG_SIZE + DISK_POINTER_SIZE ; - ADFI_adjust_disk_pointer( &data_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** See if the new data exceedes the existing data space **/ - chunk_size = end_of_chunk_tag.offset - data_start.offset + - (end_of_chunk_tag.block - data_start.block) * DISK_BLOCK_SIZE ; - - - /** If Data grew: Write old size, then allocate more - data-space and write the rest **/ - if( total_bytes > chunk_size ) { - /** Write the part of the new data to existing data-chunk **/ - bytes_written = 0 ; - if ( start_byte <= chunk_size ) { - bytes_to_write = MIN ( block_bytes, (chunk_size-start_byte) ) ; - ADFI_write_data_chunk( file_index, &node.data_chunks, - tokenized_data_type, file_bytes, chunk_size, start_byte, - bytes_to_write, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - bytes_written += bytes_to_write ; - } /* end if */ - - /** Allocate a second data chunk **/ - total_bytes -= chunk_size ; - ADFI_file_malloc( file_index, - total_bytes + TAG_SIZE + TAG_SIZE + DISK_POINTER_SIZE, - &new_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write the rest of the data **/ -/** note: memory_bytes and file_bytes might be different (e.g., if machine - is "IEEE_BIG" and file is "CRAY") in which case data pointer advances - at a different rate from file pointer. **/ - data += (bytes_to_write * memory_bytes ) / file_bytes ; - - if ( bytes_written < block_bytes ) { - bytes_to_write = block_bytes - bytes_written ; - start_offset = MAX ( 0L, (start_byte - chunk_size) ) ; - ADFI_write_data_chunk( file_index, &new_block_offset, - tokenized_data_type, file_bytes, total_bytes, start_offset, - bytes_to_write, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { - ADFI_write_data_chunk( file_index, &new_block_offset, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, NULL, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Allocate a data-chunk-table for two entries **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + 5 * DISK_POINTER_SIZE, - &dct_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write data-chunk-table to disk **/ - data_chunk_entry_table[0].start.block = node.data_chunks.block ; - data_chunk_entry_table[0].start.offset = node.data_chunks.offset ; - /** get the size of the data_chunk for the table end pointer **/ - chunk_start.block = node.data_chunks.block ; - chunk_start.offset = node.data_chunks.offset + TAG_SIZE ; - ADFI_adjust_disk_pointer( &chunk_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - ADFI_read_disk_pointer_from_disk( file_index, - chunk_start.block, chunk_start.offset, - &data_chunk_entry_table[0].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - data_chunk_entry_table[1].start.block = new_block_offset.block ; - data_chunk_entry_table[1].start.offset = new_block_offset.offset ; - chunk_start.block = new_block_offset.block ; - chunk_start.offset = new_block_offset.offset + TAG_SIZE ; - ADFI_adjust_disk_pointer( &chunk_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - /** get the size of the data_chunk for the table end pointer **/ - ADFI_read_disk_pointer_from_disk( file_index, - chunk_start.block, chunk_start.offset, - &data_chunk_entry_table[1].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - ADFI_write_data_chunk_table( file_index, &dct_block_offset, - 2, data_chunk_entry_table, error_return ) ; - - /** Update node header with number of data-chunks = 2 and the - pointer to the data-chunk-table **/ - node.data_chunks.block = dct_block_offset.block ; - node.data_chunks.offset = dct_block_offset.offset ; - node.number_of_data_chunks = 2 ; - ADFI_write_node_header( file_index, &block_offset, &node, error_return ); - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { - /** Write the new data to existing data-chunk **/ - ADFI_write_data_chunk( file_index, &node.data_chunks, - tokenized_data_type, file_bytes, chunk_size, start_byte, - block_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - } /* end else if */ -else { /** Multiple data chunks **/ - /** Allocate memory for the data-chunk-table, with an additional - entry in case we need to grow it - **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( (node.number_of_data_chunks + 1 ) * - sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Read in the table **/ - ADFI_read_data_chunk_table( file_index, &node.data_chunks, - data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** looping on the data-chunks, write the size of the current chunk **/ - chunk_end_byte = 0 ; - bytes_written = 0 ; - for( i=0; i<(int)node.number_of_data_chunks; i++ ) { - chunk_size = (data_chunk_table[i].end.block - - data_chunk_table[i].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[i].end.offset - - data_chunk_table[i].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - chunk_end_byte += chunk_size ; - - /** If start of block not in this chunk then continue **/ - if ( start_byte > chunk_end_byte ) - continue ; - - /** Set offset into the current chunk **/ - if ( start_byte > (chunk_end_byte - chunk_size) ) - /** The start of the block is inside the current chunk so - adjust the offset to the beginning of the block **/ - start_offset = ( start_byte - (chunk_end_byte-chunk_size) ) ; - else - start_offset = 0 ; - - /** Check to be sure we aren't writing too much data **/ - bytes_to_write = chunk_size - start_offset ; - if( bytes_written + bytes_to_write > block_bytes ) { - bytes_to_write = block_bytes - bytes_written ; - } /* end if */ - if( bytes_to_write == 0 || (chunk_end_byte-chunk_size) > end_byte ) - continue ; - - /** Write the chunk **/ - ADFI_write_data_chunk( file_index, &data_chunk_table[i].start, - tokenized_data_type, file_bytes, chunk_size, start_offset, - bytes_to_write, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - -/** note: memory_bytes and file_bytes might be different (e.g., if machine - is "IEEE_BIG" and file is "CRAY") in which case data pointer advances - at a different rate from file pointer. **/ - data += (bytes_to_write * memory_bytes ) / file_bytes ; - - bytes_written += bytes_to_write ; - } /* end for */ - - /** If we are out of data-chunks and have data left, allocate a - new data-chunk in the file. **/ - total_bytes -= chunk_end_byte ; - if( total_bytes > 0 ) { - /** Write data-chunk-table to disk **/ - - /** allocate data space in the file **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + DISK_POINTER_SIZE + - total_bytes, - &data_chunk_table[ node.number_of_data_chunks ].start, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - data_chunk_table[ node.number_of_data_chunks ].end.block = - data_chunk_table[ node.number_of_data_chunks ].start.block ; - data_chunk_table[ node.number_of_data_chunks ].end.offset = - data_chunk_table[ node.number_of_data_chunks ].start.offset + - TAG_SIZE + DISK_POINTER_SIZE + total_bytes ; - ADFI_adjust_disk_pointer( - &data_chunk_table[ node.number_of_data_chunks ].end, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** allocate space for the new data-chunk-entry-table **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + - (2 * (node.number_of_data_chunks + 1) + 1) * DISK_POINTER_SIZE, - &dct_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - ADFI_write_data_chunk_table( file_index, &dct_block_offset, - node.number_of_data_chunks+1, data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - if ( bytes_written < block_bytes ) { - bytes_to_write = block_bytes - bytes_written ; - start_offset = MAX ( 0L, (start_byte - total_bytes) ) ; - ADFI_write_data_chunk( file_index, - &data_chunk_table[node.number_of_data_chunks ].start, - tokenized_data_type, file_bytes, - total_bytes, start_offset, bytes_to_write, - data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { - ADFI_write_data_chunk( file_index, - &data_chunk_table[node.number_of_data_chunks ].start, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, NULL, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Free the old data-chunk-table **/ - ADFI_file_free( file_index, &node.data_chunks, 0, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Update node header with number of data-chunks++ and the - pointer to the data-chunk-table **/ - node.number_of_data_chunks++ ; - node.data_chunks.block = dct_block_offset.block ; - node.data_chunks.offset = dct_block_offset.offset ; - ADFI_write_node_header( file_index, &block_offset, &node, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - free( data_chunk_table ) ; - } /* end else */ - -/** Write modification time in ADF_Database_Close, otherwise NFS performance is - even worse than normal -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; */ - -} /* end of ADF_Write_Block_Data */ -/* end of file ADF_Write_Block_Data.c */ -/* file ADF_Write_Data.c */ -/*********************************************************************** -ADF Write Data: - -Write data to a Node, with partial capabilities. See ADF_Read_Data for -description. - -ADF_Write_Data( ID, s_start[], s_end[], s_stride[], m_num_dims, - m_dims[], m_start[], m_end[], m_stride[], data, error_return ) -input: const double ID The ID of the node to use. -input: const int s_start[] The starting dimension values to use in - the database (node). -input: const int s_end[] The ending dimension values to use in - the database (node). -input: const int s_stride[] The stride values to use in the database (node). -input: const int m_num_dims The number of dimensions to use in memory. -input: const int m_dims[] The dimensionality to use in memory. -input: const int m_start[] The starting dimension values to use in memory. -input: const int m_end[] The ending dimension values to use in memory. -input: const int m_stride[] The stride values to use in memory. -input: const char *data The start of the data in memory. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Write_Data( - const double ID, - const int s_start[], - const int s_end[], - const int s_stride[], - const int m_num_dims, - const int m_dims[], - const int m_start[], - const int m_end[], - const int m_stride[], - const char *data, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset, dct_block_offset, relative_block ; -struct DISK_POINTER data_start, new_block_offset ; -struct DISK_POINTER chunk_start, end_of_chunk_tag ; -struct NODE_HEADER node ; -struct DATA_CHUNK_TABLE_ENTRY *data_chunk_table ; -struct TOKENIZED_DATA_TYPE - tokenized_data_type[ 1 + (ADF_DATA_TYPE_LENGTH + 1)/3 ] ; -int current_disk[ADF_MAX_DIMENSIONS] ; -int current_memory[ADF_MAX_DIMENSIONS] ; -unsigned long total_disk_elements, total_memory_elements ; -unsigned long disk_offset, memory_offset ; -int formats_compare ; -char disk_format, machine_format ; -int i ; -int file_bytes = 0 ; -int memory_bytes = 0 ; -char tag[TAG_SIZE+1] ; -unsigned long total_bytes ; -long current_bytes, chunk_total_bytes ; -double LID ; -unsigned long relative_offset, current_chunk, current_chunk_size, - past_chunk_sizes ; - -if( (s_start == NULL) || (s_end == NULL) || (s_stride == NULL) || - (m_dims == NULL) || (m_start == NULL) || (m_end == NULL) || - (m_stride == NULL) || (data == NULL) ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; -data_chunk_table = 0L ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get datatype length **/ -ADFI_evaluate_datatype( file_index, node.data_type, &file_bytes, &memory_bytes, - tokenized_data_type, &disk_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( (file_bytes == 0) || (node.number_of_dimensions == 0) ) { - *error_return = NO_DATA ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -ADFI_count_total_array_points( node.number_of_dimensions, - node.dimension_values, - s_start, s_end, s_stride, - &total_disk_elements, &disk_offset, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_count_total_array_points( (unsigned int)m_num_dims, - (unsigned int *)m_dims, - m_start, m_end, m_stride, - &total_memory_elements, &memory_offset, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( total_disk_elements != total_memory_elements ) { - *error_return = UNEQUAL_MEMORY_AND_DISK_DIMS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Calculate the total number of data bytes **/ -total_bytes = file_bytes ; -for( i=0; i<(int)node.number_of_dimensions; i++ ) - total_bytes *= node.dimension_values[i] ; -if( total_bytes == 0 ) { - *error_return = ZERO_DIMENSIONS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** check for need of data translation **/ -ADFI_file_and_machine_compare( file_index, tokenized_data_type, - &formats_compare, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** If there currently is NO data, allocate disk space for it **/ -if( node.number_of_data_chunks == 0 ) { - ADFI_file_malloc( file_index, - total_bytes + TAG_SIZE + TAG_SIZE + DISK_POINTER_SIZE, - &node.data_chunks, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** initialize the new disk_space with zero's, then we'll - write the partial data **/ - ADFI_write_data_chunk( file_index, &node.data_chunks, tokenized_data_type, - file_bytes, total_bytes, 0, total_bytes, 0L, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Record the modified the node-header **/ - node.number_of_data_chunks = 1 ; - ADFI_write_node_header( file_index, &block_offset, &node, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - /** If one data chunk, check to see if we need to add a second **/ -else if( node.number_of_data_chunks == 1 ) { - /** Get the data length **/ - ADFI_read_chunk_length( file_index, &node.data_chunks, tag, - &end_of_chunk_tag, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - tag[TAG_SIZE] = '\0' ; - - /** Check start-of-chunk tag **/ - if( ADFI_stridx_c( tag, data_chunk_start_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Point to the start of the data **/ - data_start.block = node.data_chunks.block ; - data_start.offset = node.data_chunks.offset + TAG_SIZE + DISK_POINTER_SIZE ; - ADFI_adjust_disk_pointer( &data_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** See if the new data exceedes the existing data space **/ - chunk_total_bytes = end_of_chunk_tag.offset - data_start.offset + - (end_of_chunk_tag.block - data_start.block) * DISK_BLOCK_SIZE ; - - /** If Data grew: Allocate more data-space and initialize to zero**/ - if( (long int) total_bytes > chunk_total_bytes ) { - /** Allocate memory for the data-chunk-table, with an additional - entry in case we need to grow it **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( (node.number_of_data_chunks + 1 ) * - sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Allocate a second data chunk **/ - total_bytes -= chunk_total_bytes ; - ADFI_file_malloc( file_index, - total_bytes + TAG_SIZE + TAG_SIZE + DISK_POINTER_SIZE, - &new_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Initialize the new data with zeros **/ - ADFI_write_data_chunk( file_index, &new_block_offset, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, 0L, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Allocate a data-chunk-table for two entries **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + 5 * DISK_POINTER_SIZE, - &dct_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write data-chunk-table to disk **/ - data_chunk_table[0].start.block = node.data_chunks.block ; - data_chunk_table[0].start.offset = node.data_chunks.offset ; - chunk_start.block = node.data_chunks.block ; - chunk_start.offset = node.data_chunks.offset + TAG_SIZE ; - ADFI_adjust_disk_pointer( &chunk_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - /** get the size of the data_chunk for the table end pointer **/ - ADFI_read_disk_pointer_from_disk( file_index, - chunk_start.block, chunk_start.offset, - &data_chunk_table[0].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - data_chunk_table[1].start.block = new_block_offset.block ; - data_chunk_table[1].start.offset = new_block_offset.offset ; - chunk_start.block = new_block_offset.block ; - chunk_start.offset = new_block_offset.offset + TAG_SIZE ; - ADFI_adjust_disk_pointer( &chunk_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - /** get the size of the data_chunk for the table end pointer **/ - ADFI_read_disk_pointer_from_disk( file_index, - chunk_start.block, chunk_start.offset, - &data_chunk_table[1].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - ADFI_write_data_chunk_table( file_index, &dct_block_offset, - 2, data_chunk_table, error_return ) ; - - /** Update node header with number of data-chunks = 2 and the - pointer to the data-chunk-table **/ - node.data_chunks.block = dct_block_offset.block ; - node.data_chunks.offset = dct_block_offset.offset ; - node.number_of_data_chunks = 2 ; - ADFI_write_node_header( file_index, &block_offset, &node, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - } /* end else if */ -else { /** Multiple data chunks, check to see if we need to add one mode **/ - /** Allocate memory for the data-chunk-table, with an additional - entry in case we need to grow it **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( (node.number_of_data_chunks + 1 ) * - sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Read in the table **/ - ADFI_read_data_chunk_table( file_index, &node.data_chunks, - data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** looping on the data-chunks, look at the size of the chunks **/ - for( i=0; i<(int)node.number_of_data_chunks; i++ ) { - current_bytes = (data_chunk_table[i].end.block - - data_chunk_table[i].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[i].end.offset - - data_chunk_table[i].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - total_bytes -= current_bytes ; - if( total_bytes <= 0 ) - break ; - } /* end for */ - - /** If we are out of data-chunks and have data left, allocate a - new data-chunk in the file. **/ - if( total_bytes > 0 ) { - /** Write data-chunk-table to disk **/ - - /** allocate data space in the file **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + DISK_POINTER_SIZE + - total_bytes, &data_chunk_table[ node.number_of_data_chunks ].start, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - data_chunk_table[ node.number_of_data_chunks ].end.block = - data_chunk_table[ node.number_of_data_chunks ].start.block ; - data_chunk_table[ node.number_of_data_chunks ].end.offset = - data_chunk_table[ node.number_of_data_chunks ].start.offset + - TAG_SIZE + DISK_POINTER_SIZE + total_bytes ; - ADFI_adjust_disk_pointer( - &data_chunk_table[ node.number_of_data_chunks ].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** allocate space for the new data-chunk-entry-table **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + - (2 * (node.number_of_data_chunks + 1) + 1) * DISK_POINTER_SIZE, - &dct_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - ADFI_write_data_chunk_table( file_index, &dct_block_offset, - node.number_of_data_chunks+1, data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Initialize the new data chunk to zeros **/ - ADFI_write_data_chunk( file_index, - &data_chunk_table[node.number_of_data_chunks ].start, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, 0L, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - /** Free the old data-chunk-table **/ - ADFI_file_free( file_index, &node.data_chunks, 0, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Update node header with number of data-chunks++ and the - pointer to the data-chunk-table **/ - node.number_of_data_chunks++ ; - node.data_chunks.block = dct_block_offset.block ; - node.data_chunks.offset = dct_block_offset.offset ; - ADFI_write_node_header( file_index, &block_offset, &node, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - } /* end else */ - - /** Do single data-chunks here... **/ -if( node.number_of_data_chunks == 1 ) { - /** Point to the start of the data **/ - block_offset.block = node.data_chunks.block ; - block_offset.offset = node.data_chunks.offset + TAG_SIZE + - DISK_POINTER_SIZE + disk_offset * file_bytes ; - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Setup initial indexing **/ - for( i=0; i<(int)node.number_of_dimensions; i++ ) - current_disk[i] = s_start[i] ; - for( i=0; i DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } - - /** Here is where we need to check for spanning multiple data-chunks **/ - - /** Put the data out to disk **/ - if( formats_compare ) { /* directly */ - ADFI_write_file( file_index, block_offset.block, block_offset.offset, - file_bytes, (char *)data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { /* translated */ - ADFI_write_data_translated( file_index, block_offset.block, - block_offset.offset, tokenized_data_type, file_bytes, - file_bytes, (char *)data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Increment disk/memory pointers, for the special case of one dimensional - data we will a simple increment to maximize the throught. Thus for - block writes you can temporarily change to 1D for the read to - improve efficiency. Note total size shouldn't change!! **/ - if( (unsigned)i < total_disk_elements - 1 ) { - if ( node.number_of_dimensions == 1 ) { - disk_offset = s_stride[0]; - current_disk[0] += disk_offset; - if ( current_disk[0] > s_end[0] ) current_disk[0] = s_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - node.number_of_dimensions, node.dimension_values, - s_start, s_end, s_stride, current_disk, &disk_offset, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - if ( m_num_dims == 1 ) { - memory_offset = m_stride[0]; - current_memory[0] += disk_offset; - if ( current_memory[0] > m_end[0] ) current_memory[0] = m_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - (unsigned int)m_num_dims, (unsigned int* )m_dims, - m_start, m_end, m_stride, - current_memory, &memory_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - block_offset.offset += disk_offset * file_bytes ; - if ( block_offset.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Adjust data pointer **/ - data += memory_offset * memory_bytes ; - } /* end if */ - } /* end for */ - } /* end if */ -else { - /** Point to the start of the data **/ - current_chunk = 0 ; - past_chunk_sizes = 0 ; - relative_offset = disk_offset * file_bytes ; - current_chunk_size = (data_chunk_table[ current_chunk ].end.block - - data_chunk_table[ current_chunk ].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[ current_chunk ].end.offset - - data_chunk_table[ current_chunk ].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - - /** Setup initial indexing **/ - for( i=0; i<(int)node.number_of_dimensions; i++ ) - current_disk[i] = s_start[i] ; - for( i=0; i= past_chunk_sizes + current_chunk_size ) { - if( ++current_chunk >= node.number_of_data_chunks ) { - *error_return = INCOMPLETE_DATA ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { - past_chunk_sizes += current_chunk_size ; - current_chunk_size = (data_chunk_table[ current_chunk ].end.block - - data_chunk_table[ current_chunk ].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[ current_chunk ].end.offset - - data_chunk_table[ current_chunk ].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - } /* end else */ - } /* end while */ - - /** Put the data to disk **/ - relative_block.block = data_chunk_table[ current_chunk ].start.block ; - relative_block.offset = data_chunk_table[ current_chunk ].start.offset + - (TAG_SIZE + DISK_POINTER_SIZE) + - (relative_offset - past_chunk_sizes) ; - if ( relative_block.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &relative_block, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Put the data out to disk **/ - if( formats_compare ) { /* directly */ - ADFI_write_file( file_index, - relative_block.block, relative_block.offset, - file_bytes, (char *)data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { /* translated */ - ADFI_write_data_translated( file_index, relative_block.block, - relative_block.offset, tokenized_data_type, file_bytes, - file_bytes, (char *)data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Increment disk and memory pointers **/ - if( (unsigned)i < total_disk_elements - 1 ) { - if ( node.number_of_dimensions == 1 ) { - disk_offset = s_stride[0]; - current_disk[0] += disk_offset; - if ( current_disk[0] > s_end[0] ) current_disk[0] = s_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - node.number_of_dimensions, node.dimension_values, - s_start, s_end, s_stride, current_disk, &disk_offset, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - relative_offset += disk_offset * file_bytes ; - - if ( m_num_dims == 1 ) { - memory_offset = m_stride[0]; - current_memory[0] += disk_offset; - if ( current_memory[0] > m_end[0] ) current_memory[0] = m_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - (unsigned int)m_num_dims, (unsigned int* )m_dims, - m_start, m_end, m_stride, - current_memory, &memory_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Adjust data pointer **/ - data += memory_offset * memory_bytes ; - } /* end if */ - } /* end for */ - } /* end else */ - -if( data_chunk_table != 0L ) - free( data_chunk_table ) ; - -/** Write modification time in ADF_Database_Close, otherwise NFS performance is - even worse than normal -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; */ - -} /* end of ADF_Write_Data */ -/* end of file ADF_Write_Data.c */ -/* end of combine 2.0 */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_interface_old.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_interface_old.c deleted file mode 100644 index 96422e59b5..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_interface_old.c +++ /dev/null @@ -1,4158 +0,0 @@ -/* created by combine 2.0 */ -/* file ADF_AAA_var.c */ -/* file ADF_AAA_var.c */ -/*** -File: ADF_interface.c - ---------------------------------------------------------------------- - BOEING - ---------------------------------------------------------------------- - Project: CGNS - Author: Tom Dickens 234-1024 tpd6908@yak.ca.boeing.com - Date: 3/2/1995 - Purpose: The code which implements the ADF-Core capabilities. - ---------------------------------------------------------------------- - ---------------------------------------------------------------------- - -***/ - -/*********************************************************************** - Library and Database "what" strings. -***********************************************************************/ -/** Change the major revision letter in the Library Version for changes - to the API (new public functions, changes to public header files, - changes to existings functions or their defined behavior) - and/or changes to the internal file format resulting in - incompatibilites with previous library versions. Change the - internal revision number for internal changes and bug fixes; - reset to zero for major revision letter changes. **/ - -/** With the original ADF library, there is no binary data for at least - the first 560 bytes, which causes a lot of programs - (mailers, WinZip) to think that the file is text and try to do - a \n -> \n\r conversion. Since this string is only used for the - 'what' command, I am deciding that we don't need this functionality - and am putting binary characters here. Specifically, I am putting - control characters, because while some programs (Evolution/gnome-vfs) - look for unprintable characters, some look for a ratio (Mozilla). **/ - -static char ADF_L_identification[] = "@(#)ADF Library Version E01>\001\002\003\004"; - /* 01234567890123456789012345678901 = 32 */ - -/** Change version database version number every time the library - version changes according to the following philosophy. - -The format: - - AXXxxx - -where: - - A Major revision number. Major internal structure changes. - This number is not expected to change very often if at all - because backward compatibility is only available by explicit - policy decision. - - One alphabetic character. - Range of values: A-Za-z - In unlikely event of reaching z, then can use any other - unused printable ASCII character except blank or symbols - used by "what" command: @, (, #, ), ~, >, \. - - XX Minor revision number. New features and minor changes and - bug fixes. Files are backward but NOT forward compatible. - - Two digit hexadecimal number (uppercase letters). - Range of values: 00 - FF - Reset to 00 with changes in major revision number. - - xxx Incremental number. Incremented with every new version of - library (even if no changes are made to file format). - Files are forward AND backward compatible. - - Three digit hexadecimal number (lowercase letters) - Range of values: 000 to fff - Does not reset. - -Definitions: - - forward compatible Older versions of libraries can read and write - to files created by newer versions of libraries. - - backward compatible Newer versions of libraries can read and write - to files created by older versions of libraries. -**/ - - /* AXXxxx */ -static char ADF_D_identification[] = "@(#)ADF Database>\001\002\003\004\005\006\007\010A02011>"; - /* 01234567890123456789012345678901 = 32 */ - -/*********************************************************************** - Includes -***********************************************************************/ -#ifndef MAKEDEPEND -#include -#include -#include -#if !defined(_WIN32) || (defined(_WIN32) && defined(__NUTC__)) -#include -#else -#include -#endif -#include -#include -#endif - -#include "ADF.h" -#include "ADF_internals.h" -/* This was moved from ADF_internals.h since they are only used here - and leaving them here gives warning messages when the other .c files - are compiled. WRO 2005-Jan-11 */ -static char data_chunk_start_tag[] = "DaTa" ; - -#if defined(_WIN32) && !defined(__NUTC__) -#ifndef MAKEDEPEND -#include -#endif -#ifndef F_OK -#define R_OK 004 /* Test for Read permission */ -#define W_OK 002 /* Test for Write permission */ -#define X_OK 001 /* Test for eXecute permission */ -#define F_OK 000 /* Test for existence of File */ -#endif -#endif - - -/*********************************************************************** - Error strings - These strings must be kept in sync with the error defines in ADF.h. -***********************************************************************/ -const char *ADF_error_string[] = { - "ADF -1: No Error.", - "ADF 1: Integer number is less than given minimum value.", - "ADF 2: Integer number is greater than given maximum value.", - "ADF 3: String length of zero or blank string detected.", - "ADF 4: String length longer than maximum allowable length.", - "ADF 5: String is not an ASCII-HEX string.", - "ADF 6: Too many ADF files opened.", - "ADF 7: ADF file status was not recognized.", - "ADF 8: ADF file-open error.", - "ADF 9: ADF file not currently opened.", - "ADF 10: ADF file index out of legal range.", - "ADF 11: Block/offset out of legal range.", - "ADF 12: A string pointer is NULL.", - "ADF 13: FSEEK error.", - "ADF 14: FWRITE error.", - "ADF 15: FREAD error.", - "ADF 16: Internal error: Memory boundary tag bad.", - "ADF 17: Internal error: Disk boundary tag bad.", - "ADF 18: File Open Error: NEW - File already exists.", - "ADF 19: ADF file format was not recognized.", - "ADF 20: Attempt to free the RootNode disk information.", - "ADF 21: Attempt to free the FreeChunkTable disk information.", - "ADF 22: File Open Error: OLD - File does not exist.", - "ADF 23: Entered area of Unimplemented Code...", - "ADF 24: Sub-Node.entries is bad.", - "ADF 25: Memory allocation failed.", - "ADF 26: Duplicate child name under a parent node.", - "ADF 27: Node has no dimensions.", - "ADF 28: Node's number-of-dimensions is not in legal range.", - "ADF 29: Specified child is NOT a child of the specified parent.", - "ADF 30: Data-Type is too long.", - "ADF 31: Invalid Data-Type.", - "ADF 32: A pointer is NULL.", - "ADF 33: Node has no data associated with it.", - "ADF 34: Error zeroing out memory.", - "ADF 35: Requested data exceeds actual data available.", - "ADF 36: Bad end value.", - "ADF 37: Bad stride value.", - "ADF 38: Minimum values is greater than the maximum value.", - "ADF 39: The format of this machine does not match a known signature.", - "ADF 40: Cannot convert to or from an unknown Native format.", - "ADF 41: The two conversion formats are equal, no conversion done.", - "ADF 42: The data format is not support on a particular machine.", - "ADF 43: File Close error.", - "ADF 44: Numeric overflow/underflow in data conversion.", - "ADF 45: Bad start value.", - "ADF 46: A value of zero is not allowable.", - "ADF 47: Bad dimension value.", - "ADF 48: Error state must be either a 0 (zero) or a 1 (one).", - "ADF 49: Dimensional specifications for disk and memory are unequal.", - "ADF 50: Too many link level used. May be caused by a recursive link.", - "ADF 51: The node is not a link. It was expected to be a link.", - "ADF 52: The linked-to node does not exist.", - "ADF 53: The ADF file of a linked-node is not accessable.", - "ADF 54: A node-id of 0.0 is not valid.", - "ADF 55: Incomplete Data when reading multiple data blocks.", - "ADF 56: Node name contains invalid characters.", - "ADF 57: ADF file version incompatible with this library version.", - "ADF 58: Nodes are not from the same file.", - "ADF 59: Priority Stack Error.", - "ADF 60: Machine format and file format are incompatable.", - "ADF 61: FFLUSH error", - "ADF 62: The node ID pointer is NULL.", - "ADF x: Last error mesage" - } ; - -/*********************************************************************** - Global Variables: -***********************************************************************/ -static int ADF_abort_on_error = FALSE ; -static char link_separator[MAXIMUM_FILES][2] ; - -#define CHECK_ADF_ABORT( error_flag ) if( error_flag != NO_ERROR ) { \ - if( ADF_abort_on_error == TRUE ) { \ - ADF_Error_Message( error_flag, 0L );\ - ADFI_Abort( error_flag) ; } \ - else { return ; } } -/* Added to remove memory leaks in ADF_Get_Node_ID */ -#define CHECK_ADF_ABORT1( error_flag ) if( error_flag != NO_ERROR ) { \ - free (name_tmp); \ - if( ADF_abort_on_error == TRUE ) { \ - ADF_Error_Message( error_flag, 0L );\ - ADFI_Abort( error_flag) ; } \ - else { return ; } } - -/*********************************************************************** -Data Query: -Note: If the node is a link, the data query will occur on the linked-to -node, not the node which is the link. -Internal Implementation: A linked node will have a data-type of "LK", -dimension of 1 and a dimension value of the length of a data string -containing the file-path and the node-path within the file. The -routines ADF_Is_Link and ADF_Get_Link_Path allow viewing of a link's -data-type and data. -***********************************************************************/ -/*********************************************************************** -Data I/O: -A 1-based system is used with all index values (the first element has an -index of 1, not 0). -***********************************************************************/ -/* end of file ADF_AAA_var.c */ -/* end of file ADF_AAA_var.c */ -/* file ADF_Children_Names.c */ -/*********************************************************************** -ADF Children names: - -Get Children names of a Node. Return the name of children nodes -directly associated with a parent node. The names of the children -are NOT guaranteed to be returned in any particular order. If a new -child is added, it is NOT guaranteed to be returned as the last child. - -Null-terminated names will be written into the names array and thus -there needs to be room for the null character. As an example, -the array can be defined as: - - char names[IMAX_NUM][IMAX_NAME_LENGTH+1]; - -where IMAX_NUM and IMAX_NAME_LENGTH are defined by the using application -and correspond to this function's "imax_num" and "imax_name_len" parameters -respectively. "imax_name_len" is the maximum length of a name to be copied -into the names array. This value can be equal to ADF_NAME_LENGTH but does -not have to be. However, the name dimension of the array MUST be declared -to be "imax_name_len" + 1. The name will be returned truncated (but still -null-terminated) if the actual name is longer than "imax_name_len" and -if "imax_name_len" is less than ADF_NAME_LENGTH. - -Note that the names array parameter is declared as a single dimension -character array inside this function. Therefore, use a (char *) cast to -cast a two dimensional array argument. - -ADF_Children_Names( PID, istart, imax_num, imax_name_len, inum_ret, - names, error_return ) -input: const double PID The ID of the Node to use. -input: const int istart The Nth child's name to start with (first is 1). -input: const int imax_num Maximum number of names to return. -input: const int imax_name_len Maximum Length of a name to return. -output: int *inum_ret The number of names returned. -output: char *names The returned names (cast with (char *)). -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -NUMBER_LESS_THAN_MINIMUM -***********************************************************************/ -void ADF_Children_Names( - const double PID, - const int istart, - const int imax_num, - const int imax_name_len, - int *inum_ret, - char *names, - int *error_return ) -{ -int i ; -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -struct SUB_NODE_TABLE_ENTRY sub_node_table_entry ; -double LID ; - -*error_return = NO_ERROR ; - -if( inum_ret == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -*inum_ret = 0 ; - -if( names == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( (istart <=0) || (imax_num <= 0) || (imax_name_len <= 0) ) { - *error_return = NUMBER_LESS_THAN_MINIMUM ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -ADFI_chase_link( PID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Check for zero children, return if 0 **/ -if( node.num_sub_nodes == 0 ) { - return ; - } /* end if */ - - /** point to the first child wanted **/ -block_offset.block = node.sub_node_table.block ; -block_offset.offset = node.sub_node_table.offset + - (TAG_SIZE + DISK_POINTER_SIZE + - (ADF_NAME_LENGTH + DISK_POINTER_SIZE) * (istart-1)) ; - - /** Return the data for the requested children **/ -for( i=(istart-1); i< MIN(istart-1+imax_num, (int) node.num_sub_nodes); i++ ) { - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Read the sun-node entry table **/ - ADFI_read_sub_node_table_entry( file_index, &block_offset, - &sub_node_table_entry, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Convert the child's name from blank-filled into a C string **/ - ADFI_string_2_C_string( sub_node_table_entry.child_name, - MIN(imax_name_len,ADF_NAME_LENGTH), - &names[(i-(istart-1))*(imax_name_len+1)], - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Increment the disk-pointer and the number of names returned **/ - block_offset.offset += (ADF_NAME_LENGTH + DISK_POINTER_SIZE) ; - *inum_ret = *inum_ret + 1 ; - } /* end for */ -} /* end of ADF_Children_Names */ -/* end of file ADF_Children_Names.c */ -/* file ADF_Children_IDs.c */ -/*********************************************************************** -ADF Children IDs: - -Get Children node IDs of a Node. Return the node IDs of children nodes -directly associated with a parent node. - -ADF_Children_IDs( PID, istart, imax_num, inum_ret, IDs, error_return) -input: const double PID The ID of the Node to use. -input: const int istart The Nth child's name to start with (first is 1). -input: const int imax_num Maximum number of names to return. -output: int *inum_ret The number of names returned. -output: double *IDs The returned node IDs -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -NUMBER_LESS_THAN_MINIMUM -***********************************************************************/ -void ADF_Children_IDs ( - const double PID, - const int istart, - const int imax_num, - int *inum_ret, - double *IDs, - int *error_return ) -{ -int i ; -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -struct SUB_NODE_TABLE_ENTRY sub_node_table_entry ; -double LID ; - -*error_return = NO_ERROR ; - -if( inum_ret == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -*inum_ret = 0 ; - -if( IDs == NULL ) { - *error_return = NULL_NODEID_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( (istart <=0) || (imax_num <= 0) ) { - *error_return = NUMBER_LESS_THAN_MINIMUM ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -ADFI_chase_link( PID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Check for zero children, return if 0 **/ -if( node.num_sub_nodes == 0 ) { - return ; - } /* end if */ - - /** point to the first child wanted **/ -block_offset.block = node.sub_node_table.block ; -block_offset.offset = node.sub_node_table.offset + - (TAG_SIZE + DISK_POINTER_SIZE + - (ADF_NAME_LENGTH + DISK_POINTER_SIZE) * (istart-1)) ; - - /** Return the data for the requested children **/ -for( i=(istart-1); i< MIN(istart-1+imax_num, (int) node.num_sub_nodes); i++ ) { - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Read the sub-node entry table **/ - ADFI_read_sub_node_table_entry( file_index, &block_offset, - &sub_node_table_entry, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Get the ID from the sub-node table **/ - ADFI_file_block_offset_2_ID( file_index, - sub_node_table_entry.child_location.block, - sub_node_table_entry.child_location.offset, - &IDs[i-(istart-1)], error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Increment the disk-pointer and the number of IDs returned **/ - block_offset.offset += (ADF_NAME_LENGTH + DISK_POINTER_SIZE) ; - *inum_ret = *inum_ret + 1 ; - } /* end for */ -} /* end of ADF_Children_IDs */ -/* end of file ADF_Children_IDs.c */ -/* file ADF_Create.c */ -/*********************************************************************** -ADF Create: - -Create a Node. Create a new node (not a link-node) as a child of a -given parent. Default values in this new node are: - label=blank, - number of sub-nodes = 0, - data-type = "MT", - number of dimensions = 0, - data = NULL. - -ADF_Create( PID, name, ID, error_return ) -input: const double PID The ID of the parent node, to whom we - are creating a new child node. -input: const char *name The name of the new child. -output: double *ID The ID of the newly created node. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADF_Create( - const double PID, - const char *name, - double *ID, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER parent_block_offset, child_block_offset ; -struct DISK_POINTER sub_node_entry_location ; -struct NODE_HEADER parent_node, child_node ; -struct SUB_NODE_TABLE_ENTRY sub_node_entry ; -int i, name_length, name_start, found ; -double LID ; - -ADFI_check_string_length( name, ADF_NAME_LENGTH, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( ID == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( PID, &LID, &file_index, &parent_block_offset, - &parent_node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - - /** Initialize node header **/ -ADFI_fill_initial_node_header( &child_node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Skip any leading blanks in the name **/ -name_start = 0 ; -while( name[ name_start ] == ' ' ) { - name_start++ ; - } /* end while */ -name_length = strlen( &name[ name_start ] ) ; -if( name_length > ADF_NAME_LENGTH ) { - *error_return = STRING_LENGTH_TOO_BIG ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Check for uniqueness and legality of the name **/ -ADFI_check_4_child_name( file_index, &parent_block_offset, - &name[ name_start ], &found, &sub_node_entry_location, - &sub_node_entry, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -if( found == 1 ) { - *error_return = DUPLICATE_CHILD_NAME ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -for ( i=0; i < name_length; i++ ) { - if ( ! isprint ( name[ name_start + i ] ) || - name[ name_start + i ] == '/' ) { - *error_return = INVALID_NODE_NAME; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - } /* end for */ - - /** Assign the name to the new node **/ -strncpy( child_node.name, &name[ name_start ], name_length ) ; - - /** Allocate disk space for the new node **/ -ADFI_file_malloc( file_index, NODE_HEADER_SIZE, &child_block_offset, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Write out the new node header **/ -ADFI_write_node_header( file_index, &child_block_offset, &child_node, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** OK, new node is on disk. Now, update the list of - children for the parent... - **/ -ADFI_add_2_sub_node_table( file_index, &parent_block_offset, - &child_block_offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Return the ID of the new child **/ -ADFI_file_block_offset_2_ID( file_index, child_block_offset.block, - child_block_offset.offset, ID, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Finally, update modification date **/ -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Create */ -/* end of file ADF_Create.c */ -/* file ADF_Database_Close.c */ -/*********************************************************************** -ADF Database Close: - -Close an opened database. If the ADF database spans multiple files, -then all files used will also be closed. If an ADF file which is -linked to by this database is also opened through another -database, only the opened file stream associated with this database -will be closed. - -ADF_Database_Close( Root_ID, error_return ) -input: const double Root_ID Root-ID of the ADF database. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Database_Close( - const double Root_ID, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; - -*error_return = NO_ERROR ; - - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( Root_ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Close the ADF file (which may close other sub-files) **/ -ADFI_close_file( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -} /* end of ADF_Database_Close */ -/* end of file ADF_Database_Close.c */ -/* file ADF_Database_Delete.c */ -/*********************************************************************** -ADF Database Delete: - -Delete an existing database. This will delete one or more ADF files -which are linked together under file top ADF file named "filename". - -ADF_Database_Delete( filename, error_return ) -input: char *filename Filename of the ADF database to delete. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Database_Delete( - const char *filename, - int *error_return ) -{ -ADFI_check_string_length( filename, ADF_FILENAME_LENGTH, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -fprintf(stderr,"Subroutine ADF_Database_Delete is not yet implemented...\n" ) ; -*error_return = UNIMPLEMENTED_CODE ; -CHECK_ADF_ABORT( *error_return ) ; -} /* end of ADF_Database_Delete */ -/* end of file ADF_Database_Delete.c */ -/* file ADF_Database_Garbage_Collection.c */ -/*********************************************************************** -ADF Database Garbage Collection: - -Garbage Collection. This capability will most likely be implemented -internally and will not be user-callable. - -ADF_Database_Garbage_Collection( ID, error_return ) -input: const double ID The ID of a node in the ADF file in which - to do garbage collection. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Database_Garbage_Collection( - const double ID, - int *error_return ) -{ -fprintf(stderr, -"Subroutine ADF_Database_Garbage_Collection is not yet implemented...\n" ) ; -*error_return = UNIMPLEMENTED_CODE ; -CHECK_ADF_ABORT( *error_return ) ; -} /* end of ADF_Database_Garbage_Collection */ - -/* end of file ADF_Database_Garbage_Collection.c */ -/* file ADF_Database_Get_Format.c */ -/*********************************************************************** -ADF Database Get Format: - -Get the data format used in an existing database. - -ADF_Database_Get_Format( Root_ID, format, error_return ) -input: const double Root_ID The root_ID of the ADF file. -output: char *format See format for ADFDOPN. Maximum of 20 - characters returned. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Database_Get_Format( - const double Root_ID, - char *format, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct FILE_HEADER file_header ; - -if( format == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( Root_ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get node_header for the node **/ -ADFI_read_file_header( file_index, &file_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -#define EVAL_2_BYTES( C0, C1 ) (((C0)<<8)+((C1))) - -switch( EVAL_2_BYTES( file_header.numeric_format, file_header.os_size ) ) { - case EVAL_2_BYTES( 'B', 'L' ) : - strcpy( format, IEEE_BIG_32_FORMAT_STRING ) ; - - break ; - - case EVAL_2_BYTES( 'L', 'L' ) : - strcpy( format, IEEE_LITTLE_32_FORMAT_STRING ) ; - break ; - - case EVAL_2_BYTES( 'B', 'B' ) : - strcpy( format, IEEE_BIG_64_FORMAT_STRING ) ; - - break ; - - case EVAL_2_BYTES( 'L', 'B' ) : - strcpy( format, IEEE_LITTLE_64_FORMAT_STRING ) ; - break ; - - case EVAL_2_BYTES( 'C', 'B' ) : - strcpy( format, CRAY_FORMAT_STRING ) ; - break ; - - case EVAL_2_BYTES( 'N', 'L' ) : - case EVAL_2_BYTES( 'N', 'B' ) : - strcpy( format, NATIVE_FORMAT_STRING ) ; - break ; - - default: - *error_return = ADF_FILE_FORMAT_NOT_RECOGNIZED ; - return ; - - } /* end switch */ - -} /* end of ADF_Database_Get_Format */ -/* end of file ADF_Database_Get_Format.c */ -/* file ADF_Database_Open.c */ -/*********************************************************************** -ADF Database Open: - -Open a database. Open either a new or an existing ADF file. If links to -other ADF files are used, these additional file will be opened -automatically as required. - -ADF_Database_Open( filename, status, format, root_ID, error_return) -input: const char *filename Not used if status SCRATCH is used. - Filename must be a legal name and may include a relative or - absolute path. It must be directly usable by the C fopen() - system routine. - -input: const char *status_in Like FORTRAN OPEN() status. - Allowable values are: - READ_ONLY - File must exist. Writing NOT allowed. - OLD - File must exist. Reading and writing allowed. - NEW - File must not exist. - SCRATCH - New file. Filename is ignored. - UNKNOWN - OLD if file exists, else NEW is used. - -input: const char *format Specifies the numeric format for the - file. If blank or NULL, the machine's native format is - used. This field is only used when a file is created. - NATIVE - Determine the format on the machine. If the - native format is not one of the formats - supported, the created file cannot be used on - other machines. - IEEE_BIG - Use the IEEE big ENDIAN format. - IEEE_LITTLE - Use the IEEE little ENDIAN format. - CRAY - Use the native Cray format. - -output: double *root_ID Root-ID of the opened ADF database. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -ADF_FILE_STATUS_NOT_RECOGNIZED -REQUESTED_NEW_FILE_EXISTS -FILE_OPEN_ERROR -***********************************************************************/ -void ADF_Database_Open( - const char *filename, - const char *status_in, - const char *format, - double *Root_ID, - int *error_return ) -{ -int iret ; -int error_dummy ; -char machine_format, format_to_use, os_to_use ; -char *status ; -int formats_compare ; -unsigned int file_index ; -unsigned int file_minor_version, lib_minor_version ; -struct FILE_HEADER file_header ; -struct NODE_HEADER node_header ; -struct FREE_CHUNK_TABLE free_chunk_table ; - -file_header.tag0[0] = '\0' ; - -status = (char *)status_in ; -if( status == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( Root_ID == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** DO NOT Check filename for NULL here, it may NOT be used... **/ - -*error_return = NO_ERROR ; - - /** Get this machine's numeric format **/ - ADFI_figure_machine_format( format, &machine_format, &format_to_use, - &os_to_use, error_return ) ; - -if( ADFI_stridx_c( status, "SCRATCH" ) != 0 ) { - ADFI_check_string_length( filename, ADF_FILENAME_LENGTH, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -ADFI_check_string_length( status, ADF_STATUS_LENGTH, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Determine the requested STATUS **/ -if( ADFI_stridx_c( status, "UNKNOWN" ) == 0 ) { - /** Determine the assessability of the filename **/ - iret = access( filename, F_OK ) ; - if( iret != 0 ) /* File does not exist, set status to NEW */ - status = "NEW" ; - else - status = "OLD" ; - } /* end else if */ - -if( (ADFI_stridx_c( status, "READ_ONLY" ) == 0) || - (ADFI_stridx_c( status, "OLD" ) == 0) ) { - /** Determine the assessability of the filename **/ - iret = access( filename, F_OK ) ; - if( iret != 0 ) { /* File does not exist, this is BAD for OLD */ - *error_return = REQUESTED_OLD_FILE_NOT_FOUND ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** open the file **/ - ADFI_open_file( filename, status, -1, &file_index, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else if */ - -else if( (ADFI_stridx_c( status, "NEW" ) == 0) || - (ADFI_stridx_c( status, "SCRATCH" ) == 0) ) { - /** Determine the assessability of the filename **/ - if( ADFI_stridx_c( status, "NEW" ) == 0 ) { - iret = access( filename, F_OK ) ; - if( iret == 0 ) { /* File exists, this is BAD for NEW */ - *error_return = REQUESTED_NEW_FILE_EXISTS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - if( errno != ENOENT ) { - *error_return = FILE_OPEN_ERROR ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - } /* end if */ - - /** Compose the file header **/ - ADFI_fill_initial_file_header( format_to_use, os_to_use, - ADF_D_identification, - &file_header, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Open the new file **/ - ADFI_open_file( filename, status, -1, &file_index, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** write out the file header **/ - ADFI_write_file_header( file_index, &file_header, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Compose Initial root-node header **/ - ADFI_fill_initial_node_header( &node_header, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - strncpy( node_header.name, ROOT_NODE_NAME, strlen( ROOT_NODE_NAME )) ; - strncpy( node_header.label, ROOT_NODE_LABEL, strlen( ROOT_NODE_LABEL ) ) ; - - /** Write out the root-node header **/ - ADFI_write_node_header( file_index, &file_header.root_node, - &node_header, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Compose Initial Free-Chunk Table **/ - ADFI_fill_initial_free_chunk_table( &free_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write out Free-Chunk Table **/ - ADFI_write_free_chunk_table( file_index, &free_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else if */ - -else { - *error_return = ADF_FILE_STATUS_NOT_RECOGNIZED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Initilaize the link separator for the file **/ -strcpy ( link_separator[file_index], ">" ) ; - - /** Read the header of the ADF file **/ -if( file_header.tag0[0] == '\0' ) { - ADFI_read_file_header( file_index, &file_header, error_return ) ; - if ( *error_return != NO_ERROR ) goto Open_Error ; - - /** Check Database version numbers for compatibility **/ - if( file_header.what[25] != ADF_D_identification[25] ) { -/* Look at major revision letter: version in file must equal what - this library would write unless there is a policy decision to - support both versions. */ - - *error_return = INVALID_VERSION ; - if ( *error_return != NO_ERROR ) goto Open_Error ; - } /* end if */ - - if( file_header.what[28] == '>' ) - { -/* we have an old file created before this version numbering scheme - was instituted - probably will not work */ - *error_return = INVALID_VERSION ; - if ( *error_return != NO_ERROR ) goto Open_Error ; - } - else /* check version number for file format compatibility */ - { -/* Look at minor revision number: version in file must be less than - or equal to what this library would write. */ - - ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &file_header.what[26], - &file_minor_version, error_return) ; - if ( *error_return != NO_ERROR ) goto Open_Error ; - - ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &ADF_D_identification[26], - &lib_minor_version, error_return) ; - if ( *error_return != NO_ERROR ) goto Open_Error ; - if( file_minor_version > lib_minor_version ) { - *error_return = INVALID_VERSION ; - if ( *error_return != NO_ERROR ) goto Open_Error ; - } /* end if */ - - if( file_minor_version < lib_minor_version ) { - /** If a new feature is added which requires that the file version - be changed then it is done here. Care must be take not to - break forward compatibility by changing the file version. Thus - new features may not be available for older file versions. - For instance version A1 files cannot be upgraded to version - A2 and above since a change was made to how links were store - and the file version is used to decide how to treat links. **/ - if ( ADF_D_identification[25] == 'A' && file_minor_version > 1 ) { - ADFI_remember_version_update( file_index, ADF_D_identification, - error_return ) ; - - if ( *error_return != NO_ERROR ) goto Open_Error ; - } /* end if */ - - /** The link separator was changed from " " to ">" in order - to support blanks in filenames under Windows. This change - is for version A02 and higher **/ - if ( ADF_D_identification[25] == 'A' && file_minor_version < 2 ) { - strcpy ( link_separator[file_index], " " ) ; - } /* end if */ - - } /* end if */ - } /* end if */ - } /* end if */ - - /** get the root ID for the user **/ -ADFI_file_block_offset_2_ID( file_index, file_header.root_node.block, - file_header.root_node.offset, Root_ID, error_return ) ; -if ( *error_return != NO_ERROR ) goto Open_Error ; - - /** Remember the file's data format **/ -ADFI_remember_file_format( file_index, file_header.numeric_format, - file_header.os_size, error_return ) ; -if ( *error_return != NO_ERROR ) goto Open_Error ; - - /** check machine modes, if machine is native the file must be !! **/ -ADFI_file_and_machine_compare( file_index, NULL, &formats_compare, - error_return ) ; -if ( *error_return != NO_ERROR ) goto Open_Error ; - - return ; - - Open_Error: - /** Close the ADF file and free its index **/ -ADFI_close_file( file_index, &error_dummy ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Database_Open */ -/* end of file ADF_Database_Open.c */ -/* file ADF_Database_Set_Format.c */ -/*********************************************************************** -ADF Database Set Format: - -Set the data format used in an existing database. - Note: Use with extreme caution. Needed only - for data conversion utilities and NOT intended - for the general user!!! - -ADF_Database_Set_Format( Root_ID, format, error_return ) -input: const double Root_ID The root_ID if the ADF file. -input: const char *format See format for ADFDOPN. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Database_Set_Format( - const double Root_ID, - const char *format, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct FILE_HEADER file_header ; -char machine_format, format_to_use, os_to_use ; - -ADFI_check_string_length( format, ADF_FORMAT_LENGTH, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( Root_ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get node_header for the node **/ -ADFI_read_file_header( file_index, &file_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_figure_machine_format( format, &machine_format, &format_to_use, - &os_to_use, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -file_header.numeric_format = format_to_use ; -file_header.os_size = os_to_use ; - - /** Get modification date to be updated with the header **/ -ADFI_get_current_date ( file_header.modification_date ); - - /** Now write the disk header out... **/ -ADFI_write_file_header( file_index, &file_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_remember_file_format( file_index, format_to_use, os_to_use, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Database_Set_Format */ -/* end of file ADF_Database_Set_Format.c */ -/* file ADF_Database_Version.c */ -/*********************************************************************** -ADF Database Version: - -Get ADF File Version ID. This is the version number of the ADF library -routines which created an ADF database. Modified ADF databases -will take on the version ID of the current ADF library version if -it is higher than the version indicated in the file. - The format of the version ID is: "ADF Database Version 000.01" - -ADF_Database_Version( Root_ID, version, creation_date, modification_date, - error_return ) -input: const double Root_ID The ID of the root node in the ADF file. -output: char *version A 32-byte character string containing the - version ID. -output: char *creation_date A 32-byte character string containing the - creation date of the file. -output: char *modification_date A 32-byte character string containing the - last modification date of the file. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Database_Version( - const double Root_ID, - char *version, - char *creation_date, - char *modification_date, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct FILE_HEADER file_header ; - -if( (version == NULL) || (creation_date == NULL) || - (modification_date == NULL) ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( Root_ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get node_header for the node **/ -ADFI_read_file_header( file_index, &file_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -*error_return = NO_ERROR ; - /** Convert the "what" string into a C string **/ -ADFI_string_2_C_string( &file_header.what[4], strcspn ( file_header.what, ">" ) - 4, - version, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Convert the creation date string into a C string **/ -ADFI_string_2_C_string( file_header.creation_date, 28, - creation_date, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Convert the modification date string into a C string **/ -ADFI_string_2_C_string( file_header.modification_date, 28, - modification_date, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Database_Version */ -/* end of file ADF_Database_Version.c */ -/* file ADF_Delete.c */ -/*********************************************************************** -ADF Delete: - -Delete a Node. If the node is NOT a link, then the specified node and all -sub-nodes anywhere under it are also deleted. For a link, and also -for links farther down in the tree, the link-node will be deleted, -but the node which the link is linked to is not affected. When a -node is deleted, other link-nodes which point to it are left -dangling. For example, if N13 is deleted, then L1 and L2 point to a -non-existing node. This is OK until L1 and L2 are used. - -ADF_Delete( PID, ID, error_return ) -input: const double PID The ID of the node's parent. -input: const double ID The ID of the node to use. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Delete( - const double PID, - const double ID, - int *error_return ) -{ -int num_ids , i, link_path_length ; -double *ids ; -unsigned int file_index ; -struct DISK_POINTER parent ; -struct DISK_POINTER child ; -struct NODE_HEADER node_header ; - - /** Don't use ADFI_chase_link() - delete link nodes but NOT the - nodes they are linked too **/ - -ADFI_ID_2_file_block_offset( ID, &file_index, &child.block, &child.offset, - error_return ) ; - -CHECK_ADF_ABORT( *error_return ) ; - -ADF_Is_Link( ID, &link_path_length, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_read_node_header( file_index, &child, &node_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Delete node data **/ - -if( link_path_length > 0 ) { /** this node IS a link **/ - /** Delete the link path data for this node **/ - ADFI_delete_data( file_index, &node_header, error_return ) ; - } -else { /** this node is NOT a link **/ - - /** Recursively delete all sub-nodes (children) of this node **/ - ADFI_get_direct_children_ids( file_index, &child, &num_ids, &ids, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - for( i=0; i 0 ) { - free( ids ) ; - } /* end if */ - - /** Delete all data for this node **/ - - ADF_Put_Dimension_Information( ID, "MT", 0, (int *)0, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if-else */ - - - /** Disassociate node from parent **/ -ADFI_ID_2_file_block_offset( PID, &file_index, - &parent.block, &parent.offset, error_return ) ; - /* file_index should be same as before since parent and child - should be in the same file */ -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_delete_from_sub_node_table( file_index, &parent, &child, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Delete this node's sub node table **/ -if( node_header.entries_for_sub_nodes > 0 ) { - ADFI_delete_sub_node_table( file_index, &node_header.sub_node_table, - node_header.entries_for_sub_nodes, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Delete node header from disk **/ -ADFI_file_free( file_index, &child, 0, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Finally, update modification date **/ -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Delete */ -/* end of file ADF_Delete.c */ -/* file ADF_Error_Message.c */ -/*********************************************************************** -ADF Error message: - -Return Error Message. Given an error_return from an ADF routine, -get a textual description of the error. - -ADF_Error_Message( error_return, error_string ) -input: const int error_return An ADF-generated error code. -output: char *error_string An 80-byte description of the specified error. - If the number is NULL, then print out error message. -***********************************************************************/ -void ADF_Error_Message( - const int error_return_input, - char *error_string ) -{ -char err_msg_str[ADF_MAX_ERROR_STR_LENGTH+1] ; - - /** If return pointer is NULL, print message to stdout **/ -if( error_string == NULL ) { - ADF_Error_Message( error_return_input, err_msg_str ) ; - fprintf(stderr,"%s\n", err_msg_str ) ; - return ; - } /* end if */ - - /** NO_ERROR is NOT zero for pointer-assignment checking **/ -if( error_return_input == NO_ERROR ) { - strcpy( error_string, ADF_error_string[ 0 ] ) ; - } /* end if */ - /** Check range of error code **/ -else if( (error_return_input <= 0) || - ((unsigned)error_return_input >= sizeof( ADF_error_string )/sizeof(char *) - 1 ) ) { - sprintf( error_string, "ADF: Unrecognized error number %d.", - error_return_input ) ; - } /* end else if */ - /** Error-code good, copy it for the user **/ -else { - strcpy( error_string, ADF_error_string[error_return_input] ) ; - } /* end else */ -} /* end of ADF_Error_Message */ -/* end of file ADF_Error_Message.c */ -/* file ADF_Flush_to_Disk.c */ -/*********************************************************************** -ADF Flush to Disk: - -Flush data to disk. This routine is used force any modified information -to be flushed to the physical disk. This ensures that data will not -be lost if a program aborts. This control of when to flush all data -to disk is provided to the user rather than to flush the data every -time it is modified, which would result in reduced performance. - -ADF_Flush_to_Disk( ID, error_return ) -input: const double ID The ID of a node in the ADF file to flush. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Flush_to_Disk( - const double ID, - int *error_return ) -{ -double LID ; -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; - - ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - ADFI_fflush_file( file_index, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; -} /* end of ADF_Flush_to_Disk */ -/* end of file ADF_Flush_to_Disk.c */ -/* file ADF_Get_Data_Type.c */ -/*********************************************************************** -ADF Get Data Type: - -Get Data Type. Return the 32 character string in a node's data-type field. -In C, the name will be null terminated after the last non-blank character. -A maximum of 33 characters may be used (32 for the name plus 1 for the null). - -ADF_Get_Data_Type( ID, data_type, error_return ) -input: const double ID The ID of the node to use. -output: char *data_type The 32-character data-type of the node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Data_Type( - const double ID, - char *data_type, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -double LID ; - -if( data_type == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Copy the blank-filled data-type into a C string **/ -ADFI_string_2_C_string( node.data_type, ADF_DATA_TYPE_LENGTH, data_type, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Get_Data_Type */ -/* end of file ADF_Get_Data_Type.c */ -/* file ADF_Get_Dimension_Values.c */ -/*********************************************************************** -ADF Get Dimension Values: - -Get Dimension Values. Return the dimension values for a node. Values -will be in the range of 1 to 100,000. Values will only be returned -for the number of dimensions defined in the node. If the number -of dimensions for the node is zero, an error is returned. - -ADF_Get_Dimension_Values( ID, dim_vals, error_return ) -input: const double ID The ID of the node to use. -output: int dim_vals[] Array for returned dimension values. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Dimension_Values( - const double ID, - int dim_vals[], - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -int i ; -double LID ; - -if( dim_vals == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Check for zero dimensions **/ -if( node.number_of_dimensions == 0 ) { - *error_return = ZERO_DIMENSIONS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Check for too-large-of dimensions **/ -if( node.number_of_dimensions > ADF_MAX_DIMENSIONS ) { - *error_return = BAD_NUMBER_OF_DIMENSIONS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Copy the dimension information **/ -for( i=0; i<(int)node.number_of_dimensions; i++ ) - dim_vals[i] = node.dimension_values[i] ; - -} /* end of ADF_Get_Dimension_Values */ -/* end of file ADF_Get_Dimension_Values.c */ -/* file ADF_Get_Error_State.c */ -/*********************************************************************** -ADF Get Error State: - -Get Error State. Return the current error state. - -ADF_Get_Error_State( error_state, error_return ) -output: int *error_state Flag for ABORT on error (1) or return error - status (0). -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Error_State( - int *error_state, - int *error_return ) -{ -if( error_state == 0L ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -if( ADF_abort_on_error == TRUE ) - *error_state = 1 ; -else - *error_state = 0 ; - -} /* end of ADF_Get_Error_State */ -/* end of file ADF_Get_Error_State.c */ -/* file ADF_Get_Label.c */ -/*********************************************************************** -ADF Get Label: - -Return the 32 character string in a node's label field. - -ADF_Get_Label( ID, label, error_return ) -input: const double ID The ID of the node to use. -output: char *label The 32-character label of the node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Label( - const double ID, - char *label, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -double LID ; - -if( label == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Copy the blank-filled label type into a C string **/ -ADFI_string_2_C_string( node.label, ADF_LABEL_LENGTH, label, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Get_Label */ -/* end of file ADF_Get_Label.c */ -/* file ADF_Get_Link_Path.c */ -/*********************************************************************** -ADF Get Link path: - -Get path information from a link. If the node is a link-node, return -the path information. Else, return an error. If the link is in the same -file, then the filename returned is zero length. - -ADF_Get_Link_Path( ID, file, name_in_file, error_return ) -input: const double ID The ID of the node to use. -output: char *file The returned filename -output: char *name_in_file The returned name of node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Link_Path( - const double ID, - char *file, - char *name_in_file, - int *error_return ) -{ -unsigned int file_index ; -int file_bytes, machine_bytes, total_bytes ; -char file_format, machine_format ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node_header ; -struct TOKENIZED_DATA_TYPE tokenized_data_type[ 2 ] ; -char link_data[ADF_FILENAME_LENGTH + ADF_MAX_LINK_DATA_SIZE + 1 + 1] ; -size_t lenfilename ; - -if( file == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( name_in_file == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get node_header for the node **/ -ADFI_read_node_header( file_index, &block_offset, &node_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( (node_header.data_type[0] != 'L') || (node_header.data_type[1] != 'K')) { - *error_return = NODE_IS_NOT_A_LINK ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Get tokenized datatype **/ -ADFI_evaluate_datatype( file_index, node_header.data_type, - &file_bytes, &machine_bytes, tokenized_data_type, - &file_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -total_bytes = file_bytes * node_header.dimension_values[0] ; -ADFI_read_data_chunk( file_index, &node_header.data_chunks, - tokenized_data_type, file_bytes, total_bytes, - 0, total_bytes, link_data, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /* NULL terminate the string */ -link_data[ node_header.dimension_values[0] ] = '\0' ; - -file[0] = '\0' ; -name_in_file[0] = '\0' ; - - /** look for file/link delimiter **/ -lenfilename = strcspn ( link_data, link_separator[file_index] ) ; - -if ( lenfilename == 0 ) /** no filename **/ -{ - strcpy( name_in_file, &link_data[1] ); -} -else if ( lenfilename > 0 && lenfilename == strlen( link_data ) ) -{ - strcpy( file, link_data) ; /** no link ? **/ -} -else -{ - strncpy( file, link_data, lenfilename) ; - file[lenfilename] = '\0'; - strcpy( name_in_file, &link_data[lenfilename+1] ); -} /* end if */ - -} /* end of ADF_Get_Link_Path */ -/* end of file ADF_Get_Link_Path.c */ -/* file ADF_Get_Name.c */ -/*********************************************************************** -ADF get name: - -Get Name of a Node. Given a node's ID, return the 32 character name of -that node. - -ADF_Get_Name( ID, name, error_return ) -input: const double ID The ID of the node to use. -output: char *name The simple name of the node (no path info). -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Name( - const double ID, - char *name, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; - -if( name == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get node_header for the node **/ -ADFI_read_node_header( file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Copy the blank-filled name into a C string **/ -ADFI_string_2_C_string( node.name, ADF_NAME_LENGTH, name, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Get_Name */ -/* end of file ADF_Get_Name.c */ -/* file ADF_Get_Node_ID.c */ -/*********************************************************************** -ADF get Node ID: - -Get Unique-Identifier of a Node. Given a parent node ID and a name of -a child node, this routine returns the ID of the child. If the child -node is a link, the ID of the link node is returned (not the ID of the -linked-to node) - otherwise there would be no way to obtain the ID -of a link node. - -The child name may be a simple name or a compound path name. -If the name is a compound path name and it begins with a '/', -then the parent node ID may be any valid ID in the same database -as the first node in the path. If the name is only "/" and the -parent ID is any valid ID in the database, the root ID is returned. -If the name is a compound path name and does not begin with a '/', -then the parent node ID is the ID of the parent of the first node -in the path. If the path name contains a link node (except for -the ending leaf node), then the link is followed. - - -ADF_Get_Node_ID( PID, name, ID, error_return ) -input: const double PID The ID of name's parent. -input: const char *name The name of the node. Compound - names including path information use a slash "/" notation between - node names. If a leading slash is used, then PID can be any - valid node ID in the ADF database of the first name in the path. - -output: double *ID The ID of the named node. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADF_Get_Node_ID( - const double PID, - const char *name, - double *ID, - int *error_return ) -{ -double LID ; -int found ; -int name_length ; -unsigned int file_index ; -struct DISK_POINTER parent_block_offset, sub_node_entry_location ; -struct SUB_NODE_TABLE_ENTRY sub_node_entry ; -struct NODE_HEADER node_header ; -char *name_tmp, *name_ptr, *name_pos ; - -if( name == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -name_length = strlen( name ) ; -if( name_length == 0 ) { - *error_return = STRING_LENGTH_ZERO ; - return ; - } /* end if */ - -if( ID == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -*ID = PID ; /** initialize the ID variable to use in intermediate steps **/ - -if( name[0] == '/' ) { /** start at the root node **/ - /** according to user documentation, PID can be any valid node - in the database, but we need to use it to get the root ID - in order to start at the top **/ - - ADF_Get_Root_ID( PID, ID, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** This is the root-node, return the Root-ID **/ - if( name[ 1 ] == '\0' ) { - return ; /** NOT an error, just done and need to get out **/ - } /* end if */ - } /* end if */ - -name_tmp = (char *) malloc( (name_length + 1) * sizeof( char ) ) ; -if( name_tmp == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -strcpy( name_tmp, name ) ; - - /** start search for tokens (names separated by '/') **/ -name_pos = name_tmp ; -name_ptr = ADFI_strtok( name_tmp, &name_pos, "/" ) ; -if( name_ptr == NULL ) { /** this should never happen but check anyway **/ - *error_return = INVALID_NODE_NAME ; - CHECK_ADF_ABORT1( *error_return ) ; - } /* end if */ - - /** Get file-index, etc. to start. Note: Parent ID may be a link **/ -ADFI_chase_link( *ID, &LID, &file_index, - &parent_block_offset, &node_header, error_return ) ; -CHECK_ADF_ABORT1( *error_return ) ; -*ID = LID ; - - /** Track through the possible compound name string **/ -while( name_ptr ) { - - /** Find this child under the current parent **/ - ADFI_check_4_child_name( file_index, &parent_block_offset, name_ptr, &found, - &sub_node_entry_location, &sub_node_entry, error_return ) ; - CHECK_ADF_ABORT1( *error_return ) ; - - if( found == 0 ) { /** Child NOT found **/ - *error_return = CHILD_NOT_OF_GIVEN_PARENT ; - CHECK_ADF_ABORT1( *error_return ) ; - } /* end if */ - - /** create the child ID **/ - ADFI_file_block_offset_2_ID( file_index, - sub_node_entry.child_location.block, - sub_node_entry.child_location.offset, ID, error_return ) ; - - /** Get the next node-name token (NULL if no more). This is needed - for the while-loop check and normally would be done at the - end of the loop, but it is useful in the next step to see if - there are any more branches in the path. **/ - name_ptr = ADFI_strtok( name_tmp, &name_pos, "/" ) ; - - /** If this node is the last in the path it may be a link, but - there needs to be a mechanism by which a link's ID can - be determined and so we cannot follow the link at this time. **/ - if( name_ptr != NULL ) { - /* Make sure we have a real ID so we can continue the search */ - ADFI_chase_link( *ID, &LID, &file_index, &parent_block_offset, - &node_header, error_return ) ; - CHECK_ADF_ABORT1( *error_return ) ; - *ID = LID ; - - /** This child now becomes the parent. Do it again... **/ - ADFI_ID_2_file_block_offset( *ID, &file_index, - &parent_block_offset.block, - &parent_block_offset.offset, - error_return ) ; - CHECK_ADF_ABORT1( *error_return ) ; - } /* end if */ - - } /* end while */ - -free( name_tmp ) ; - -} /* end of ADF_Get_Node_ID */ -/* end of file ADF_Get_Node_ID.c */ -/* file ADF_Get_Number_of_Dimensions.c */ -/*********************************************************************** -ADF Get Number of Dimensions: - -Get Number of Dimensions. Return the number of data dimensions -used in a node. Valid values are from 0 to 12. - -ADF_Get_Number_of_Dimensions( ID, num_dims, error_return) -input: const double ID The ID of the node to use. -output: int *num_dims The returned number of dimensions. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Number_of_Dimensions( - const double ID, - int *num_dims, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -double LID ; - -if( num_dims == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, - &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Return the number of dimensions **/ -*num_dims = node.number_of_dimensions ; - -} /* end of ADF_Get_Number_of_Dimensions */ -/* end of file ADF_Get_Number_of_Dimensions.c */ -/* file ADF_Get_Root_ID.c */ -/*********************************************************************** -ADF_Get_Root_ID: - Get root-ID for an ADF system from any ID in the system. - -input: const double ID The ID of the node to use. -output: *double Root_ID The returned ID of the root node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Get_Root_ID( - const double ID, - double *Root_ID, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct FILE_HEADER file_header ; - -if( Root_ID == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Get the file ID **/ -ADFI_ID_2_file_block_offset( ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Use the file header to find the root ID **/ -ADFI_read_file_header( file_index, &file_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Format the root ID **/ -ADFI_file_block_offset_2_ID( file_index, file_header.root_node.block, - file_header.root_node.offset, Root_ID, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Get_Root_ID */ -/* end of file ADF_Get_Root_ID.c */ -/* file ADF_Is_Link.c */ -/*********************************************************************** -ADF Is Link: - -Test if a Node is a link. If the actual data-type of the node is "LK" -(created with ADF_Link), return the link path length. Otherwise, -return 0. - -ADF_Is_Link( ID, link_path_length, error_return ) -input: const double ID The ID of the node to use. -output: int *link_path_length 0 if the node is NOT a link. If the - node is a link, the length of the path string is returned. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Is_Link( - const double ID, - int *link_path_length, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node_header ; - -if( link_path_length == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get node_header for the node **/ -ADFI_read_node_header( file_index, &block_offset, &node_header, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( (node_header.data_type[0] == 'L') && (node_header.data_type[1] == 'K')) - *link_path_length = node_header.dimension_values[0] ; -else - *link_path_length = 0 ; - -} /* end of ADF_Is_Link */ -/* end of file ADF_Is_Link.c */ -/* file ADF_Library_Version.c */ -/*********************************************************************** -ADF Library Version: - -Get ADF Library Version ID. This is the version number of the ADF -library routines which your program is currently using. - The format of the version ID is: "ADF Library Version 000.01" - -ADF_Library_Version( version, error_return ) -output: char *version A 32-byte character string containing - the ADF Library version ID information. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Library_Version( - char *version, - int *error_return ) -{ - -int lversion; - -if( version == NULL ) { - *error_return = NULL_STRING_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Copy the proper portion of the "what" string **/ -strcpy ( version, &ADF_L_identification[4] ) ; -lversion = strlen ( version ) ; -version[lversion-1] = '\0' ; /** remove trailing "what" delimiter ('>') **/ -} /* end of ADF_Library_Version */ -/* end of file ADF_Library_Version.c */ -/* file ADF_Link.c */ -/*********************************************************************** -ADF Link: - -Create a link. Note: The Node linked to does not have to exist when the -link is created (but it may exist and that is OK). However, when -the link is used, an error will occur if the linked to node does not -exist. - -ADF_Link( PID, name, file, name_in_file, ID, error_return ) -input: const double PID The ID of the Node's parent. -input: const char *name The name of the link node. -input: const char *file The filename to use for the link (directly - usable by a C open() routine). If blank (null), - the link will be within the same file. - -input: const char *name_in_file The name of the node which - the link will point to. This can be a simple or compound name. - -output: double ID The returned ID of the link-node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Link( - const double PID, - const char *name, - const char *file_name, - const char *name_in_file, - double *ID, - int *error_return ) -{ -char link_data[ADF_FILENAME_LENGTH + - ADF_MAX_LINK_DATA_SIZE + 2] ; -int null_filename = FALSE ; -int filename_length, linked_to_length, data_length ; -int dim_vals[1] ; -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node_header ; - - /** Don't check file since it can be a NULL pointer **/ - -ADFI_check_string_length( name, ADF_NAME_LENGTH, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_check_string_length( name_in_file, ADF_MAX_LINK_DATA_SIZE, error_return ); -CHECK_ADF_ABORT( *error_return ) ; - -ADF_Is_Link( PID, &linked_to_length, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; -if ( linked_to_length > 0 ) { - *error_return = LINKS_TOO_DEEP ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Create the node in the normal way **/ -ADF_Create( PID, name, ID, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get the file, block, and offset numbers from the ID **/ -ADFI_ID_2_file_block_offset( *ID, &file_index, &block_offset.block, - &block_offset.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Add the file and linked-to name as data in the child **/ -ADFI_check_string_length( file_name, ADF_FILENAME_LENGTH, error_return ) ; -if( *error_return != NO_ERROR ) { - null_filename = TRUE ; - filename_length = 0 ; - } /* end if */ -else { - filename_length = strlen( file_name) ; - } /* end else */ -linked_to_length = strlen( name_in_file ) ; - -data_length = filename_length + linked_to_length + 1 ; -if( data_length > ADF_FILENAME_LENGTH + ADF_MAX_LINK_DATA_SIZE + 1 ) { - *error_return = STRING_LENGTH_TOO_BIG ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( null_filename == TRUE ) { - sprintf( link_data, "%s%s", link_separator[file_index], name_in_file ) ; - } /* end if */ -else { - sprintf( link_data, "%s%s%s", file_name, link_separator[file_index], - name_in_file ) ; - } /* end else */ - - /** We must use a datatype of "C1" to put the data into this node. - With a datatype of "Lk" (a link), the written data will go - into the linked-to node (that's the whole point). To set - this up we must be careful... - **/ -dim_vals[0] = data_length ; -ADF_Put_Dimension_Information( *ID, "C1", 1, dim_vals, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADF_Write_All_Data( *ID, link_data, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Change the datatype to be LK, without deleting the data. - We can't use ADF_Put_Dimension_Information since the change - of datatype will delete the data. We must do this manually. - **/ - -ADFI_read_node_header( file_index, &block_offset, &node_header, error_return ); -CHECK_ADF_ABORT( *error_return ) ; - -if( (node_header.data_type[0] != 'C') || (node_header.data_type[1] != '1') || - (node_header.data_type[2] != ' ') ) { - *error_return = INVALID_DATA_TYPE ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -node_header.data_type[0] = 'L' ; -node_header.data_type[1] = 'K' ; -ADFI_write_node_header( file_index, &block_offset, &node_header, error_return ); -CHECK_ADF_ABORT( *error_return ) ; - - /** Finally, update modification date **/ -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Link */ -/* end of file ADF_Link.c */ -/* file ADF_Move_Child.c */ -/*********************************************************************** -ADF Move Child: - -Change Parent (move a Child Node). The node and the 2 parents must -all exist within a single ADF file. If the node is pointed to by a -link-node, changing the node's parent will break the link. - -ADF_Move_Child( PID, ID, NPID, error_return ) -input: double PID The ID of the Node's parent. -input: double ID The ID of the node to use. -input: double NPID The ID of the Node's New Parent -output: int *error_return Error return. -***********************************************************************/ -void ADF_Move_Child( - const double PID, - const double ID, - const double NPID, - int *error_return ) -{ - -unsigned int parent_file_index, child_file_index, - new_parent_file_index, file_index ; -char child_name[ ADF_NAME_LENGTH ] ; -int found ; -struct DISK_POINTER parent, child, new_parent, sub_node_entry_location ; -struct SUB_NODE_TABLE_ENTRY sub_node_entry ; - -*error_return = NO_ERROR ; - -ADFI_ID_2_file_block_offset( PID, &parent_file_index, &parent.block, - &parent.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_ID_2_file_block_offset( ID, &child_file_index, &child.block, - &child.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( child_file_index != parent_file_index ) { - *error_return = NODES_NOT_IN_SAME_FILE ; - CHECK_ADF_ABORT( *error_return ) ; - } - -ADFI_ID_2_file_block_offset( NPID, &new_parent_file_index, &new_parent.block, - &new_parent.offset, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( new_parent_file_index != parent_file_index ) { - *error_return = NODES_NOT_IN_SAME_FILE ; - CHECK_ADF_ABORT( *error_return ) ; - } - -file_index = parent_file_index ; /* use a shorter, more generic name - - file indices should now be the same - for all 3 nodes */ - - /** check that child is really a child of parent **/ -ADF_Get_Name( ID, child_name, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_check_4_child_name( file_index, &parent, child_name, &found, - &sub_node_entry_location, &sub_node_entry, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( found == 0 ) { /* child not found */ - *error_return = CHILD_NOT_OF_GIVEN_PARENT ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** add child to its new parent's sub node table **/ -ADFI_add_2_sub_node_table( file_index, &new_parent, &child, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** remove child from its old parent's sub node table **/ -ADFI_delete_from_sub_node_table( file_index, &parent, &child, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Move_Child */ -/* end of file ADF_Move_Child.c */ -/* file ADF_Number_of_Children.c */ -/*********************************************************************** -ADF Number of Children; - -Get Number of Children of a Node. Return the number of children -nodes directly associated with a parent node. - -ADF_Number_of_Children( ID, num_children, error_return ) -input: const double ID The ID of the node to use. -output: int *num_children The number of children directly - associated with this node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Number_of_Children( - const double ID, - int *num_children, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -double LID ; - -if( num_children == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Return the number of children **/ -*num_children = node.num_sub_nodes ; -} /* end of ADF_Number_of_Children */ -/* end of file ADF_Number_of_Children.c */ -/* file ADF_Put_Dimension_Information.c */ -/*********************************************************************** -ADF Put Dimension Information: - -Set/change the data-type and Dimension Information of a Node. Valid -user-definable data-types are: - -No data MT -Integer 32 I4 -Integer 64 I8 -Unsigned Int 32 U4 -Unsigned Int 64 U8 -Real 32 R4 -Real 64 R8 -Complex 64 X4 -Complex 128 X8 -Character (unsigned byte) C1 -Byte (unsigned byte) B1 -Compound data-types can be used which combine types -("I4,I4,R8"), define an array ("I4[25]"), or a combination of these -("I4,C1[20],R8[3]"). -dims can be a number from 0 to 12. - -dim_vals is an array of integers. The number of integers used is -determined by the dims argument. If dims is zero, the dim_values -are not used. Valid range for dim_values are from 1 to 2,147,483,648. -The total data size, calculated by the data-type-size times the -dimension value(s), cannot exceed 2,147,483,648. - -Note: When this routine is called and the data-type or the -number of dimensions changes, any data currently associated -with the node is lost!! The dimension values can be changed and -the data space will be extended as needed. - -ADF_Put_Dimension_Information( ID, data_type, dims, dim_vals, error_return ) -input: const double ID The ID of the node. -input: const char *data-type The data-type to use. -input: const int dims The number of dimensions this node has. -input: const int dim_vals[] The dimension values for this node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Put_Dimension_Information( - const double ID, - const char *data_type, - const int dims, - const int dim_vals[], - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -struct TOKENIZED_DATA_TYPE - tokenized_data_type[ 1 + (ADF_DATA_TYPE_LENGTH + 1)/3 ] ; -char file_format, machine_format ; -int file_bytes[2], machine_bytes[2] ; -int data_bytes, old_data_bytes ; -int i, datatype_length ; -int preserve_data = FALSE ; -double LID ; - -ADFI_check_string_length( data_type, ADF_DATA_TYPE_LENGTH, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( dim_vals == NULL && dims > 0 ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Check new datatype **/ -ADFI_evaluate_datatype( file_index, data_type, - &file_bytes[0], &machine_bytes[0], - tokenized_data_type, &file_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Look at old datatype **/ -ADFI_evaluate_datatype( file_index, node.data_type, - &file_bytes[1], &machine_bytes[1], - tokenized_data_type, &file_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Calculate new data-size **/ -if( dims < 0 ) { - *error_return = NUMBER_LESS_THAN_MINIMUM ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -if( dims > ADF_MAX_DIMENSIONS) { - *error_return = BAD_NUMBER_OF_DIMENSIONS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** If the number of dimensions is zero, set data-bytes to zero **/ -if( dims == 0 ) - data_bytes = 0 ; -else { /** Calculate the total number of bytes in the data **/ - for( data_bytes=file_bytes[0], i=0; i ADF_NAME_LENGTH ) { - *error_return = STRING_LENGTH_TOO_BIG ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( name_length == 0 ) { - *error_return = STRING_LENGTH_ZERO ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Need to check for uniqueness and legality of the name **/ -ADFI_check_4_child_name( file_index, &parent_block_offset, - &name[ name_start ], &found, &sub_node_entry_location, - &sub_node_entry, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( found == 1 ) { - *error_return = DUPLICATE_CHILD_NAME ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -for ( i=0; i < name_length; i++ ) { - if ( ! isprint ( name[ name_start + i ] ) || - name[ name_start + i ] == '/' ) { - *error_return = INVALID_NODE_NAME; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - } /* end for */ - - /** Confirm that child is from the parent **/ -ADFI_check_4_child_name( file_index, &parent_block_offset, - child_node.name, &found, &sub_node_entry_location, - &sub_node_entry, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( found == 0 ) { - *error_return = CHILD_NOT_OF_GIVEN_PARENT ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -if( (child_block_offset.block != sub_node_entry.child_location.block) || - (child_block_offset.offset != sub_node_entry.child_location.offset) ) { - *error_return = CHILD_NOT_OF_GIVEN_PARENT ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Copy the name **/ -name_length = strlen( name ) ; -for( i=0; i total_bytes ) { - bytes_to_read = total_bytes - bytes_read ; - } /* end if */ - if( bytes_to_read == 0 ) - break ; - ADFI_read_data_chunk( file_index, &data_chunk_table[i].start, - tokenized_data_type, file_bytes, bytes_to_read, 0, - bytes_to_read, data_pointer, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - -/** note: memory_bytes and file_bytes might be different (e.g., if machine - is "IEEE_BIG" and file is "CRAY") in which case data pointer advances - at a different rate from file pointer. **/ - data_pointer += (bytes_to_read * memory_bytes) / file_bytes ; - bytes_read += bytes_to_read ; - } /* end for */ - free( data_chunk_table ) ; - if( bytes_read < total_bytes ) { - *error_return = INCOMPLETE_DATA ; - memset( data_pointer, 0, total_bytes - bytes_read ) ; - } /* end if */ - } /* end else */ - -} /* end of ADF_Read_All_Data */ -/* end of file ADF_Read_All_Data.c */ -/* file ADF_Read_Block_Data.c */ -/*********************************************************************** -ADF Read Block Data: - -Read a continous block of data from a Node. Reads a block the node's data -and returns it into a contiguous memory space. - -ADF_Read_Block_Data( ID, data, error_return ) -input: const double ID The ID of the node to use. -input: const long b_start The starting point in block in token space -input: const long b_end The ending point in block in token space -output: char *data The start of the data in memory. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Read_Block_Data( - const double ID, - const long b_start, - const long b_end, - char *data, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -struct TOKENIZED_DATA_TYPE - tokenized_data_type[ 1 + (ADF_DATA_TYPE_LENGTH + 1)/3 ] ; -struct DATA_CHUNK_TABLE_ENTRY *data_chunk_table ; -char *data_pointer ; - -char file_format, machine_format ; -int file_bytes, memory_bytes, bytes_to_read ; -long total_bytes, bytes_read, start_offset ; -long chunk_size, chunk_end_byte ; -long start_byte, end_byte, block_bytes ; -int i, j ; -double LID ; - -if( data == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get datatype size **/ -ADFI_evaluate_datatype( file_index, node.data_type, &file_bytes, &memory_bytes, - tokenized_data_type, &file_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( (file_bytes == 0) || (node.number_of_dimensions == 0) ) { - *error_return = NO_DATA ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Calculate total number of bytes in the data **/ -total_bytes = file_bytes ; -for( j=0; j<(int)node.number_of_dimensions; j++ ) - total_bytes *= node.dimension_values[j] ; -if( total_bytes == 0 ) { - *error_return = ZERO_DIMENSIONS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Calculate the starting and ending range in the file **/ -start_byte = file_bytes * (b_start-1) ; -end_byte = file_bytes * b_end ; -if ( start_byte < 0 || start_byte > end_byte || end_byte > total_bytes ) { - *error_return = START_OUT_OF_DEFINED_RANGE ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -block_bytes = end_byte - start_byte ; - - /** If there is NO DATA, fill data space with zeros, return error **/ -if( node.number_of_data_chunks == 0 ) { - memset( data, 0, block_bytes*memory_bytes/file_bytes ) ; - *error_return = NO_DATA ; - return ; /** NO_DATA is really a warning, so don't check & abort... **/ - } /* end if */ - - /** Read the data from disk **/ -else if( node.number_of_data_chunks == 1 ) { - ADFI_read_data_chunk( file_index, &node.data_chunks, tokenized_data_type, - file_bytes, total_bytes, start_byte, block_bytes, - data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else if */ -else { - /** Allocate memory for the required table space in memory **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( node.number_of_data_chunks * sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Read in the table **/ - ADFI_read_data_chunk_table( file_index, &node.data_chunks, - data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Read data from each entry in the table **/ - bytes_read = 0 ; - chunk_end_byte = 0 ; - data_pointer = data ; - for( i=0; i<(int)node.number_of_data_chunks; i++ ) { - chunk_size = - (data_chunk_table[i].end.block - data_chunk_table[i].start.block) * - DISK_BLOCK_SIZE + - (data_chunk_table[i].end.offset - data_chunk_table[i].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - - /** Check to be sure we don't think the chunk is bigger than it is - (shrinking a data block can cause this) - **/ - if( chunk_end_byte + chunk_size > total_bytes ) { - chunk_size = total_bytes - chunk_end_byte ; - } /* end if */ - if( chunk_size == 0 ) - break ; - - chunk_end_byte += chunk_size ; - - /** If start of block not in this chunk then continue **/ - if ( start_byte > chunk_end_byte ) - continue ; - - /** Set offset into the current chunk **/ - if ( start_byte > (chunk_end_byte - chunk_size) ) - /** The start of the block is inside the current chunk so - adjust the offset to the beginning of the block **/ - start_offset = ( start_byte - (chunk_end_byte-chunk_size) ) ; - else - start_offset = 0 ; - - /** Calculate the number of bytes needed in this chunk **/ - bytes_to_read = chunk_size - start_offset ; - if( bytes_read + bytes_to_read > block_bytes ) { - bytes_to_read = block_bytes - bytes_read ; - } /* end if */ - if( bytes_to_read == 0 || (chunk_end_byte-chunk_size) > end_byte ) - break ; - - ADFI_read_data_chunk( file_index, &data_chunk_table[i].start, - tokenized_data_type, file_bytes, chunk_size, start_offset, - bytes_to_read, data_pointer, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - -/** note: memory_bytes and file_bytes might be different (e.g., if machine - is "IEEE_BIG" and file is "CRAY") in which case data pointer advances - at a different rate from file pointer. **/ - data_pointer += (bytes_to_read * memory_bytes) / file_bytes ; - bytes_read += bytes_to_read ; - } /* end for */ - free( data_chunk_table ) ; - if( bytes_read < block_bytes ) { - *error_return = INCOMPLETE_DATA ; - memset( data_pointer, 0, total_bytes - bytes_read ) ; - } /* end if */ - } /* end else */ - -} /* end of ADF_Read_Block_Data */ -/* end of file ADF_Read_Block_Data.c */ -/* file ADF_Read_Data.c */ -/*********************************************************************** -ADF Read Data: - -Read data from a node, with partial capabilities. The partial -capabilities are both in the node's data and also in memory. -Vectors of integers are used to indicate the data to be accessed -from the node, and another set of integer vectors is used to -describe the memory location for the data. - Note: If the data-type of the node is a compound data-type ("I4[3],R8") -for example, the partial capabilities will access one or more of -these 20-byte data entities. You cannot access a subset of an -occurrence of the data-type. - -ADF_Read_Data( ID, s_start[], s_end[], s_stride[], m_num_dims, - m_dims[], m_start[], m_end[], m_stride[], data, error_return ) -input: const double ID The ID of the node to use. -input: const int s_start[] The starting dimension values to use in - the database (node). -input: const int s_end[] The ending dimension values to use in - the database (node). -input: const int s_stride[] The stride values to use in the database (node). -input: const int m_num_dims The number of dimensions to use in memory. -input: const int m_dims[] The dimensionality to use in memory. -input: const int m_start[] The starting dimension values to use in memory. -input: const int m_end[] The ending dimension values to use in memory. -input: const int m_stride[] The stride values to use in memory. -output: char *data The start of the data in memory. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Read_Data( - const double ID, - const int s_start[], - const int s_end[], - const int s_stride[], - const int m_num_dims, - const int m_dims[], - const int m_start[], - const int m_end[], - const int m_stride[], - char *data, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset, relative_block ; -struct NODE_HEADER node ; -struct TOKENIZED_DATA_TYPE - tokenized_data_type[ 1 + (ADF_DATA_TYPE_LENGTH + 1)/3 ] ; -int current_disk[ADF_MAX_DIMENSIONS] ; -int current_memory[ADF_MAX_DIMENSIONS] ; -unsigned long total_disk_elements, total_memory_elements ; -unsigned long disk_offset, memory_offset ; -char disk_format, machine_format ; -int formats_compare ; -int i ; -int file_bytes = 0 ; -int memory_bytes = 0 ; -int no_data = FALSE ; -double LID ; -unsigned long relative_offset, current_chunk, current_chunk_size, - past_chunk_sizes ; -struct DATA_CHUNK_TABLE_ENTRY *data_chunk_table ; - -if( (s_start == NULL) || (s_end == NULL) || (s_stride == NULL) || - (m_dims == NULL) || (m_start == NULL) || (m_end == NULL) || - (m_stride == NULL) || (data == NULL) ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get datatype length **/ -ADFI_evaluate_datatype( file_index, node.data_type, &file_bytes, &memory_bytes, - tokenized_data_type, &disk_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( (file_bytes == 0) || (node.number_of_dimensions == 0) ) { - *error_return = NO_DATA ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -ADFI_count_total_array_points( node.number_of_dimensions, - node.dimension_values, - s_start, s_end, s_stride, - &total_disk_elements, &disk_offset, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_count_total_array_points( (unsigned int)m_num_dims, - (unsigned int *)m_dims, - m_start, m_end, m_stride, - &total_memory_elements, &memory_offset, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( total_disk_elements != total_memory_elements ) { - *error_return = UNEQUAL_MEMORY_AND_DISK_DIMS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -ADFI_file_and_machine_compare( file_index, tokenized_data_type, - &formats_compare, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Check to see if there is actual data to use **/ -if( node.number_of_data_chunks == 0 ) { - no_data = TRUE ; - } /* end if */ - /** Check for multiple data-chunks **/ -else if( node.number_of_data_chunks == 1 ) { /** A single data chunk **/ - /** Point to the start of the data **/ - block_offset.block = node.data_chunks.block ; - block_offset.offset = node.data_chunks.offset + TAG_SIZE + - DISK_POINTER_SIZE + disk_offset * file_bytes ; - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else if */ -else if( node.number_of_data_chunks > 1 ) { /** Multiple data chunks **/ - current_chunk = 0 ; - past_chunk_sizes = 0 ; - relative_offset = disk_offset * file_bytes ; - /** Allocate memory for the required table space in memory **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( node.number_of_data_chunks * sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Read in the table **/ - ADFI_read_data_chunk_table( file_index, &node.data_chunks, - data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - current_chunk_size = (data_chunk_table[ current_chunk ].end.block - - data_chunk_table[ current_chunk ].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[ current_chunk ].end.offset - - data_chunk_table[ current_chunk ].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - - } /* end else if */ - - /** Setup initial indexing **/ -for( i=0; i<(int)node.number_of_dimensions; i++ ) - current_disk[i] = s_start[i] ; -for( i=0; i DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - if( formats_compare ) { - /** Read the data off of disk directly **/ - ADFI_read_file( file_index, block_offset.block, block_offset.offset, - file_bytes, (char *)data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { /** Read and translate data **/ - ADFI_read_data_translated( file_index, block_offset.block, - block_offset.offset, tokenized_data_type, file_bytes, - file_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Increment disk pointers, for the special case of one dimensional - data we will a simple increment to maximize the throught. Thus for - block reads you can temporarily change to 1D for the read to - improve efficiency. Note total size shouldn't change!! **/ - if( (unsigned)i < total_disk_elements - 1 ) { - if ( node.number_of_dimensions == 1 ) { - disk_offset = s_stride[0]; - current_disk[0] += disk_offset; - if ( current_disk[0] > s_end[0] ) current_disk[0] = s_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - node.number_of_dimensions, node.dimension_values, - s_start, s_end, s_stride, current_disk, &disk_offset, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - block_offset.offset += disk_offset * file_bytes ; - if ( block_offset.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - } /* end if */ - } /* end else if */ - else if( node.number_of_data_chunks > 1 ) { /** Multiple data chunks **/ - while( relative_offset >= past_chunk_sizes + current_chunk_size ) { - if( ++current_chunk >= node.number_of_data_chunks ) { - *error_return = INCOMPLETE_DATA ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { - past_chunk_sizes += current_chunk_size ; - current_chunk_size = (data_chunk_table[ current_chunk ].end.block - - data_chunk_table[ current_chunk ].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[ current_chunk ].end.offset - - data_chunk_table[ current_chunk ].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - } /* end else */ - } /* end while */ - - /** Get the data off of disk **/ - relative_block.block = data_chunk_table[ current_chunk ].start.block ; - relative_block.offset = data_chunk_table[ current_chunk ].start.offset + - (TAG_SIZE + DISK_POINTER_SIZE) + - (relative_offset - past_chunk_sizes) ; - if ( relative_block.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &relative_block, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } - - if( formats_compare ) { - /** Read the data off of disk directly **/ - ADFI_read_file( file_index, relative_block.block, relative_block.offset, - file_bytes, (char *)data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { /** Read and translate data **/ - ADFI_read_data_translated( file_index, relative_block.block, - relative_block.offset, tokenized_data_type, file_bytes, - file_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Increment disk pointers **/ - if( (unsigned)i < total_disk_elements - 1 ) { - if ( node.number_of_dimensions == 1 ) { - disk_offset = s_stride[0]; - current_disk[0] += disk_offset; - if ( current_disk[0] > s_end[0] ) current_disk[0] = s_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - node.number_of_dimensions, node.dimension_values, - s_start, s_end, s_stride, current_disk, &disk_offset, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - relative_offset += disk_offset * file_bytes ; - } /* end if */ - } /* end else if */ - - if( (unsigned)i < total_disk_elements - 1 ) { - /** Increment memory pointers **/ - if ( m_num_dims == 1 ) { - memory_offset = m_stride[0]; - current_memory[0] += disk_offset; - if ( current_memory[0] > m_end[0] ) current_memory[0] = m_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - (unsigned int)m_num_dims, (unsigned int* )m_dims, - m_start, m_end, m_stride, - current_memory, &memory_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Adjust data pointer **/ - data += memory_offset * memory_bytes ; - } /* end if */ - } /* end for */ - -if( node.number_of_data_chunks > 1 ) /** Multiple data chunks **/ - free( data_chunk_table ) ; - -} /* end of ADF_Read_Data */ -/* end of file ADF_Read_Data.c */ -/* file ADF_Set_Error_State.c */ -/*********************************************************************** -ADF Set Error State: - -Set Error State. For all ADF calls, set the error handling convention; -either return error codes, or abort the program on an error. The -default state for the ADF interface is to return error codes and NOT abort. - -ADF_Set_Error_State( error_state, error_return ) -input: const int error_state Flag for ABORT on error (1) or return error - status (0). -output: int *error_return Error return. -***********************************************************************/ -void ADF_Set_Error_State( - const int error_state, - int *error_return ) -{ -*error_return = NO_ERROR ; -if( error_state == 0 ) - ADF_abort_on_error = FALSE ; -else if( error_state == 1 ) - ADF_abort_on_error = TRUE ; -else { - *error_return = BAD_ERROR_STATE ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - -} /* end of ADF_Set_Error_State */ -/* end of file ADF_Set_Error_State.c */ -/* file ADF_Set_Label.c */ -/*********************************************************************** -ADF Set Label: - -Set Label. Set the 32 character string in a node's label field. - -ADF_Set_Label( ID, label, error_return ) -input: const double ID The ID of the node to use. -input: const char *label The 32-character label of the node. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Set_Label( - const double ID, - const char *label, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset ; -struct NODE_HEADER node ; -int i, label_length ; -double LID ; - - /** Don't check for NULL or BLANK label, these are OK **/ -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Copy the label **/ -if( label == NULL ) - label_length = 0 ; /* copy none, then blank fill */ -else - label_length = strlen( label ) ; -if( label_length > ADF_LABEL_LENGTH ) { - *error_return = STRING_LENGTH_TOO_BIG ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -for( i=0; i chunk_total_bytes ) { - /** Write the part of the new data to existing data-chunk **/ - ADFI_write_data_chunk( file_index, &node.data_chunks, - tokenized_data_type, file_bytes, chunk_total_bytes, 0, - chunk_total_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Allocate a second data chunk **/ - total_bytes -= chunk_total_bytes ; - ADFI_file_malloc( file_index, - total_bytes + TAG_SIZE + TAG_SIZE + DISK_POINTER_SIZE, - &new_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write the rest of the data **/ -/** note: memory_bytes and file_bytes might be different (e.g., if machine - is "IEEE_BIG" and file is "CRAY") in which case data pointer advances - at a different rate from file pointer. **/ - data += (chunk_total_bytes * memory_bytes ) / file_bytes ; - - ADFI_write_data_chunk( file_index, &new_block_offset, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Allocate a data-chunk-table for two entries **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + 5 * DISK_POINTER_SIZE, - &dct_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write data-chunk-table to disk **/ - data_chunk_entry_table[0].start.block = node.data_chunks.block ; - data_chunk_entry_table[0].start.offset = node.data_chunks.offset ; - chunk_start.block = node.data_chunks.block ; - chunk_start.offset = node.data_chunks.offset + TAG_SIZE ; - ADFI_adjust_disk_pointer( &chunk_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - /** get the size of the data_chunk for the table end pointer **/ - ADFI_read_disk_pointer_from_disk( file_index, - chunk_start.block, chunk_start.offset, - &data_chunk_entry_table[0].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - data_chunk_entry_table[1].start.block = new_block_offset.block ; - data_chunk_entry_table[1].start.offset = new_block_offset.offset ; - chunk_start.block = new_block_offset.block ; - chunk_start.offset = new_block_offset.offset + TAG_SIZE ; - ADFI_adjust_disk_pointer( &chunk_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - /** get the size of the data_chunk for the table end pointer **/ - ADFI_read_disk_pointer_from_disk( file_index, - chunk_start.block, chunk_start.offset, - &data_chunk_entry_table[1].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - ADFI_write_data_chunk_table( file_index, &dct_block_offset, - 2, data_chunk_entry_table, error_return ) ; - - /** Update node header with number of data-chunks = 2 and the - pointer to the data-chunk-table **/ - node.data_chunks.block = dct_block_offset.block ; - node.data_chunks.offset = dct_block_offset.offset ; - node.number_of_data_chunks = 2 ; - ADFI_write_node_header( file_index, &block_offset, &node, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { - /** Write the new data to existing data-chunk **/ - ADFI_write_data_chunk( file_index, &node.data_chunks, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - } /* end else if */ -else { /** Multiple data chunks **/ - /** Allocate memory for the data-chunk-table, with an additional - entry in case we need to grow it - **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( (node.number_of_data_chunks + 1 ) * - sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Read in the table **/ - ADFI_read_data_chunk_table( file_index, &node.data_chunks, - data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** looping on the data-chunks, write the size of the current chunk **/ - for( i=0; i<(int)node.number_of_data_chunks; i++ ) { - current_bytes = (data_chunk_table[i].end.block - - data_chunk_table[i].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[i].end.offset - - data_chunk_table[i].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - /** Limit the number of bytes written by whats left to write. **/ - current_bytes = MIN( current_bytes, total_bytes ) ; - ADFI_write_data_chunk( file_index, &data_chunk_table[i].start, - tokenized_data_type, file_bytes, current_bytes, 0, - current_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - -/** note: memory_bytes and file_bytes might be different (e.g., if machine - is "IEEE_BIG" and file is "CRAY") in which case data pointer advances - at a different rate from file pointer. **/ - data += (current_bytes * memory_bytes ) / file_bytes ; - - total_bytes -= current_bytes ; - if( total_bytes <= 0 ) - break ; - } /* end for */ - - /** If we are out of data-chunks and have data left, allocate a - new data-chunk in the file. **/ - - if( total_bytes > 0 ) { - /** Write data-chunk-table to disk **/ - - /** allocate data space in the file **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + DISK_POINTER_SIZE + - total_bytes, - &data_chunk_table[ node.number_of_data_chunks ].start, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - data_chunk_table[ node.number_of_data_chunks ].end.block = - data_chunk_table[ node.number_of_data_chunks ].start.block ; - data_chunk_table[ node.number_of_data_chunks ].end.offset = - data_chunk_table[ node.number_of_data_chunks ].start.offset + - TAG_SIZE + DISK_POINTER_SIZE + total_bytes ; - ADFI_adjust_disk_pointer( - &data_chunk_table[ node.number_of_data_chunks ].end, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** allocate space for the new data-chunk-entry-table **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + - (2 * (node.number_of_data_chunks + 1) + 1) * DISK_POINTER_SIZE, - &dct_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - ADFI_write_data_chunk_table( file_index, &dct_block_offset, - node.number_of_data_chunks+1, data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - ADFI_write_data_chunk( file_index, - &data_chunk_table[node.number_of_data_chunks ].start, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Free the old data-chunk-table **/ - ADFI_file_free( file_index, &node.data_chunks, 0, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Update node header with number of data-chunks++ and the - pointer to the data-chunk-table **/ - node.number_of_data_chunks++ ; - node.data_chunks.block = dct_block_offset.block ; - node.data_chunks.offset = dct_block_offset.offset ; - ADFI_write_node_header( file_index, &block_offset, &node, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - free( data_chunk_table ) ; - } /* end else */ - - /** Finally, update modification date **/ -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Write_All_Data */ -/* end of file ADF_Write_All_Data.c */ -/* end of file ADF_Write_All_Data.c */ -/* file ADF_Write_Block_Data.c */ -/*********************************************************************** -ADF Write Block Data: - -Write all data to a Node. Writes all the node's data from a contiguous -memory space. - -ADF_Write_All_Data( ID, data, error_return ) -input: const double ID The ID of the node to use. -input: const long b_start The starting point in block in token space -input: const long b_end The ending point in block in token space -input: const char *data The start of the data in memory. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Write_Block_Data( - const double ID, - const long b_start, - const long b_end, - char *data, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset, new_block_offset, dct_block_offset ; -struct NODE_HEADER node ; -struct TOKENIZED_DATA_TYPE - tokenized_data_type[ 1 + (ADF_DATA_TYPE_LENGTH + 1)/3 ] ; -struct DATA_CHUNK_TABLE_ENTRY data_chunk_entry_table[2], *data_chunk_table ; - -char file_format, machine_format ; -int file_bytes, memory_bytes ; -long total_bytes, bytes_written, bytes_to_write ; -int i, j ; -char tag[TAG_SIZE+1] ; -struct DISK_POINTER data_start, chunk_start, end_of_chunk_tag ; -long start_offset ; -long chunk_size, chunk_end_byte ; -long start_byte, end_byte, block_bytes ; -double LID ; - -if( data == NULL ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get the datatype length **/ -ADFI_evaluate_datatype( file_index, node.data_type, &file_bytes, &memory_bytes, - tokenized_data_type, &file_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Calculate the total number of data bytes **/ -total_bytes = file_bytes ; -for( j=0; j<(int)node.number_of_dimensions; j++ ) - total_bytes *= node.dimension_values[j] ; -if( total_bytes == 0 ) { - *error_return = ZERO_DIMENSIONS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Calculate the starting and ending range in the file **/ -start_byte = file_bytes * (b_start-1) ; -end_byte = file_bytes * b_end ; -if ( start_byte < 0 || start_byte > end_byte || end_byte > total_bytes ) { - *error_return = START_OUT_OF_DEFINED_RANGE ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -block_bytes = end_byte - start_byte ; - - /** If there currently is NO data, allocate disk space for it **/ -if( node.number_of_data_chunks == 0 ) { - ADFI_file_malloc( file_index, - total_bytes + TAG_SIZE + TAG_SIZE + DISK_POINTER_SIZE, - &node.data_chunks, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write the new data **/ - ADFI_write_data_chunk( file_index, &node.data_chunks, tokenized_data_type, - file_bytes, total_bytes, start_byte, block_bytes, data, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Record the modified the node-header **/ - node.number_of_data_chunks = 1 ; - ADFI_write_node_header( file_index, &block_offset, &node, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ -else if( node.number_of_data_chunks == 1 ) { - /** Get the data length **/ - ADFI_read_chunk_length( file_index, &node.data_chunks, tag, - &end_of_chunk_tag, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - tag[TAG_SIZE] = '\0' ; - - /** Check start-of-chunk tag **/ - if( ADFI_stridx_c( tag, data_chunk_start_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Point to the start of the data **/ - data_start.block = node.data_chunks.block ; - data_start.offset = node.data_chunks.offset + TAG_SIZE + DISK_POINTER_SIZE ; - ADFI_adjust_disk_pointer( &data_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** See if the new data exceedes the existing data space **/ - chunk_size = end_of_chunk_tag.offset - data_start.offset + - (end_of_chunk_tag.block - data_start.block) * DISK_BLOCK_SIZE ; - - - /** If Data grew: Write old size, then allocate more - data-space and write the rest **/ - if( total_bytes > chunk_size ) { - /** Write the part of the new data to existing data-chunk **/ - bytes_written = 0 ; - if ( start_byte <= chunk_size ) { - bytes_to_write = MIN ( block_bytes, (chunk_size-start_byte) ) ; - ADFI_write_data_chunk( file_index, &node.data_chunks, - tokenized_data_type, file_bytes, chunk_size, start_byte, - bytes_to_write, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - bytes_written += bytes_to_write ; - } /* end if */ - - /** Allocate a second data chunk **/ - total_bytes -= chunk_size ; - ADFI_file_malloc( file_index, - total_bytes + TAG_SIZE + TAG_SIZE + DISK_POINTER_SIZE, - &new_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write the rest of the data **/ -/** note: memory_bytes and file_bytes might be different (e.g., if machine - is "IEEE_BIG" and file is "CRAY") in which case data pointer advances - at a different rate from file pointer. **/ - data += (bytes_to_write * memory_bytes ) / file_bytes ; - - if ( bytes_written < block_bytes ) { - bytes_to_write = block_bytes - bytes_written ; - start_offset = MAX ( 0L, (start_byte - chunk_size) ) ; - ADFI_write_data_chunk( file_index, &new_block_offset, - tokenized_data_type, file_bytes, total_bytes, start_offset, - bytes_to_write, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { - ADFI_write_data_chunk( file_index, &new_block_offset, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, NULL, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Allocate a data-chunk-table for two entries **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + 5 * DISK_POINTER_SIZE, - &dct_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write data-chunk-table to disk **/ - data_chunk_entry_table[0].start.block = node.data_chunks.block ; - data_chunk_entry_table[0].start.offset = node.data_chunks.offset ; - /** get the size of the data_chunk for the table end pointer **/ - chunk_start.block = node.data_chunks.block ; - chunk_start.offset = node.data_chunks.offset + TAG_SIZE ; - ADFI_adjust_disk_pointer( &chunk_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - ADFI_read_disk_pointer_from_disk( file_index, - chunk_start.block, chunk_start.offset, - &data_chunk_entry_table[0].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - data_chunk_entry_table[1].start.block = new_block_offset.block ; - data_chunk_entry_table[1].start.offset = new_block_offset.offset ; - chunk_start.block = new_block_offset.block ; - chunk_start.offset = new_block_offset.offset + TAG_SIZE ; - ADFI_adjust_disk_pointer( &chunk_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - /** get the size of the data_chunk for the table end pointer **/ - ADFI_read_disk_pointer_from_disk( file_index, - chunk_start.block, chunk_start.offset, - &data_chunk_entry_table[1].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - ADFI_write_data_chunk_table( file_index, &dct_block_offset, - 2, data_chunk_entry_table, error_return ) ; - - /** Update node header with number of data-chunks = 2 and the - pointer to the data-chunk-table **/ - node.data_chunks.block = dct_block_offset.block ; - node.data_chunks.offset = dct_block_offset.offset ; - node.number_of_data_chunks = 2 ; - ADFI_write_node_header( file_index, &block_offset, &node, error_return ); - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { - /** Write the new data to existing data-chunk **/ - ADFI_write_data_chunk( file_index, &node.data_chunks, - tokenized_data_type, file_bytes, chunk_size, start_byte, - block_bytes, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - } /* end else if */ -else { /** Multiple data chunks **/ - /** Allocate memory for the data-chunk-table, with an additional - entry in case we need to grow it - **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( (node.number_of_data_chunks + 1 ) * - sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Read in the table **/ - ADFI_read_data_chunk_table( file_index, &node.data_chunks, - data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** looping on the data-chunks, write the size of the current chunk **/ - chunk_end_byte = 0 ; - bytes_written = 0 ; - for( i=0; i<(int)node.number_of_data_chunks; i++ ) { - chunk_size = (data_chunk_table[i].end.block - - data_chunk_table[i].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[i].end.offset - - data_chunk_table[i].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - chunk_end_byte += chunk_size ; - - /** If start of block not in this chunk then continue **/ - if ( start_byte > chunk_end_byte ) - continue ; - - /** Set offset into the current chunk **/ - if ( start_byte > (chunk_end_byte - chunk_size) ) - /** The start of the block is inside the current chunk so - adjust the offset to the beginning of the block **/ - start_offset = ( start_byte - (chunk_end_byte-chunk_size) ) ; - else - start_offset = 0 ; - - /** Check to be sure we aren't writing too much data **/ - bytes_to_write = chunk_size - start_offset ; - if( bytes_written + bytes_to_write > block_bytes ) { - bytes_to_write = block_bytes - bytes_written ; - } /* end if */ - if( bytes_to_write == 0 || (chunk_end_byte-chunk_size) > end_byte ) - continue ; - - /** Write the chunk **/ - ADFI_write_data_chunk( file_index, &data_chunk_table[i].start, - tokenized_data_type, file_bytes, chunk_size, start_offset, - bytes_to_write, data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - -/** note: memory_bytes and file_bytes might be different (e.g., if machine - is "IEEE_BIG" and file is "CRAY") in which case data pointer advances - at a different rate from file pointer. **/ - data += (bytes_to_write * memory_bytes ) / file_bytes ; - - bytes_written += bytes_to_write ; - } /* end for */ - - /** If we are out of data-chunks and have data left, allocate a - new data-chunk in the file. **/ - total_bytes -= chunk_end_byte ; - if( total_bytes > 0 ) { - /** Write data-chunk-table to disk **/ - - /** allocate data space in the file **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + DISK_POINTER_SIZE + - total_bytes, - &data_chunk_table[ node.number_of_data_chunks ].start, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - data_chunk_table[ node.number_of_data_chunks ].end.block = - data_chunk_table[ node.number_of_data_chunks ].start.block ; - data_chunk_table[ node.number_of_data_chunks ].end.offset = - data_chunk_table[ node.number_of_data_chunks ].start.offset + - TAG_SIZE + DISK_POINTER_SIZE + total_bytes ; - ADFI_adjust_disk_pointer( - &data_chunk_table[ node.number_of_data_chunks ].end, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** allocate space for the new data-chunk-entry-table **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + - (2 * (node.number_of_data_chunks + 1) + 1) * DISK_POINTER_SIZE, - &dct_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - ADFI_write_data_chunk_table( file_index, &dct_block_offset, - node.number_of_data_chunks+1, data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - if ( bytes_written < block_bytes ) { - bytes_to_write = block_bytes - bytes_written ; - start_offset = MAX ( 0L, (start_byte - total_bytes) ) ; - ADFI_write_data_chunk( file_index, - &data_chunk_table[node.number_of_data_chunks ].start, - tokenized_data_type, file_bytes, - total_bytes, start_offset, bytes_to_write, - data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { - ADFI_write_data_chunk( file_index, - &data_chunk_table[node.number_of_data_chunks ].start, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, NULL, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Free the old data-chunk-table **/ - ADFI_file_free( file_index, &node.data_chunks, 0, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Update node header with number of data-chunks++ and the - pointer to the data-chunk-table **/ - node.number_of_data_chunks++ ; - node.data_chunks.block = dct_block_offset.block ; - node.data_chunks.offset = dct_block_offset.offset ; - ADFI_write_node_header( file_index, &block_offset, &node, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - free( data_chunk_table ) ; - } /* end else */ - - /** Finally, update modification date **/ -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Write_Block_Data */ -/* end of file ADF_Write_Block_Data.c */ -/* file ADF_Write_Data.c */ -/*********************************************************************** -ADF Write Data: - -Write data to a Node, with partial capabilities. See ADF_Read_Data for -description. - -ADF_Write_Data( ID, s_start[], s_end[], s_stride[], m_num_dims, - m_dims[], m_start[], m_end[], m_stride[], data, error_return ) -input: const double ID The ID of the node to use. -input: const int s_start[] The starting dimension values to use in - the database (node). -input: const int s_end[] The ending dimension values to use in - the database (node). -input: const int s_stride[] The stride values to use in the database (node). -input: const int m_num_dims The number of dimensions to use in memory. -input: const int m_dims[] The dimensionality to use in memory. -input: const int m_start[] The starting dimension values to use in memory. -input: const int m_end[] The ending dimension values to use in memory. -input: const int m_stride[] The stride values to use in memory. -input: const char *data The start of the data in memory. -output: int *error_return Error return. -***********************************************************************/ -void ADF_Write_Data( - const double ID, - const int s_start[], - const int s_end[], - const int s_stride[], - const int m_num_dims, - const int m_dims[], - const int m_start[], - const int m_end[], - const int m_stride[], - const char *data, - int *error_return ) -{ -unsigned int file_index ; -struct DISK_POINTER block_offset, dct_block_offset, relative_block ; -struct DISK_POINTER data_start, new_block_offset ; -struct DISK_POINTER chunk_start, end_of_chunk_tag ; -struct NODE_HEADER node ; -struct DATA_CHUNK_TABLE_ENTRY *data_chunk_table ; -struct TOKENIZED_DATA_TYPE - tokenized_data_type[ 1 + (ADF_DATA_TYPE_LENGTH + 1)/3 ] ; -int current_disk[ADF_MAX_DIMENSIONS] ; -int current_memory[ADF_MAX_DIMENSIONS] ; -unsigned long total_disk_elements, total_memory_elements ; -unsigned long disk_offset, memory_offset ; -int formats_compare ; -char disk_format, machine_format ; -int i ; -int file_bytes = 0 ; -int memory_bytes = 0 ; -char tag[TAG_SIZE+1] ; -unsigned long total_bytes ; -long current_bytes, chunk_total_bytes ; -double LID ; -unsigned long relative_offset, current_chunk, current_chunk_size, - past_chunk_sizes ; - -if( (s_start == NULL) || (s_end == NULL) || (s_stride == NULL) || - (m_dims == NULL) || (m_start == NULL) || (m_end == NULL) || - (m_stride == NULL) || (data == NULL) ) { - *error_return = NULL_POINTER ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -*error_return = NO_ERROR ; -data_chunk_table = 0L ; - -ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** Get datatype length **/ -ADFI_evaluate_datatype( file_index, node.data_type, &file_bytes, &memory_bytes, - tokenized_data_type, &disk_format, &machine_format, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( (file_bytes == 0) || (node.number_of_dimensions == 0) ) { - *error_return = NO_DATA ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - -ADFI_count_total_array_points( node.number_of_dimensions, - node.dimension_values, - s_start, s_end, s_stride, - &total_disk_elements, &disk_offset, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -ADFI_count_total_array_points( (unsigned int)m_num_dims, - (unsigned int *)m_dims, - m_start, m_end, m_stride, - &total_memory_elements, &memory_offset, - error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -if( total_disk_elements != total_memory_elements ) { - *error_return = UNEQUAL_MEMORY_AND_DISK_DIMS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Calculate the total number of data bytes **/ -total_bytes = file_bytes ; -for( i=0; i<(int)node.number_of_dimensions; i++ ) - total_bytes *= node.dimension_values[i] ; -if( total_bytes == 0 ) { - *error_return = ZERO_DIMENSIONS ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** check for need of data translation **/ -ADFI_file_and_machine_compare( file_index, tokenized_data_type, - &formats_compare, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - - /** If there currently is NO data, allocate disk space for it **/ -if( node.number_of_data_chunks == 0 ) { - ADFI_file_malloc( file_index, - total_bytes + TAG_SIZE + TAG_SIZE + DISK_POINTER_SIZE, - &node.data_chunks, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** initialize the new disk_space with zero's, then we'll - write the partial data **/ - ADFI_write_data_chunk( file_index, &node.data_chunks, tokenized_data_type, - file_bytes, total_bytes, 0, total_bytes, 0L, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Record the modified the node-header **/ - node.number_of_data_chunks = 1 ; - ADFI_write_node_header( file_index, &block_offset, &node, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - /** If one data chunk, check to see if we need to add a second **/ -else if( node.number_of_data_chunks == 1 ) { - /** Get the data length **/ - ADFI_read_chunk_length( file_index, &node.data_chunks, tag, - &end_of_chunk_tag, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - tag[TAG_SIZE] = '\0' ; - - /** Check start-of-chunk tag **/ - if( ADFI_stridx_c( tag, data_chunk_start_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Point to the start of the data **/ - data_start.block = node.data_chunks.block ; - data_start.offset = node.data_chunks.offset + TAG_SIZE + DISK_POINTER_SIZE ; - ADFI_adjust_disk_pointer( &data_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** See if the new data exceedes the existing data space **/ - chunk_total_bytes = end_of_chunk_tag.offset - data_start.offset + - (end_of_chunk_tag.block - data_start.block) * DISK_BLOCK_SIZE ; - - /** If Data grew: Allocate more data-space and initialize to zero**/ - if( (long int) total_bytes > chunk_total_bytes ) { - /** Allocate memory for the data-chunk-table, with an additional - entry in case we need to grow it **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( (node.number_of_data_chunks + 1 ) * - sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Allocate a second data chunk **/ - total_bytes -= chunk_total_bytes ; - ADFI_file_malloc( file_index, - total_bytes + TAG_SIZE + TAG_SIZE + DISK_POINTER_SIZE, - &new_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Initialize the new data with zeros **/ - ADFI_write_data_chunk( file_index, &new_block_offset, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, 0L, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Allocate a data-chunk-table for two entries **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + 5 * DISK_POINTER_SIZE, - &dct_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Write data-chunk-table to disk **/ - data_chunk_table[0].start.block = node.data_chunks.block ; - data_chunk_table[0].start.offset = node.data_chunks.offset ; - chunk_start.block = node.data_chunks.block ; - chunk_start.offset = node.data_chunks.offset + TAG_SIZE ; - ADFI_adjust_disk_pointer( &chunk_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - /** get the size of the data_chunk for the table end pointer **/ - ADFI_read_disk_pointer_from_disk( file_index, - chunk_start.block, chunk_start.offset, - &data_chunk_table[0].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - data_chunk_table[1].start.block = new_block_offset.block ; - data_chunk_table[1].start.offset = new_block_offset.offset ; - chunk_start.block = new_block_offset.block ; - chunk_start.offset = new_block_offset.offset + TAG_SIZE ; - ADFI_adjust_disk_pointer( &chunk_start, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - /** get the size of the data_chunk for the table end pointer **/ - ADFI_read_disk_pointer_from_disk( file_index, - chunk_start.block, chunk_start.offset, - &data_chunk_table[1].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - ADFI_write_data_chunk_table( file_index, &dct_block_offset, - 2, data_chunk_table, error_return ) ; - - /** Update node header with number of data-chunks = 2 and the - pointer to the data-chunk-table **/ - node.data_chunks.block = dct_block_offset.block ; - node.data_chunks.offset = dct_block_offset.offset ; - node.number_of_data_chunks = 2 ; - ADFI_write_node_header( file_index, &block_offset, &node, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - } /* end else if */ -else { /** Multiple data chunks, check to see if we need to add one mode **/ - /** Allocate memory for the data-chunk-table, with an additional - entry in case we need to grow it **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( (node.number_of_data_chunks + 1 ) * - sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Read in the table **/ - ADFI_read_data_chunk_table( file_index, &node.data_chunks, - data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** looping on the data-chunks, look at the size of the chunks **/ - for( i=0; i<(int)node.number_of_data_chunks; i++ ) { - current_bytes = (data_chunk_table[i].end.block - - data_chunk_table[i].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[i].end.offset - - data_chunk_table[i].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - total_bytes -= current_bytes ; - if( total_bytes <= 0 ) - break ; - } /* end for */ - - /** If we are out of data-chunks and have data left, allocate a - new data-chunk in the file. **/ - if( total_bytes > 0 ) { - /** Write data-chunk-table to disk **/ - - /** allocate data space in the file **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + DISK_POINTER_SIZE + - total_bytes, &data_chunk_table[ node.number_of_data_chunks ].start, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - data_chunk_table[ node.number_of_data_chunks ].end.block = - data_chunk_table[ node.number_of_data_chunks ].start.block ; - data_chunk_table[ node.number_of_data_chunks ].end.offset = - data_chunk_table[ node.number_of_data_chunks ].start.offset + - TAG_SIZE + DISK_POINTER_SIZE + total_bytes ; - ADFI_adjust_disk_pointer( - &data_chunk_table[ node.number_of_data_chunks ].end, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** allocate space for the new data-chunk-entry-table **/ - ADFI_file_malloc( file_index, 2 * TAG_SIZE + - (2 * (node.number_of_data_chunks + 1) + 1) * DISK_POINTER_SIZE, - &dct_block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - ADFI_write_data_chunk_table( file_index, &dct_block_offset, - node.number_of_data_chunks+1, data_chunk_table, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Initialize the new data chunk to zeros **/ - ADFI_write_data_chunk( file_index, - &data_chunk_table[node.number_of_data_chunks ].start, - tokenized_data_type, file_bytes, total_bytes, 0, - total_bytes, 0L, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - /** Free the old data-chunk-table **/ - ADFI_file_free( file_index, &node.data_chunks, 0, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Update node header with number of data-chunks++ and the - pointer to the data-chunk-table **/ - node.number_of_data_chunks++ ; - node.data_chunks.block = dct_block_offset.block ; - node.data_chunks.offset = dct_block_offset.offset ; - ADFI_write_node_header( file_index, &block_offset, &node, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - } /* end else */ - - /** Do single data-chunks here... **/ -if( node.number_of_data_chunks == 1 ) { - /** Point to the start of the data **/ - block_offset.block = node.data_chunks.block ; - block_offset.offset = node.data_chunks.offset + TAG_SIZE + - DISK_POINTER_SIZE + disk_offset * file_bytes ; - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - - /** Setup initial indexing **/ - for( i=0; i<(int)node.number_of_dimensions; i++ ) - current_disk[i] = s_start[i] ; - for( i=0; i DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } - - /** Here is where we need to check for spanning multiple data-chunks **/ - - /** Put the data out to disk **/ - if( formats_compare ) { /* directly */ - ADFI_write_file( file_index, block_offset.block, block_offset.offset, - file_bytes, (char *)data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { /* translated */ - ADFI_write_data_translated( file_index, block_offset.block, - block_offset.offset, tokenized_data_type, file_bytes, - file_bytes, (char *)data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Increment disk/memory pointers, for the special case of one dimensional - data we will a simple increment to maximize the throught. Thus for - block writes you can temporarily change to 1D for the read to - improve efficiency. Note total size shouldn't change!! **/ - if( (unsigned)i < total_disk_elements - 1 ) { - if ( node.number_of_dimensions == 1 ) { - disk_offset = s_stride[0]; - current_disk[0] += disk_offset; - if ( current_disk[0] > s_end[0] ) current_disk[0] = s_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - node.number_of_dimensions, node.dimension_values, - s_start, s_end, s_stride, current_disk, &disk_offset, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - if ( m_num_dims == 1 ) { - memory_offset = m_stride[0]; - current_memory[0] += disk_offset; - if ( current_memory[0] > m_end[0] ) current_memory[0] = m_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - (unsigned int)m_num_dims, (unsigned int* )m_dims, - m_start, m_end, m_stride, - current_memory, &memory_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - block_offset.offset += disk_offset * file_bytes ; - if ( block_offset.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &block_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Adjust data pointer **/ - data += memory_offset * memory_bytes ; - } /* end if */ - } /* end for */ - } /* end if */ -else { - /** Point to the start of the data **/ - current_chunk = 0 ; - past_chunk_sizes = 0 ; - relative_offset = disk_offset * file_bytes ; - current_chunk_size = (data_chunk_table[ current_chunk ].end.block - - data_chunk_table[ current_chunk ].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[ current_chunk ].end.offset - - data_chunk_table[ current_chunk ].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - - /** Setup initial indexing **/ - for( i=0; i<(int)node.number_of_dimensions; i++ ) - current_disk[i] = s_start[i] ; - for( i=0; i= past_chunk_sizes + current_chunk_size ) { - if( ++current_chunk >= node.number_of_data_chunks ) { - *error_return = INCOMPLETE_DATA ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { - past_chunk_sizes += current_chunk_size ; - current_chunk_size = (data_chunk_table[ current_chunk ].end.block - - data_chunk_table[ current_chunk ].start.block) * DISK_BLOCK_SIZE + - (data_chunk_table[ current_chunk ].end.offset - - data_chunk_table[ current_chunk ].start.offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - } /* end else */ - } /* end while */ - - /** Put the data to disk **/ - relative_block.block = data_chunk_table[ current_chunk ].start.block ; - relative_block.offset = data_chunk_table[ current_chunk ].start.offset + - (TAG_SIZE + DISK_POINTER_SIZE) + - (relative_offset - past_chunk_sizes) ; - if ( relative_block.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &relative_block, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Put the data out to disk **/ - if( formats_compare ) { /* directly */ - ADFI_write_file( file_index, - relative_block.block, relative_block.offset, - file_bytes, (char *)data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - else { /* translated */ - ADFI_write_data_translated( file_index, relative_block.block, - relative_block.offset, tokenized_data_type, file_bytes, - file_bytes, (char *)data, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end if */ - - /** Increment disk and memory pointers **/ - if( (unsigned)i < total_disk_elements - 1 ) { - if ( node.number_of_dimensions == 1 ) { - disk_offset = s_stride[0]; - current_disk[0] += disk_offset; - if ( current_disk[0] > s_end[0] ) current_disk[0] = s_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - node.number_of_dimensions, node.dimension_values, - s_start, s_end, s_stride, current_disk, &disk_offset, - error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - relative_offset += disk_offset * file_bytes ; - - if ( m_num_dims == 1 ) { - memory_offset = m_stride[0]; - current_memory[0] += disk_offset; - if ( current_memory[0] > m_end[0] ) current_memory[0] = m_end[0] ; - } /* end if */ - else { - ADFI_increment_array( - (unsigned int)m_num_dims, (unsigned int* )m_dims, - m_start, m_end, m_stride, - current_memory, &memory_offset, error_return ) ; - CHECK_ADF_ABORT( *error_return ) ; - } /* end else */ - - /** Adjust data pointer **/ - data += memory_offset * memory_bytes ; - } /* end if */ - } /* end for */ - } /* end else */ - -if( data_chunk_table != 0L ) - free( data_chunk_table ) ; - - /** Finally, update modification date **/ -ADFI_write_modification_date( file_index, error_return ) ; -CHECK_ADF_ABORT( *error_return ) ; - -} /* end of ADF_Write_Data */ -/* end of file ADF_Write_Data.c */ -/* end of combine 2.0 */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_internals.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_internals.c deleted file mode 100644 index 8ed21498d0..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_internals.c +++ /dev/null @@ -1,8995 +0,0 @@ -#include - -/** The ADF format requires a lot of seeking during the creation or deletion - of nodes. The Linux 2.4 NFS client is very very slow with fseek/fwrite - pairs. Under this regime, node creation can take up to 3 times longer - than writing the data! Caching the fwrites allows fewer fseek/fwrite - commands to be given and speeds up performance under Linux 2.4 by an - order of magnitude */ -#ifndef CACHEWRITES -#if defined(_WIN32) -/** Windows users are most likely going to be writing their file locally, - so turn cached writes off there. */ -#define CACHEWRITES 0 -#define kUsePathsForUniqueness 1 -#else -#define CACHEWRITES 1 -#define kUsePathsForUniqueness 0 /* This should always be zero for Unix */ -#endif /* _WIN32 */ -#endif - -#if defined(_WIN32) -#define ftello ftell -#define fseeko fseek -#if CACHEWRITES -#include -/** windows.h unfortunately uses NO_ERROR and NO_DATA, which are ADF errors. - Since changing the name of the ADF errors would break everything that - uses ADF, we cannot do that. But if we undefine them, and then redefine - them, to avoid compiler warnings, then GetLastError() will not work - (if compared against those two errors). Since the only reason windows.h - is included is for the Win32 path functions used in ADFI_open_file(), - and these do not require the use of GetLastError(), then the best - solution is to undefine them and write a big warning in the Win32 code. */ -#undef NO_ERROR -#undef NO_DATA -#endif /* CACHEDWRITES */ -#else -#if kUsePathsForUniqueness -#include -#include -#else -#include -#include -#include -#endif /* kUsePathsForUniqueness */ -#endif /* _WIN32 */ - -/* created by combine 2.0 */ -/* file ADFI_AAA_var.c */ -/*** -File: ADF_internals.c - ---------------------------------------------------------------------- - BOEING - ---------------------------------------------------------------------- - Project: CGNS - Author: Tom Dickens 234-1024 tpd6908@yak.ca.boeing.com - Date: 3/2/1995 - Purpose: Provide the underlying support for the ADF-Core. - ---------------------------------------------------------------------- - ---------------------------------------------------------------------- -Notes: Integer numbers are stored on disk as ASCII-hex numbers. - 2 bytes gives a number from 0 to 255, - 4 bytes 0 to 65,535, - 8 bytes 0 to 4,294,967,295, - and 12 bytes from 0 to 281,474,976,710,655. - -Pointers are 12 bytes. - 8 bytes pointing to a 4096-byte chunk on disk, - and 4 bytes is an offset into that chunk. -This gives a maximum file size of 17,592,186,048,512 bytes (17.5 Tera bytes). - - ---------------------------------------------------------------------- - The tables below detail the format of the information which - makes up the ADF file. - - There are 7 different, unique types of data "chunks" used. - Three of these are of fixed length, and the other four are - variable in length. - - With the exception of numeric data (user's data), all information - in an ADF file is written in ASCII. - - Uniquely-defined boundary-tags are used to surround all "chunks" - of information. These tags are checked to confirm "chunk" type - and also to ensure data integrity. - ---------------------------------------------------------------------- - 186 Physical disk-First block -bytes start end description range / format - 32 0 31 "what" description "@(#)ADF Database Version AXXxxx>" - 4 32 35 "AdF0" boundary tag Tag - 28 36 63 Creation date/time "Wed Apr 19 09:33:25 1995 " - 4 64 67 "AdF1" boundary tag Tag - 28 68 95 Modification date/time "Wed Apr 19 09:33:29 1995 " - 4 96 99 "AdF2" boundary tag Tag - 1 100 100 Numeric format ['B', 'L', 'C', 'N'] - 1 101 101 Duplicate of numeric format ['B', 'L', 'C', 'N'] - 4 102 105 "AdF3" boundary tag Tag - 2 106 107 sizeof( char ) 0 to 255 - 2 108 109 sizeof( short ) 0 to 255 - 2 110 111 sizeof( int ) 0 to 255 - 2 112 113 sizeof( long ) 0 to 255 - 2 114 115 sizeof( float ) 0 to 255 - 2 116 117 sizeof( double ) 0 to 255 - 2 118 119 sizeof( char * ) 0 to 255 - 2 120 121 sizeof( short * ) 0 to 255 - 2 122 123 sizeof( int *) 0 to 255 - 2 124 125 sizeof( long * ) 0 to 255 - 2 126 127 sizeof( float *) 0 to 255 - 2 128 129 sizeof( double *) 0 to 255 - 4 130 133 "AdF4" boundary tag Tag - 12 134 145 Root-node header pointer Disk chunk, chunk offset. - 12 146 157 End-of-File pointer Disk chunk, chunk offset. - 12 158 169 Free-Chunk table pointer Disk chunk, chunk offset. - 12 170 181 Extra pointer Disk chunk, chunk offset. - 4 182 185 "AdF5" boundary tag Tag - - - 80 Free-Chunk table -bytes start end description range / format - 4 0 3 "fCbt" boundary tag Tag - 12 4 15 First small block pointer Disk chunk, chunk offset. - 12 16 27 Last small block pointer Disk chunk, chunk offset. - 12 28 39 First medium block pointer Disk chunk, chunk offset. - 12 40 51 Last medium block pointer Disk chunk, chunk offset. - 12 52 63 First large block pointer Disk chunk, chunk offset. - 12 64 75 Last large block pointer Disk chunk, chunk offset. - 4 76 79 "fcte" boundarg tag Tag - - - Variable: min 32 Free Chunk -bytes start end description range / format - 4 0 3 "FreE" boundary tag Tag - 12 4 15 Pointer to End-of-Chunk-Tag - 12 16 27 Pointer to Next-Chunk in list - 0 28 - more free space - 4 28 31 "EndC" boundarg tag Tag - -Note: There can occur other free space "gas" in the file which are smaller - than the 32-bytes needed to have tags and pointers. The convention - in these cases is to just fill the entire free space with the letter - z, lower-case. - - 246 Node header -bytes start end description range / format - 4 0 3 "NoDe" boundary tag Tag - 32 4 35 Name Text: Blank filled - 32 36 67 Label Text: Blank filled - 8 68 75 Number of sub-nodes 0 to 4,294,967,295 - 8 76 83 Entries for sub-nodes 0 to 4,294,967,295 - 12 84 95 Pointer to sub-node table Disk chunk, chunk offset. - 32 96 127 Data-type Text: Blank filled - 2 128 129 Number of dimensions 0 to 12 - 8 130 137 Dimension value 0 0 to 4,294,967,295 - 8 138 145 Dimension value 1 0 to 4,294,967,295 - 8 146 153 Dimension value 2 0 to 4,294,967,295 - 8 154 161 Dimension value 3 0 to 4,294,967,295 - 8 162 169 Dimension value 4 0 to 4,294,967,295 - 8 170 177 Dimension value 5 0 to 4,294,967,295 - 8 178 185 Dimension value 6 0 to 4,294,967,295 - 8 186 193 Dimension value 7 0 to 4,294,967,295 - 8 194 201 Dimension value 8 0 to 4,294,967,295 - 8 202 209 Dimension value 9 0 to 4,294,967,295 - 8 210 217 Dimension value 10 0 to 4,294,967,295 - 8 218 225 Dimension value 11 0 to 4,294,967,295 - 4 226 229 Number of data chunks 0 to 65,535 - 12 230 241 Pointer to data chunk (or table) Disk chunk, chunk offset. - 4 242 245 "TaiL" boundary tag Tag - - - Variable: min 64 Sub-node table -bytes start end description range / format - 4 0 3 "SNTb" boundary tag Tag - 12 4 15 Pointer to End-of-Table-Tag - 32 16 47 Child's name Text: Blank filled - 12 48 59 Pointer to child Disk chunk, chunk offset. - 32 - - Child's name Text: Blank filled - 12 - - Pointer to child Disk chunk, chunk offset. - 32 - - Child's name Text: Blank filled - 12 - - Pointer to child Disk chunk, chunk offset. - 32 - - Child's name Text: Blank filled - 12 - - Pointer to child Disk chunk, chunk offset. - 32 - - Child's name Text: Blank filled - 12 - - Pointer to child Disk chunk, chunk offset. - 32 - - Child's name Text: Blank filled - 12 - - Pointer to child Disk chunk, chunk offset. - 4 60 63 "snTE" boundary tag Tag - - - Variable: min 44 Data-chunk table -bytes start end description range / format - 4 0 3 "DCtb" boundary tag Tag - 12 4 15 Pointer to End-of-Table-Tag - 12 16 27 Pointer to data start Disk chunk, chunk offset. - 12 28 39 Pointer to data end Disk chunk, chunk offset. - 12 - - Pointer to data start Disk chunk, chunk offset. - 12 - - Pointer to data end Disk chunk, chunk offset. - 12 - - Pointer to data start Disk chunk, chunk offset. - 12 - - Pointer to data end Disk chunk, chunk offset. - 12 - - Pointer to data start Disk chunk, chunk offset. - 12 - - Pointer to data end Disk chunk, chunk offset. - 4 40 43 "dcTE" boundarg tag Tag - - - Variable: min 32 Data-chunks -(Minimum is 32 bytes, which cooresponds to the size required for a free-chunk) -bytes start end description range / format - 4 0 3 "DaTa" boundary tag Tag - 12 4 15 Pointer to End-of-Data-Tag - 16 16 27 The data - 4 28 31 "dEnD" boundarg tag Tag - -**/ -/*********************************************************************** - Includes -***********************************************************************/ -#ifndef MAKEDEPEND -#include -#include -#include -#include -#include -#include -#if defined(_WIN32) && !defined(__NUTC__) -#include -#include -#else -#include -#include -#endif -#endif - -#include "ADF.h" -#include "ADF_internals.h" - -/*********************************************************************** - Character string defining the data tags: -***********************************************************************/ -/* These were moved from ADF_internals.h since they are only used here - and leaving them here gives warning messages when the other .c files - are compiled. WRO 2005-Jan-11 */ -static char *file_header_tags[] = { - "AdF0", "AdF1", "AdF2", "AdF3", "AdF4", "AdF5" } ; -static char node_start_tag[] = "NoDe" ; -static char node_end_tag[] = "TaiL" ; -static char free_chunk_table_start_tag[] = "fCbt" ; -static char free_chunk_table_end_tag[] = "Fcte" ; - -static char free_chunk_start_tag[] = "FreE" ; -static char free_chunk_end_tag[] = "EndC" ; -static char sub_node_start_tag[] = "SNTb" ; -static char sub_node_end_tag[] = "snTE" ; -static char data_chunk_table_start_tag[] = "DCtb" ; -static char data_chunk_table_end_tag[] = "dcTE" ; -static char data_chunk_start_tag[] = "DaTa" ; -static char data_chunk_end_tag[] = "dEnD" ; - -/*********************************************************************** - Global variables: - file_in_use: Used to track the files currently in use. - 0 if file is NOT in use. - 1 if file IS in use. - first_file_in_system: If a file is opened which is a sub-tree - of a parent ADF structure, first_file_in_system is the index - of the top parent file. - ADF_FILE: The system-returned file descriptor of an opened file. - names_of_files: Names of opened files. - file_open_mode: The mode the file was opened in. - file_version_update: If library file version is greater than - file version, library file version (what-string) is temporarily - stored in this array to update to the file. The file only - needs its version updated once while open, so don't expect the - version to persist until file closing. Otherwise, the first - byte in the string is null ('\0'). -***********************************************************************/ -static unsigned char file_in_use[ MAXIMUM_FILES] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 - } ; - - /** We need to track the top file in a system so that when the - system is closed, all files associated with it can also be closed. - **/ -static int first_file_in_system[MAXIMUM_FILES] ; -static FILE *ADF_file[MAXIMUM_FILES] ; -static char names_of_files[MAXIMUM_FILES][ADF_FILENAME_LENGTH] ; -static char file_open_mode[MAXIMUM_FILES][10] ; -static char file_version_update[MAXIMUM_FILES][WHAT_STRING_SIZE+1]; - -#if CACHEWRITES - /** Stores the information required to determine if two FILE* pointers - are identical. This is required so that multiple instances of the - same file can be opened and have the disk caches remain correct. - **/ -struct FILE_INFO { - dev_t device; - ino_t inode; -}; - -static struct FILE_INFO ADF_file_info[ MAXIMUM_FILES ] ; - -#if kUsePathsForUniqueness -struct FILE_PATH_INFO { - char *path; - int count; -}; -static struct FILE_PATH_INFO ADF_file_paths[ MAXIMUM_FILES ] = { - {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, - {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, - {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, - {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, - {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, - {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, - {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, - {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, - {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, - {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, - {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, - {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, - {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, - {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, - {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, - {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} }; -#endif -#endif /* CACHEWRITES */ - - /** Track the format of this machine as well as the format - of eack of the files. This is used for reading and - writing numeric data associated with the nodes, which may - include numeric-format translations. - **/ -static char ADF_file_format[MAXIMUM_FILES] ; -static char ADF_file_os_size[MAXIMUM_FILES] ; -static char ADF_this_machine_format = UNDEFINED_FORMAT_CHAR ; -static char ADF_this_machine_os_size = UNDEFINED_FORMAT_CHAR ; - - /** we need a block of "zz"-bytes for dead-space **/ -static char block_of_ZZ[ SMALLEST_CHUNK_SIZE ] ; -static int block_of_ZZ_initialized = FALSE ; - /** we need a block of "xx"-bytes for free-blocks **/ -static char block_of_XX[ DISK_BLOCK_SIZE ] ; -static int block_of_XX_initialized = FALSE ; - /** we need a block of null-bytes for disk conditioning **/ -static char block_of_00[ DISK_BLOCK_SIZE ] ; -static int block_of_00_initialized = FALSE ; - - /** read/write conversion buffer **/ -#define CONVERSION_BUFF_SIZE 100000 -static unsigned char from_to_data[ CONVERSION_BUFF_SIZE ] ; - - /** read/write buffering variables **/ -static char rd_block_buffer[DISK_BLOCK_SIZE] ; -static long last_rd_block = -1 ; -static long last_rd_file = -1 ; -static long num_in_rd_block = -1 ; -static char wr_block_buffer[DISK_BLOCK_SIZE] ; -static long last_wr_block = -2 ; -static long last_wr_file = -2 ; -static int flush_wr_block = -2 ; -static double last_link_ID = 0.0; -static double last_link_LID = 0.0; -enum { FLUSH, FLUSH_CLOSE }; - - /** Assumed machine variable sizes for the currently supported - machines. For ordering of data see the Figure_Machine_Format - function. Note that when openning a new file not in the machine - format these are the sizes used!! **/ -enum { TO_FILE_FORMAT, FROM_FILE_FORMAT } ; -#define NUMBER_KNOWN_MACHINES 5 -static size_t machine_sizes[NUMBER_KNOWN_MACHINES][16] = { - /* IEEE BIG 32 */ { 1, 1, 1, 2, 2, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4 }, - /* IEEE SML 32 */ { 1, 1, 1, 2, 2, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4 }, - /* IEEE BIG 64 */ { 1, 1, 1, 2, 2, 4, 4, 8, 8, 4, 8, 8, 8, 8, 8, 8 }, - /* IEEE SML 64 */ { 1, 1, 1, 2, 2, 4, 4, 8, 8, 4, 8, 8, 8, 8, 8, 8 }, - /* CRAY 64 */ { 1, 1, 1, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 } } ; - -/* Hack so Windows 64 is treated the same as win32. Don't actually use this - macro for anything other than comparing machine types. I don't know why - the code compares pointer sizes; it never uses them... */ -#ifdef _WIN32 -#define POINTER_SIZE(_T) 4 -#else -#define POINTER_SIZE(_T) sizeof(_T*) -#endif - -/*********************************************************************** - pows: Powers of 16, from 16^0 to 16^7 - ASCII_Hex: Hex numbers from 0 to 15. -***********************************************************************/ -static const unsigned int pows[8] = { /** Powers of 16 **/ - 1, 16, 256, 4096, 65536, 1048576, 16777216, 268435456 } ; -static const char ASCII_Hex[16] = { - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' } ; - -/*********************************************************************** - Priority Stack Buffer is used to buffer some of the overhead of - reading small blocks of file control information like the node - header by saving the data into a memory buffer. The buffer has - a priority value associated with it and is used to determine - which entry to replace when the stack is full!! Each stack entry - could be as large as 274 bytes since the stack data could be for - a node where NODE_HEADER_SIZE = 246. -***********************************************************************/ -#define MAX_STACK 50 -static struct { - int file_index; - unsigned int file_block; - unsigned int block_offset; - int stack_type; - char *stack_data; - int priority_level; -} PRISTK[MAX_STACK] ; -static int STACK_INIT=-1; -/* Define stack types */ -enum { FILE_STK=1, NODE_STK, DISK_PTR_STK, FREE_CHUNK_STK, SUBNODE_STK }; -/* Define stack control modes */ -enum { INIT_STK, CLEAR_STK, CLEAR_STK_TYPE, DEL_STK_ENTRY, GET_STK, SET_STK }; -/*********************************************************************** - Defined macros -***********************************************************************/ -#define EVAL_2_BYTES( C0, C1 ) (((C0)<<8)+((C1))) -#define EVAL_4_BYTES( C0, C1, C2, C3 ) (((C0)<<24)+((C1)<<16)+((C2)<<8)+((C3))) -/* end of file ADFI_AAA_var.c */ - -/*********************************************************************** - Disk cache -***********************************************************************/ -#define DISK_CACHE_SIZE 50 -struct DISK_CACHE_NODE { - char data[DISK_BLOCK_SIZE]; - unsigned int index; - unsigned long block; - int dirty; - struct DISK_CACHE_NODE *next; -}; - -struct DISK_CACHE_NODE *disk_cache = NULL; -struct DISK_CACHE_NODE *disk_cache_end = NULL; - -int DC_flush(); - -/** This function should not be called, and is here so that - it can be called in the debugger **/ -void DC_print() -{ - int count = 0; - struct DISK_CACHE_NODE *node = disk_cache; - - while (node) { - printf(" index: %d, block: %ld, dirty: %d\n", node->index, node->block, node->dirty); - node = node->next; - count++; - } - printf("(Disk cache contains %d blocks)\n", count); -} - -/*********************************************************************** -DC add block - Add a file block to the disk cache. If there is no more space - in the cache, the cache will be flushed. The cache is organized - in a LIFO fashion, in hopes of reducing search costs in - DC_get_block(). FWRITE_ERRORs that would result from trying to - write to a read-only file are returned immediately. - -input: unsigned int index The file to add -input: unsigned long block The block to add -input: int is_write 0 if this is caching an fread(), - 1 if this is caching an fwrite() -input: const char *data The block's data -output: int *error_return Error return - - Possible errors: -NO_ERROR -FSEEK_ERROR -FWRITE_ERROR -***********************************************************************/ -void DC_add_block( - unsigned int index, - unsigned long block, - int is_write, - const char *data, - int *error_return ) -{ -#if CACHEWRITES - int i = 0; - off_t loc; - struct DISK_CACHE_NODE *node = disk_cache, *prev = NULL; - - /* If we are writing to a read-only file, generate an error (but still - add the buffer) */ - if (is_write && ADFI_stridx_c(file_open_mode[ index ], "READ_ONLY" ) == 0) { - *error_return = FWRITE_ERROR; - is_write = 0; - } - - while (i < DISK_CACHE_SIZE - 1 && node && - (!ADFI_is_same_file(node->index, index) || node->block != block)) { - prev = node; - node = node->next; - i++; - } - - if (!node) { /* If no node, allocate one */ - node = (struct DISK_CACHE_NODE *)malloc(sizeof(struct DISK_CACHE_NODE)); - if (prev) - prev->next = node; - if (!disk_cache) - disk_cache = node; - node->next = NULL; - node->dirty = 0; /* Initialize; actual set is below */ - - /* If this buffer is past the current point, it might actually be - a new piece of the file, in which case we'd better write it out */ - loc = ftello(ADF_file[index]); - if (is_write && loc <= (off_t)block * (off_t)DISK_BLOCK_SIZE) { - if (loc != (off_t)block*(off_t)DISK_BLOCK_SIZE) - ADFI_fseek_file(index, block, 0, error_return); - if (*error_return == NO_ERROR) { - if (fwrite(data, 1, DISK_BLOCK_SIZE, - ADF_file[index]) < DISK_BLOCK_SIZE) - *error_return = FWRITE_ERROR; - } - is_write = 0; - } - } - else { - assert(prev || (!prev && node == disk_cache)); - assert(prev != node); - - if (i >= DISK_CACHE_SIZE - 1 && node->dirty) - DC_flush(); - - if (prev) - prev->next = node->next; - if (node != disk_cache) { - node->next = disk_cache; - disk_cache = node; - } - } - assert(node != node->next); - - node->index = index; - node->block = block; - node->dirty = is_write | node->dirty; - memcpy(node->data, data, DISK_BLOCK_SIZE); -#else - *error_return = NO_ERROR; -#endif /* CACHEWRITES */ -} - -/*********************************************************************** -DC get block - Retrieves a file block from the disk cache. Returns 1 if the - block is in the cache, 0 otherwise. If the block is not in - the cache, the contents of 'data' are undefined. - -input: unsigned int index The file to get -input: unsigned long block The block to get -input: const char *data The block's data - - Possible errors: -None -***********************************************************************/ -int DC_get_block( - unsigned int index, - unsigned long block, - char *data ) -{ -#if CACHEWRITES - struct DISK_CACHE_NODE *node = disk_cache; - - while (node && - (!ADFI_is_same_file(node->index, index) || node->block != block)) - node = node->next; - - if (node) - memcpy(data, node->data, DISK_BLOCK_SIZE); - return(node != NULL); -#else - return(0); -#endif /* CACHEWRITES */ -} - -/** Helper function for DC_flush **/ -int DC_sort_compare( const void *a, const void *b ) -{ - struct DISK_CACHE_NODE *lhs = *(struct DISK_CACHE_NODE **)a; - struct DISK_CACHE_NODE *rhs = *(struct DISK_CACHE_NODE **)b; - - if (lhs->block < rhs->block) - return(-1); - else if (lhs->block > rhs->block) - return(1); - return(0); -} - -/*********************************************************************** -DC flush - Flushes all the dirty cached buffers to disk. - - Possible errors: -FSEEK_ERROR, FWRITE_ERROR -***********************************************************************/ -int DC_flush() -{ - int i, n = 0, size, error = NO_ERROR; -#if CACHEWRITES - struct DISK_CACHE_NODE *dirty_buffers[DISK_CACHE_SIZE], *node = disk_cache; - - /* Copy the dirty buffers into an array so that we can sort on - file position in order to minimize fseek()s (which are really - slow when combined with fwrite()s and Linux 2.4's NFS client) */ - while (node) { - if (node->dirty) - dirty_buffers[n++] = node; - node = node->next; - } - - qsort(dirty_buffers, n, sizeof(struct DISK_CACHE_NODE *), DC_sort_compare); - - for (i = 0; i < n; ++i) { - if (fseeko(ADF_file[dirty_buffers[i]->index], - dirty_buffers[i]->block * DISK_BLOCK_SIZE, SEEK_SET) < 0) { - error = FSEEK_ERROR; - } - else if ((size = fwrite(dirty_buffers[i]->data, 1, DISK_BLOCK_SIZE, - ADF_file[dirty_buffers[i]->index])) - < DISK_BLOCK_SIZE) { - error = FWRITE_ERROR; - } - else - dirty_buffers[i]->dirty = 0; - } -#endif /* CACHEWRITES */ - - return(error); -} - -/*********************************************************************** -DC clear - Clears the cache of entries pertaining to the given index. - Does NOT flush the cache first! - -input: unsigned int index The input file - - Possible errors: -None -***********************************************************************/ -void DC_clear( unsigned int index ) -{ -#if CACHEWRITES - struct DISK_CACHE_NODE *prev = NULL, *node = disk_cache; - - while (node) { - if (ADFI_is_same_file(node->index, index)) { - if (node == disk_cache) { - disk_cache = node->next; - free(node); - node = disk_cache; - } - else { - prev->next = node->next; - free(node); - node = prev->next; - } - } - else { - prev = node; - node = node->next; - } - } -#endif /* CACHEWRITES */ -} - -/*********************************************************************** -DC flush range - Ensures that the specified range of blocks (inclusive) is - flushed to disk. - -input: unsigned int index The input file -input: unsigned long start_block The start of the range -input: unsigned long end_block The end of the range -***********************************************************************/ -void DC_flush_range( - unsigned int index, - unsigned long start_block, - unsigned long end_block ) -{ -#if CACHEWRITES - int n = 0; - struct DISK_CACHE_NODE *prev, *node = disk_cache; - - while (node) { - prev = node; - if (ADFI_is_same_file(node->index, index) && - node->block >= start_block && node->block <= end_block) - n++; - node = node->next; - } - if (n > 0) - DC_flush(); -#endif /* CACHEWRITES */ -} - -/* file ADFI_ASCII_Hex_2_unsigned_int.c */ -/*********************************************************************** -ADFI ASCII Hex to unsigned int: - Convert a number of ASCII-HEX into an unsigned integer. - -input: const unsigned int minimum Expected minimum number. -input: const unsigned int maximum Expected maximum number. -input: const unsigned int string_length Length (bytes) of the input string. -input: const char string[] The input string. -output: unsigned int *number The resulting number. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -STRING_LENGTH_ZERO -STRING_LENGTH_TOO_BIG -STRING_NOT_A_HEX_STRING -NUMBER_LESS_THAN_MINIMUM -NUMBER_GREATER_THAN_MAXIMUM -***********************************************************************/ -void ADFI_ASCII_Hex_2_unsigned_int( - const unsigned int minimum, - const unsigned int maximum, - const unsigned int string_length, - const char string[], - unsigned int *number, - int *error_return ) -{ -unsigned int i, /** Index from 0 to string_length - 1 **/ - ir, /** Index from string_length - 1 to 0 **/ - j, /** Temoprary integer variable **/ - num ; /** Working value of ther number **/ - -if( string == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( string_length == 0 ) { - *error_return = STRING_LENGTH_ZERO ; - return ; - } /* end if */ - -if( number == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( string_length > 8 ) { - *error_return = STRING_LENGTH_TOO_BIG ; - return ; - } /* end if */ - -if( minimum > maximum ) { - *error_return = MINIMUM_GT_MAXIMUM ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Convert the ASCII-Hex string into decimal **/ -num = 0 ; -#if 0 -for( i=0, ir=string_length - 1; i= '0' && string[i] <= '9') - j = string[i] - 48; - else if (string[i] >= 'A' && string[i] <= 'F') - j = string[i] - 55; - else if (string[i] >= 'a' && string[i] <= 'f') - j = string[i] - 87; - else { - *error_return = STRING_NOT_A_HEX_STRING ; - return ; - } - num += (j << ir); - ir -= 4; -} -#endif - -if( num < minimum ) { - *error_return = NUMBER_LESS_THAN_MINIMUM ; - return ; - } /* end if */ - -if( num > maximum ) { - *error_return = NUMBER_GREATER_THAN_MAXIMUM ; - return ; - } /* end if */ - - /** Return the number **/ -*number = num ; -} /* end of ADFI_ASCII_Hex_2_unsigned_int */ -/* end of file ADFI_ASCII_Hex_2_unsigned_int.c */ -/* file ADFI_Abort.c */ -/*********************************************************************** -ADFI Abort: - Do any cleanup and then shut the application down. - -input: const int error_code Error which caused the Abort. -output: -none- Hey, we ain't coming back... -***********************************************************************/ -void ADFI_Abort( - const int error_code ) -{ -fprintf(stderr,"ADF Aborted: Exiting\n" ) ; -exit( error_code ) ; -} /* end of ADFI_Abort */ -/* end of file ADFI_Abort.c */ -/* file ADFI_ID_2_file_block_offset.c */ -/*********************************************************************** -ADFI ID to file block and offset: - - The ID is a combination of the file-index, the block within the - file, and an offset within the block. - - the file index is an unsigned 16-bit int. - block pointer is a 32-bit unsigned int. - block offset is a 16-bit unsigned int. - -input: const double ID Given ADF ID. -output: unsigned int *file_index File index from the ID. -output: unsigned long *file_block File block from the ID. -output: unsigned long *block_offset Block offset from the ID. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -FILE_INDEX_OUT_OF_RANGE -BLOCK_OFFSET_OUT_OF_RANGE -***********************************************************************/ -void ADFI_ID_2_file_block_offset( - const double ID, - unsigned int *file_index, - unsigned long *file_block, - unsigned long *block_offset, - int *error_return ) -{ -unsigned char * cc; - -if( (file_index == NULL) || (file_block == NULL) || (block_offset == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( ID == 0.0 ) { - *error_return = NODE_ID_ZERO ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; -cc = (unsigned char *) &ID; -#ifdef PRINT_STUFF -printf("In ADFI_ID_2_file_block_offset: ID=%lf\n",ID); -printf("cc[0-7] = %02X %02X %02X %02X %02X %02X %02X %02X \n", - cc[0], cc[1], cc[2], cc[3], - cc[4], cc[5], cc[6], cc[7] ) ; -#endif - /** Unmap the bytes from the character **/ -if ( ADF_this_machine_format == IEEE_BIG_FORMAT_CHAR ) { - *file_index = cc[1] + ((cc[0]<<8) & 0x003f) ; - *file_block = cc[2] + (cc[3]<<8) + - (cc[4]<<16) + (cc[5]<<24) ; - *block_offset = cc[6] + (cc[7]<<8) ; - } /* end if */ -else if ( ADF_this_machine_format == IEEE_LITTLE_FORMAT_CHAR ) { - *file_index = cc[6] + ((cc[7]<<8) & 0x003f) ; - *file_block = cc[2] + (cc[3]<<8) + - (cc[4]<<16) + (cc[5]<<24) ; - *block_offset = cc[0] + (cc[1]<<8) ; - } /* end else if */ -else { - *file_index = cc[0] + (cc[1]<<8) ; - *file_block = cc[2] + (cc[3]<<8) + - (cc[4]<<16) + (cc[5]<<24) ; - *block_offset = cc[6] + (cc[7]<<8) ; - } /* end else */ - -#ifdef PRINT_STUFF - printf("*file_index=%d, *file_block=%d, *block_offset=%d\n", - *file_index, *file_block, *block_offset); -#endif - -if( *file_index >= MAXIMUM_FILES ) { - *error_return = FILE_INDEX_OUT_OF_RANGE ; - return ; - } /* end if */ - -if( *block_offset >= DISK_BLOCK_SIZE ) { - *error_return = BLOCK_OFFSET_OUT_OF_RANGE ; - return ; - } /* end if */ -} /* end of ADFI_ID_2_file_block_offset */ -/* end of file ADFI_ID_2_file_block_offset.c */ -/* file ADFI_add_2_sub_node_table.c */ -/*********************************************************************** -ADFI add 2 sub node table: - Add a child to a parent's sub-node table. - -input: const int file_index Index of ADF file. -input: const struct DISK_POINTER *parent Location of the parent -input: const struct DISK_POINTER *child Location of the child. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -SUB_NODE_TABLE_ENTRIES_BAD -MEMORY_ALLOCATION_FAILED -***********************************************************************/ -void ADFI_add_2_sub_node_table( - const int file_index, - const struct DISK_POINTER *parent, - const struct DISK_POINTER *child, - int *error_return ) -{ -struct NODE_HEADER parent_node, child_node ; -struct SUB_NODE_TABLE_ENTRY *sub_node_table ; -struct DISK_POINTER tmp_disk_ptr ; -unsigned int old_num_entries ; -int i ; - -if( (parent == NULL) || (child == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Get node_header for the node (parent) **/ -ADFI_read_node_header( file_index, parent, &parent_node, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Get node_header for the node (child) **/ -ADFI_read_node_header( file_index, child, &child_node, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Check current length of sub-node_table, add space if needed **/ -if( parent_node.entries_for_sub_nodes <= parent_node.num_sub_nodes ) { - old_num_entries = parent_node.entries_for_sub_nodes ; - - /** Increase the table space (double it) **/ - if( parent_node.entries_for_sub_nodes == 0 ) - parent_node.entries_for_sub_nodes = LIST_CHUNK ; - else - parent_node.entries_for_sub_nodes = (unsigned int) ( - (float) parent_node.entries_for_sub_nodes * LIST_CHUNK_GROW_FACTOR ) ; - - if( parent_node.entries_for_sub_nodes <= parent_node.num_sub_nodes ) { - *error_return = SUB_NODE_TABLE_ENTRIES_BAD ; - return ; - } /* end if */ - - /** Allocate memory for the required table space in memory **/ - sub_node_table = (struct SUB_NODE_TABLE_ENTRY *) - malloc( parent_node.entries_for_sub_nodes * - sizeof( *sub_node_table ) ) ; - if( sub_node_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - return ; - } /* end if */ - - /** If sub-node table exists, get it **/ - if( old_num_entries > 0 ) { - ADFI_read_sub_node_table( file_index, &parent_node.sub_node_table, - sub_node_table, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - - /** Blank out the new part of the sub-node_table **/ - for( i=parent_node.num_sub_nodes; i<(int) parent_node.entries_for_sub_nodes; - i++ ) { - strncpy( sub_node_table[i].child_name, - /* " ", ADF_NAME_LENGTH ) ; */ - "unused entry in sub-node-table ", ADF_NAME_LENGTH ) ; - sub_node_table[i].child_location.block = 0 ; - sub_node_table[i].child_location.offset = DISK_BLOCK_SIZE ; - } /* end for */ - - /** Allocate memory for the required table space on disk **/ - if( parent_node.num_sub_nodes > 0 ) { /* delete old table from file */ - ADFI_delete_sub_node_table( file_index, &parent_node.sub_node_table, - old_num_entries, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - - ADFI_file_malloc( file_index, TAG_SIZE + DISK_POINTER_SIZE + TAG_SIZE + - parent_node.entries_for_sub_nodes * (ADF_NAME_LENGTH + DISK_POINTER_SIZE), - &tmp_disk_ptr, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - parent_node.sub_node_table.block = tmp_disk_ptr.block ; - parent_node.sub_node_table.offset = tmp_disk_ptr.offset ; - - /** Write out modified sub_node_table **/ - ADFI_write_sub_node_table( file_index, &parent_node.sub_node_table, - parent_node.entries_for_sub_nodes, - (struct SUB_NODE_TABLE_ENTRY *)sub_node_table, error_return ) ; - free( sub_node_table ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - - /** Insert new entry in sub-node table **/ -tmp_disk_ptr.block = parent_node.sub_node_table.block ; -tmp_disk_ptr.offset = parent_node.sub_node_table.offset + - TAG_SIZE + DISK_POINTER_SIZE + - parent_node.num_sub_nodes * (ADF_NAME_LENGTH + DISK_POINTER_SIZE) ; - -ADFI_adjust_disk_pointer( &tmp_disk_ptr, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Write the child's name **/ -ADFI_write_file( file_index, tmp_disk_ptr.block, tmp_disk_ptr.offset, - ADF_NAME_LENGTH, child_node.name, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Write out new sub_node_table entry **/ -tmp_disk_ptr.offset += ADF_NAME_LENGTH ; -ADFI_adjust_disk_pointer( &tmp_disk_ptr, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_write_disk_pointer_2_disk( file_index, tmp_disk_ptr.block, - tmp_disk_ptr.offset, child, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Write out modified parent node-header **/ -parent_node.num_sub_nodes++ ; -ADFI_write_node_header( file_index, parent, &parent_node, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -} /* end of ADFI_add_2_sub_node_table */ -/* end of file ADFI_add_2_sub_node_table.c */ -/* file ADFI_adjust_disk_pointer.c */ -/*********************************************************************** -ADFI adjust disk pointer: - Adjust the disk pointer so that the offset is in a legal - range; from 0 and < DISK_BLOCK_SIZE. - -input: const struct DISK_POINTER *block_offset -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -BLOCK_OFFSET_OUT_OF_RANGE -***********************************************************************/ -void ADFI_adjust_disk_pointer( - struct DISK_POINTER *block_offset, - int *error_return ) -{ -unsigned long oblock ; -unsigned long nblock ; - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -if ( block_offset->offset < DISK_BLOCK_SIZE ) return ; - - /** Calculate the number of blocks in the current offset **/ -nblock = (unsigned long) (block_offset->offset / DISK_BLOCK_SIZE) ; - - /** Adjust block/offset checking for block roll-over **/ -oblock = block_offset->block ; -block_offset->block += nblock ; -block_offset->offset -= nblock * DISK_BLOCK_SIZE ; -if ( block_offset->block < oblock ) { - *error_return = BLOCK_OFFSET_OUT_OF_RANGE ; - return ; - } /* end if */ - -} /* end of ADFI_adjust_disk_pointer */ -/* end of file ADFI_adjust_disk_pointer.c */ -/* file ADFI_big_endian_32_swap_64.c */ -/*********************************************************************** -ADFI big endian 32 swap 64: - -input: const char from_format Format to convert from. 'B','L','C','N' -input: const char from_os_size Format to convert from. 'B','L' -input: const char to_format Format to convert to. -input: const char to_os_size Format to convert to. 'B','L' -input: const char data_type[2] The type of data to convert. - MT I4 I8 U4 U8 R4 R8 X4 X8 C1 B1 -input: const unsigned long delta_from_bytes Number of from_bytes used. -input: const unsigned long delta_to_bytes Number of to_bytes used. -input: const char *from_data The data to convert from. -output: char *to_data The resulting data. -output: int *error_return Error return. - - Recognized data types: - Machine representations - Type Notation IEEE_BIG IEEE_LITTLE Cray - 32 64 32 64 - No data MT - Integer 32 I4 I4 I4 I4 I4 I8 - Integer 64 I8 -- I8 -- I8 I8 - Unsigned 32 U4 I4 I4 I4 I4 I8 - Unsigned 64 U8 -- I8 -- I8 I8 - Real 32 R4 R4 R4 R4 R4 R8 - Real 64 R8 R8 R8 R8 R8 R8 - Complex 64 X4 R4R4 R4R4 R4R4 R4R4 R8R8 - Complex 128 X8 R8R8 R8R8 R8R8 R8R8 R8R8 - Character (unsigned byte) C1 C1 C1 C1 C1 C1 - Byte (unsigned byte) B1 C1 C1 C1 C1 C1 - -Machine Numeric Formats: -***IEEE_BIG (SGI-Iris Assembly Language Programmer's Guide, pages 1-2, 6-3) -I4: Byte0 Byte1 Byte2 Byte3 - MSB---------------------LSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: sign-bit, 8-bit exponent, 23-bit mantissa - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -Machine Numeric Formats: -***IEEE_LITTLE ( The backwards Big Endian ) -I4: Byte0 Byte1 Byte2 Byte3 - LSB---------------------MSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: 23-bit mantissa, 8-bit exponent, sign-bit - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: 52-bit mantissa, 11-bit exponent, sign-bit - -Note: To convert between these two formats the order of the bytes is reversed -since by definition the Big endian starts at the LSB and goes to the MSB where -the little goes form the MSB to the LSB of the word. -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_big_endian_32_swap_64( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -if ( delta_to_bytes == delta_from_bytes ) { - memcpy( to_data, from_data, delta_from_bytes ) ; - } /* end if */ -else if ( delta_from_bytes < delta_to_bytes ) { - switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - case EVAL_2_BYTES( 'I', '8' ): - if( (from_data[0] & 0x80) == 0x80 ) { /* Negative number */ - to_data[0] = 0xff ; - to_data[1] = 0xff ; - to_data[2] = 0xff ; - to_data[3] = 0xff ; - } /* end if */ - else { - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - } /* end else */ - to_data[4] = from_data[0] ; - to_data[5] = from_data[1] ; - to_data[6] = from_data[2] ; - to_data[7] = from_data[3] ; - break ; - default: - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ - } /* end else if */ -else { - switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - case EVAL_2_BYTES( 'I', '8' ): - to_data[0] = from_data[4] ; - to_data[1] = from_data[5] ; - to_data[2] = from_data[6] ; - to_data[3] = from_data[7] ; - break ; - default: - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ - } /* end else */ - -} /* end of ADFI_big_endian_32_swap_64 */ -/* end of file ADFI_big_endian_32_swap_64.c */ -/* file ADFI_big_endian_to_cray.c */ -/*********************************************************************** -ADFI big endian to cray: - -input: const char from_format Format to convert from. 'B','L','C','N' -input: const char from_os_size Format to convert from. 'B','L' -input: const char to_format Format to convert to. -input: const char to_os_size Format to convert to. 'B','L' -input: const char data_type[2] The type of data to convert. - MT I4 I8 U4 U8 R4 R8 X4 X8 C1 B1 -input: const unsigned long delta_from_bytes Number of from_bytes used. -input: const unsigned long delta_to_bytes Number of to_bytes used. -input: const char *from_data The data to convert from. -output: char *to_data The resulting data. -output: int *error_return Error return. - - Recognized data types: - Machine representations - Type Notation IEEE_BIG IEEE_LITTLE Cray - 32 64 32 64 - No data MT - Integer 32 I4 I4 I4 I4 I4 I8 - Integer 64 I8 -- I8 -- I8 I8 - Unsigned 32 U4 I4 I4 I4 I4 I8 - Unsigned 64 U8 -- I8 -- I8 I8 - Real 32 R4 R4 R4 R4 R4 R8 - Real 64 R8 R8 R8 R8 R8 R8 - Complex 64 X4 R4R4 R4R4 R4R4 R4R4 R8R8 - Complex 128 X8 R8R8 R8R8 R8R8 R8R8 R8R8 - Character (unsigned byte) C1 C1 C1 C1 C1 C1 - Byte (unsigned byte) B1 C1 C1 C1 C1 C1 - -Machine Numeric Formats: -***IEEE_BIG (SGI-Iris Assembly Language Programmer's Guide, pages 1-2, 6-3) -I4: Byte0 Byte1 Byte2 Byte3 - MSB---------------------LSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: sign-bit, 8-bit exponent, 23-bit mantissa - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -***Cray (Cray CFT77 Reference Manual, pages G-1 G-2) -I8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - MSB-----------------------------------------------------LSB -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, exponent-sign, 14-bit exponent, 48-bit mantissa -Note: Exponent sign: 1 in this bits indicates a positive exponent sign, - thus bit 62 is the inverse of bit 61 (the sign in the exponent). - The exception to this is a zero, in which all 64 bits are zero! - The interpreation of the floating-point number is: - >>> .mantissia(fraction) X 2^exponent. <<< - The mantissia is left justified (the leftmost bit is a 1). - This MUST be done! - -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_big_endian_to_cray( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ -int i, exp ; - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - - case EVAL_2_BYTES( 'M', 'T' ): - *error_return = NO_DATA ; - return ; - - case EVAL_2_BYTES( 'C', '1' ): - case EVAL_2_BYTES( 'B', '1' ): - to_data[0] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'I', '4' ): - if( (from_data[0] & 0x80) == 0x80 ) { /* Negative number */ - to_data[0] = 0xff ; - to_data[1] = 0xff ; - to_data[2] = 0xff ; - to_data[3] = 0xff ; - } /* end if */ - else { - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - } /* end else */ - to_data[4] = from_data[0] ; - to_data[5] = from_data[1] ; - to_data[6] = from_data[2] ; - to_data[7] = from_data[3] ; - break ; - - case EVAL_2_BYTES( 'U', '4' ): - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - to_data[4] = from_data[0] ; - to_data[5] = from_data[1] ; - to_data[6] = from_data[2] ; - to_data[7] = from_data[3] ; - break ; - - case EVAL_2_BYTES( 'I', '8' ): - if( (from_data[0] & 0x80) == 0x80 ) { /* Negative number */ - to_data[0] = 0xff ; - to_data[1] = 0xff ; - to_data[2] = 0xff ; - to_data[3] = 0xff ; - } /* end if */ - else { - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - } /* end else */ - for( i=0; i<(int)delta_from_bytes; i++ ) - to_data[8-delta_from_bytes+i] = from_data[i] ; - break ; - - case EVAL_2_BYTES( 'U', '8' ): - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - for( i=0; i<(int)delta_from_bytes; i++ ) - to_data[8-delta_from_bytes+i] = from_data[i] ; - break ; - - case EVAL_2_BYTES( 'R', '4' ): - for( i=0; i<8; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[0] == 0x00) && (from_data[1] == 0x00) && - (from_data[2] == 0x00) && (from_data[3] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[0] = from_data[0] & 0x80 ; - - /** Convert the exponent **/ - /** 8 bits to 14 bits. Sign extent from 8 to 14 **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = (from_data[0] & 0x3f) << 1 ; - if( (from_data[1] & 0x80) == 0x80 ) - exp += 1 ; - if( (from_data[0] & 0x40) == 0x00 ) /* set sign */ - exp -= 128 ; - exp += 2 ; - - to_data[1] = exp & 0xff ; - if( exp < 0 ) - to_data[0] |= 0x3f ; /* exponent sign 0, sign extend exponent */ - else - to_data[0] |= 0x40 ; /* exponent sign 1 */ - - /** Convert the mantissia **/ - /** 23 bits to 48 bits. Left shift 25 bits, zero fill **/ - to_data[2] = from_data[1] | 0x80 ; - to_data[3] = from_data[2] ; - to_data[4] = from_data[3] ; - break ; - - case EVAL_2_BYTES( 'R', '8' ): - for( i=0; i<8; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[0] == 0x00) && (from_data[1] == 0x00) && - (from_data[2] == 0x00) && (from_data[3] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[0] = from_data[0] & 0x80 ; - - /** Convert the exponent **/ - /** 11 bits to 14 bits. Sign extent from 11 to 14 **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = ((from_data[0] & 0x3f) << 4) + ((from_data[1]>>4)&0x0f) ; - - if( (from_data[0] & 0x40) == 0x00 ) /* set sign */ - exp -= 1024 ; - exp += 2 ; - - to_data[1] = (unsigned int)(exp & 0xff) ; - to_data[0] |= ((exp>>8) & 0x03) ; - if( exp < 0 ) - to_data[0] |= 0x3c ; /* exponent sign 0, sign extend exponent */ - else - to_data[0] |= 0x40 ; /* exponent sign 1 */ - - /** Convert the mantissia **/ - /** 52 bits to 48 bits. Use 48, drop last 4 bits **/ - to_data[2] = 0x80 | ((from_data[1]<<3)&0x78) | - ((from_data[2]>>5)&0x07) ; - for( i=3; i<8; i++ ) - to_data[i] = ((from_data[i-1]<<3)&0xF8) | - ((from_data[i]>>5)&0x07) ; -#ifdef PRINT_STUFF -printf("from:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", from_data[i] ) ; -printf("to:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", to_data[i] ) ; -printf("\n" ) ; -#endif - break ; - - case EVAL_2_BYTES( 'X', '4' ): - ADFI_big_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_big_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, &from_data[4], &to_data[8], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - case EVAL_2_BYTES( 'X', '8' ): - ADFI_big_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_big_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, &from_data[8], &to_data[8], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - default: - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ -} /* end of ADFI_big_endian_to_cray */ -/* end of file ADFI_big_endian_to_cray.c */ -/* file ADFI_big_little_endian_swap.c */ -/*********************************************************************** -ADFI big little endian swap: - -input: const char from_format Format to convert from. 'B','L','C','N' -input: const char from_os_size Format to convert from. 'B','L' -input: const char to_format Format to convert to. -input: const char to_os_size Format to convert to. 'B','L' -input: const char data_type[2] The type of data to convert. - MT I4 I8 U4 U8 R4 R8 X4 X8 C1 B1 -input: const unsigned long delta_from_bytes Number of from_bytes used. -input: const unsigned long delta_to_bytes Number of to_bytes used. -input: const char *from_data The data to convert from. -output: char *to_data The resulting data. -output: int *error_return Error return. - - Recognized data types: - Machine representations - Type Notation IEEE_BIG IEEE_LITTLE Cray - 32 64 32 64 - No data MT - Integer 32 I4 I4 I4 I4 I4 I8 - Integer 64 I8 -- I8 -- I8 I8 - Unsigned 32 U4 I4 I4 I4 I4 I8 - Unsigned 64 U8 -- I8 -- I8 I8 - Real 32 R4 R4 R4 R4 R4 R8 - Real 64 R8 R8 R8 R8 R8 R8 - Complex 64 X4 R4R4 R4R4 R4R4 R4R4 R8R8 - Complex 128 X8 R8R8 R8R8 R8R8 R8R8 R8R8 - Character (unsigned byte) C1 C1 C1 C1 C1 C1 - Byte (unsigned byte) B1 C1 C1 C1 C1 C1 - -Machine Numeric Formats: -***IEEE_BIG (SGI-Iris Assembly Language Programmer's Guide, pages 1-2, 6-3) -I4: Byte0 Byte1 Byte2 Byte3 - MSB---------------------LSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: sign-bit, 8-bit exponent, 23-bit mantissa - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -Machine Numeric Formats: -***IEEE_LITTLE ( The backwards Big Endian ) -I4: Byte0 Byte1 Byte2 Byte3 - LSB---------------------MSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: 23-bit mantissa, 8-bit exponent, sign-bit - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: 52-bit mantissa, 11-bit exponent, sign-bit - -Note: To convert between these two formats the order of the bytes is reversed -since by definition the Big endian starts at the LSB and goes to the MSB where -the little goes form the MSB to the LSB of the word. -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_big_little_endian_swap( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ -int i ; - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -if ( from_os_size != to_os_size || delta_to_bytes != delta_from_bytes ) { - *error_return = DATA_TYPE_NOT_SUPPORTED ; - return ; -} /** end if **/ - -*error_return = NO_ERROR ; - -for ( i=0; i<(int)delta_from_bytes; i++ ) - to_data[i] = from_data[delta_from_bytes-1-i] ; - -} /* end of ADFI_big_little_endian_swap */ -/* end of file ADFI_big_little_endian_swap.c */ -/* file ADFI_blank_fill_string.c */ -/*********************************************************************** -ADFI blank fill string: - -input/output: char *str The string to fill with blanks. -input: const int length The total length of the string to fill. -***********************************************************************/ -void ADFI_blank_fill_string( - char *str, - const int length ) -{ -int i ; -for( i=strlen( str ); iblock, - &block_offset->offset, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - ADFI_read_node_header( *file_index, block_offset, node_header, - error_return ) ; - return ; -} - -Link_ID = ID ; -while( done == FALSE ) { - /** Get the file, block, and offset numbers from the ID **/ - ADFI_ID_2_file_block_offset( Link_ID, file_index, &block_offset->block, - &block_offset->offset, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Get node_header for the node **/ - ADFI_read_node_header( *file_index, block_offset, node_header, - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - if( (node_header->data_type[0] == 'L') && - (node_header->data_type[1] == 'K')) { - - /** node is a link get file and path data **/ - ADF_Get_Link_Path( Link_ID, link_file, link_path, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - if( link_file[0] != '\0' ) { /* A filename is specified, open it. **/ - - /** Link_ID = root-node of the new file. - note: the file could already be opened, and may be the - current file! **/ - - ADFI_get_file_index_from_name( link_file, &found, &link_file_index, - &Link_ID, error_return ) ; - if( ! found ) { /** Not found; try to open it **/ - if (access(link_file,2)) /* check for read-only mode */ - status = "READ_ONLY"; - else /* open in same mode as current file */ - status = (char *) file_open_mode[*file_index] ; - if ( ADFI_stridx_c(status, "READ_ONLY" ) != 0 ) status="OLD" ; - ADF_Database_Open( link_file, status, "", &Link_ID, - error_return ) ; - if( *error_return != NO_ERROR ) { - *error_return = LINKED_TO_FILE_NOT_THERE ; - return ; - } /* end if */ - } /* end else */ - } /* end if */ - else { /* filename NOT specified, file must be root of link */ - ADF_Get_Node_ID( Link_ID, "/", &temp_ID, error_return ) ; - if( *error_return != NO_ERROR ) { - *error_return = LINKED_TO_FILE_NOT_THERE ; - return ; - } /* end if */ - Link_ID = temp_ID ; - } /* end else */ - - /** Get the node ID of the link to node (may be other links) **/ - ADF_Get_Node_ID( Link_ID, link_path, &temp_ID, error_return ) ; - if( *error_return == CHILD_NOT_OF_GIVEN_PARENT ) - *error_return = LINK_TARGET_NOT_THERE ; /* A better error message */ - if( *error_return != NO_ERROR ) - return ; - - Link_ID = temp_ID ; - if( ++link_depth > ADF_MAXIMUM_LINK_DEPTH ) { - *error_return = LINKS_TOO_DEEP ; - return ; - } /* end if */ - } /* end if */ - else { /** node is NOT a link **/ - done = TRUE ; - } /* end else */ - } /* end while */ - -*LID = Link_ID ; -if (Link_ID != ID) { - last_link_ID = ID; - last_link_LID = Link_ID; -} - -} /* end of ADFI_chase_link */ -/* end of file ADFI_chase_link.c */ -/* file ADFI_check_4_child_name.c */ -/*********************************************************************** -ADFI check 4 child name: - -input: const int file_index Index of ADF file. -input: const struct DISK_POINTER *parent Location of the parent -input: const char *name The name of the new child. -output: int *found 0 if NOT found, else 1. -output: struct DISK_POINTER *sub_node_entry_location -output: struct SUB_NODE_TABLE_ENTRY *sub_node_entry -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -MEMORY_ALLOCATION_FAILED -***********************************************************************/ -void ADFI_check_4_child_name( - const int file_index, - const struct DISK_POINTER *parent, - const char *name, - int *found, - struct DISK_POINTER *sub_node_entry_location, - struct SUB_NODE_TABLE_ENTRY *sub_node_entry, - int *error_return ) -{ -struct NODE_HEADER parent_node ; -struct SUB_NODE_TABLE_ENTRY *sub_node_table ; -int i ; - -if( (parent == NULL) || (found == NULL) || (sub_node_entry_location == NULL) || - (sub_node_entry == NULL ) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( name == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; -*found = 0 ; /* default to NOT found */ - - /** Get node_header for the node **/ -ADFI_read_node_header( file_index, parent, &parent_node, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Check for valid node name **/ - - /** If parent has no children, the new name MUST be NOT found **/ -if( parent_node.num_sub_nodes == 0 ) { - *found = 0 ; - return ; - } /* end if */ - - /** Allocate memory for the required table space in memory **/ -sub_node_table = (struct SUB_NODE_TABLE_ENTRY *) - malloc( parent_node.entries_for_sub_nodes * - sizeof( *sub_node_table ) ) ; -if( sub_node_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - return ; - } /* end if */ - -if( parent_node.entries_for_sub_nodes > 0 ) { - ADFI_read_sub_node_table( file_index, &parent_node.sub_node_table, - sub_node_table, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - - /** Check all names for our new name **/ -for( i=0; i<(int)parent_node.num_sub_nodes; i++ ) { - ADFI_compare_node_names( sub_node_table[i].child_name, name, - found, error_return ) ; - if( *error_return != NO_ERROR ) - break ; - if( *found == 1 ) { /* name was found, save off addresses */ - sub_node_entry_location->block = parent_node.sub_node_table.block ; - sub_node_entry_location->offset = parent_node.sub_node_table.offset + - TAG_SIZE + DISK_POINTER_SIZE + - (ADF_NAME_LENGTH + DISK_POINTER_SIZE) * i ; - - ADFI_adjust_disk_pointer( sub_node_entry_location, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Also save off the child's name **/ - strncpy( sub_node_entry->child_name, sub_node_table[i].child_name, - ADF_NAME_LENGTH ) ; - sub_node_entry->child_location.block = - sub_node_table[i].child_location.block ; - sub_node_entry->child_location.offset = - sub_node_table[i].child_location.offset ; - - /** Get out of the for loop **/ - break ; - } /* end if */ - } /* end for */ - -free( sub_node_table ) ; -} /* end of ADFI_check_4_child_name */ -/* end of file ADFI_check_4_child_name.c */ -/* file ADFI_check_string_length.c */ -/*********************************************************************** -ADFI check string length: - Check a character string for: - being a NULL pointer, - being too long, - being zero length. - -input: const char *str The input string. -input: const int max_length Maximum allowable length of the string. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -STRING_LENGTH_ZERO -STRING_LENGTH_TOO_BIG -***********************************************************************/ -void ADFI_check_string_length( - const char *str, - const int max_length, - int *error_return ) -{ -int str_length, i ; - -if( str == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -str_length = strlen( str ) ; -if( str_length == 0 ) { - *error_return = STRING_LENGTH_ZERO ; - return ; - } /* end if */ - -if( (int) strlen( str ) > max_length ) { - *error_return = STRING_LENGTH_TOO_BIG ; - return ; - } /* end if */ - - /** Check for blank string **/ -*error_return = STRING_LENGTH_ZERO ; -for( i=0; i>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -Machine Numeric Formats: -***IEEE_LITTLE ( The backwards Big Endian ) -I4: Byte0 Byte1 Byte2 Byte3 - LSB---------------------MSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: 23-bit mantissa, 8-bit exponent, sign-bit - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: 52-bit mantissa, 11-bit exponent, sign-bit - -***Cray (Cray CFT77 Reference Manual, pages G-1 G-2) -I8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - MSB-----------------------------------------------------LSB -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, exponent-sign, 14-bit exponent, 48-bit mantissa -Note: Exponent sign: 1 in this bits indicates a positive exponent sign, - thus bit 62 is the inverse of bit 61 (the sign in the exponent). - The exception to this is a zero, in which all 64 bits are zero! - The interpreation of the floating-point number is: - >>> .mantissia(fraction) X 2^exponent. <<< - The mantissia is left justified (the leftmost bit is a 1). - This MUST be done! - -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_convert_number_format( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const int convert_dir, - const struct TOKENIZED_DATA_TYPE *tokenized_data_type, - const unsigned int length, - unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ -unsigned char temp_data[16] ; -char data_type[2] ; -int current_token ; -int array_size ; -int l, s ; -unsigned long delta_from_bytes, delta_to_bytes ; - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( length == 0 ) { - *error_return = NUMBER_LESS_THAN_MINIMUM ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -switch( EVAL_4_BYTES( from_format, to_format, from_os_size, to_os_size ) ) { - case EVAL_4_BYTES( 'B', 'B', 'B', 'B' ): - case EVAL_4_BYTES( 'C', 'C', 'B', 'B' ): - case EVAL_4_BYTES( 'L', 'L', 'B', 'B' ): - case EVAL_4_BYTES( 'B', 'B', 'L', 'L' ): - case EVAL_4_BYTES( 'C', 'C', 'L', 'L' ): - case EVAL_4_BYTES( 'L', 'L', 'L', 'L' ): - *error_return = CONVERSION_FORMATS_EQUAL ; - return ; - } /* end switch */ - -*error_return = NO_ERROR ; - - /** loop over each element **/ -for ( l=0; l<(int)length; l++ ) { - current_token = -1 ; - while( tokenized_data_type[ ++current_token ].type[0] != 0 ) { - data_type[0] = tokenized_data_type[ current_token ].type[0] ; - data_type[1] = tokenized_data_type[ current_token ].type[1] ; - array_size = tokenized_data_type[ current_token ].length ; - if ( convert_dir == FROM_FILE_FORMAT ) { - delta_from_bytes=tokenized_data_type[ current_token ].file_type_size ; - delta_to_bytes =tokenized_data_type[ current_token ].machine_type_size ; - } /** end if **/ - else { - delta_to_bytes =tokenized_data_type[ current_token ].file_type_size ; - delta_from_bytes=tokenized_data_type[ current_token ].machine_type_size ; - } /** end else **/ - - for ( s=0; s 12) ) { - *error_return = BAD_NUMBER_OF_DIMENSIONS ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Chek the inputs **/ -for( i=0; i=1 **/ - if( dims[i] < 1 ) { - *error_return = BAD_DIMENSION_VALUE ; - return ; - } /* end if */ - - /** Check starting values >=1 and <= dims **/ - if( (dim_start[i] < 1) || (dim_start[i] > (int) dims[i]) ) { - *error_return = START_OUT_OF_DEFINED_RANGE ; - return ; - } /* end if */ - - /** Check ending values >=1 and <= dims and >= dim_start **/ - if( (dim_end[i] < 1) || (dim_end[i] > (int) dims[i]) ) { - *error_return = END_OUT_OF_DEFINED_RANGE ; - return ; - } /* end if */ - if( dim_end[i] < dim_start[i] ) { - *error_return = MINIMUM_GT_MAXIMUM ; - return ; - } /* end if */ - - /** Check stride >= 1 **/ - if( dim_stride[i] < 1 ) { - *error_return = BAD_STRIDE_VALUE ; - return ; - } /* end if */ - } /* end for */ - -total = 1 ; -offset = 0 ; -accumlated_size = 1 ; -for( i=0; i>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -***Cray (Cray CFT77 Reference Manual, pages G-1 G-2) -I8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - MSB-----------------------------------------------------LSB -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, exponent-sign, 14-bit exponent, 48-bit mantissa -Note: Exponent sign: 1 in this bits indicates a positive exponent sign, - thus bit 62 is the inverse of bit 61 (the sign in the exponent). - The exception to this is a zero, in which all 64 bits are zero! - The interpreation of the floating-point number is: - >>> .mantissia(fraction) X 2^exponent. <<< - The mantissia is left justified (the leftmost bit is a 1). - This MUST be done! - -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_cray_to_big_endian( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ -int i, exp ; - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - case EVAL_2_BYTES( 'M', 'T' ): - *error_return = NO_DATA ; - return ; - - case EVAL_2_BYTES( 'C', '1' ): - case EVAL_2_BYTES( 'B', '1' ): - to_data[0] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'I', '4' ): - case EVAL_2_BYTES( 'U', '4' ): - to_data[0] = from_data[4] ; - to_data[1] = from_data[5] ; - to_data[2] = from_data[6] ; - to_data[3] = from_data[7] ; - break ; - - case EVAL_2_BYTES( 'I', '8' ): - case EVAL_2_BYTES( 'U', '8' ): - for( i=0; i<(int) delta_to_bytes; i++ ) - to_data[i] = from_data[8-delta_to_bytes+i] ; - break ; - - case EVAL_2_BYTES( 'R', '4' ): - for( i=0; i<4; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[0] == 0x00) && (from_data[1] == 0x00) && - (from_data[2] == 0x00) && (from_data[3] == 0x00) && - (from_data[4] == 0x00) && (from_data[5] == 0x00) && - (from_data[6] == 0x00) && (from_data[7] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[0] = from_data[0] & 0x80 ; - - /** Convert the exponent **/ - /** 14 bits to 8 bits. Sign extent from 8 to 14 **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = from_data[1] + ((from_data[0]&0x3f)<<8) ; - if( (from_data[0] & 0x40) == 0x00 ) /* set sign */ - exp -= 16384 ; - exp -= 2 ; - - if( exp >= 128 ) { - *error_return = NUMERIC_OVERFLOW ; - return ; - } /* end if */ - else if ( exp < -128 ) { - for( i=0; i<4; i++ ) to_data[i] = 0x00 ; /* underflow set to 0 */ - break; - } /* end else */ - - to_data[0] |= ((exp&0x7F) >> 1) ; - if( (exp & 0x01) == 0x01 ) /* LSBit of the exponent */ - to_data[1] |= 0x80 ; - - if( exp >= 0 ) /* Set exponent sign */ - to_data[0] |= 0x40 ; - - /** Convert the mantissia **/ - /** 48 bits to 23 bits, skip the first '1' (2.fract) **/ - to_data[1] |= (from_data[2] & 0x7f) ; - to_data[2] = from_data[3] ; - to_data[3] = from_data[4] ; - break ; - - case EVAL_2_BYTES( 'R', '8' ): - for( i=0; i<8; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[0] == 0x00) && (from_data[1] == 0x00) && - (from_data[2] == 0x00) && (from_data[3] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[0] = from_data[0] & 0x80 ; - - /** Convert the exponent **/ - /** 14 bits to 11 bits **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = from_data[1] + ((from_data[0]&0x3f)<<8) ; - /* set sign if exponent is non-zero */ - if( (exp != 0) && ((from_data[0] & 0x40) == 0x00) ) - exp -= 16384 ; - exp -= 2 ; - - if( exp >= 1024 ) { - *error_return = NUMERIC_OVERFLOW ; - return ; - } /* end if */ - else if ( exp < -1024 ) { - for( i=0; i<4; i++ ) to_data[i] = 0x00 ; /* underflow set to 0 */ - break; - } /* end else */ - - to_data[0] |= ((exp & 0x03F0) >> 4) ; - to_data[1] |= ((exp & 0x000F) << 4) ; - - if( exp >= 0 ) /* Set exponent sign */ - to_data[0] |= 0x40 ; - - /** Convert the mantissia **/ - /** 48 bits to 52 bits, skip the first '1' (2.fract) **/ - to_data[1] |= ((from_data[2] & 0x78) >> 3) ; - for( i=2; i<7; i++ ) - to_data[i] = ((from_data[i] & 0x07) << 5) | - ((from_data[i+1] & 0xf8) >> 3) ; - to_data[7] = ((from_data[7] & 0x07) << 5) ; - -#ifdef PRINT_STUFF -printf("from:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", from_data[i] ) ; -printf("to:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", to_data[i] ) ; -printf("\n" ) ; -#endif - break ; - - case EVAL_2_BYTES( 'X', '4' ): - ADFI_cray_to_big_endian( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_cray_to_big_endian( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, &from_data[8], &to_data[4], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - case EVAL_2_BYTES( 'X', '8' ): - ADFI_cray_to_big_endian( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_cray_to_big_endian( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, &from_data[8], &to_data[8], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - default: - *error_return = INVALID_DATA_TYPE ; - return ; - - } /* end switch */ -} /* end of ADFI_cray_to_big_endian */ -/* end of file ADFI_cray_to_big_endian.c */ -/* file ADFI_cray_to_little_endian.c */ -/*********************************************************************** -ADFI cray to little endian: - -input: const char from_format Format to convert from. 'B','L','C','N' -input: const char from_os_size Format to convert from. 'B','L' -input: const char to_format Format to convert to. -input: const char to_os_size Format to convert to. 'B','L' -input: const char data_type[2] The type of data to convert. - MT I4 I8 U4 U8 R4 R8 X4 X8 C1 B1 -input: const unsigned long delta_from_bytes Number of from_bytes used. -input: const unsigned long delta_to_bytes Number of to_bytes used. -input: const char *from_data The data to convert from. -output: char *to_data The resulting data. -output: int *error_return Error return. - - Recognized data types: - Machine representations - Type Notation IEEE_BIG IEEE_L Cray - No data MT - Integer 32 I4 I4 I4 I4 I4 I8 - Integer 64 I8 -- I8 -- I8 I8 - Unsigned 32 U4 I4 I4 I4 I4 I8 - Unsigned 64 U8 -- I8 -- I8 I8 - Real 32 R4 R4 R4 R4 R4 R8 - Real 64 R8 R8 R8 R8 R8 R8 - Complex 64 X4 R4R4 R4R4 R4R4 R4R4 R8R8 - Complex 128 X8 R8R8 R8R8 R8R8 R8R8 R8R8 - Character (unsigned byte) C1 C1 C1 C1 C1 C1 - Byte (unsigned byte) B1 C1 C1 C1 C1 C1 - -Machine Numeric Formats: -***IEEE_BIG (SGI-Iris Assembly Language Programmer's Guide, pages 1-2, 6-3) -I4: Byte0 Byte1 Byte2 Byte3 - MSB---------------------LSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: sign-bit, 8-bit exponent, 23-bit mantissa - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -***Cray (Cray CFT77 Reference Manual, pages G-1 G-2) -I8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - MSB-----------------------------------------------------LSB -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, exponent-sign, 14-bit exponent, 48-bit mantissa -Note: Exponent sign: 1 in this bits indicates a positive exponent sign, - thus bit 62 is the inverse of bit 61 (the sign in the exponent). - The exception to this is a zero, in which all 64 bits are zero! - The interpreation of the floating-point number is: - >>> .mantissia(fraction) X 2^exponent. <<< - The mantissia is left justified (the leftmost bit is a 1). - This MUST be done! - -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_cray_to_little_endian( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ -int i, exp ; - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - case EVAL_2_BYTES( 'M', 'T' ): - *error_return = NO_DATA ; - return ; - - case EVAL_2_BYTES( 'C', '1' ): - case EVAL_2_BYTES( 'B', '1' ): - to_data[0] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'I', '4' ): - case EVAL_2_BYTES( 'U', '4' ): - to_data[3] = from_data[4] ; - to_data[2] = from_data[5] ; - to_data[1] = from_data[6] ; - to_data[0] = from_data[7] ; - break ; - - case EVAL_2_BYTES( 'I', '8' ): - case EVAL_2_BYTES( 'U', '8' ): - for( i=0; i<(int) delta_to_bytes; i++ ) - to_data[delta_to_bytes-1-i] = from_data[8-delta_to_bytes+i] ; - break ; - - case EVAL_2_BYTES( 'R', '4' ): - for( i=0; i<4; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[0] == 0x00) && (from_data[1] == 0x00) && - (from_data[2] == 0x00) && (from_data[3] == 0x00) && - (from_data[4] == 0x00) && (from_data[5] == 0x00) && - (from_data[6] == 0x00) && (from_data[7] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[3] = from_data[0] & 0x80 ; - - /** Convert the exponent **/ - /** 14 bits to 8 bits. Sign extent from 8 to 14 **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = from_data[1] + ((from_data[0]&0x3f)<<8) ; - if( (from_data[0] & 0x40) == 0x00 ) /* set sign */ - exp -= 16384 ; - exp -= 2 ; - - if( exp >= 128 ) { - *error_return = NUMERIC_OVERFLOW ; - return ; - } /* end if */ - else if ( exp < -128 ) { - for( i=0; i<4; i++ ) to_data[i] = 0x00 ; /* underflow set to 0 */ - break; - } /* end else */ - - to_data[3] |= ((exp&0x7F) >> 1) ; - if( (exp & 0x01) == 0x01 ) /* LSBit of the exponent */ - to_data[2] |= 0x80 ; - - if( exp >= 0 ) /* Set exponent sign */ - to_data[3] |= 0x40 ; - - /** Convert the mantissia **/ - /** 48 bits to 23 bits, skip the first '1' (2.fract) **/ - to_data[2] |= (from_data[2] & 0x7f) ; - to_data[1] = from_data[3] ; - to_data[0] = from_data[4] ; - break ; - - case EVAL_2_BYTES( 'R', '8' ): - for( i=0; i<8; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[0] == 0x00) && (from_data[1] == 0x00) && - (from_data[2] == 0x00) && (from_data[3] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[7] = from_data[0] & 0x80 ; - - /** Convert the exponent **/ - /** 14 bits to 11 bits **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = from_data[1] + ((from_data[0]&0x3f)<<8) ; - /* set sign if exponent is non-zero */ - if( (exp != 0) && ((from_data[0] & 0x40) == 0x00) ) - exp -= 16384 ; - exp -= 2 ; - - if( exp >= 1024 ) { - *error_return = NUMERIC_OVERFLOW ; - return ; - } /* end if */ - else if ( exp < -1024 ) { - for( i=0; i<4; i++ ) to_data[i] = 0x00 ; /* underflow set to 0 */ - break; - } /* end else */ - - to_data[7] |= ((exp & 0x03F0) >> 4) ; - to_data[6] |= ((exp & 0x000F) << 4) ; - - if( exp >= 0 ) /* Set exponent sign */ - to_data[7] |= 0x40 ; - - /** Convert the mantissia **/ - /** 48 bits to 52 bits, skip the first '1' (2.fract) **/ - to_data[6] |= ((from_data[2] & 0x78) >> 3) ; - for( i=2; i<7; i++ ) - to_data[7-i] = ((from_data[i] & 0x07) << 5) | - ((from_data[i+1] & 0xf8) >> 3) ; - to_data[0] = ((from_data[7] & 0x07) << 5) ; - -#ifdef PRINT_STUFF -printf("from:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", from_data[i] ) ; -printf("to:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", to_data[i] ) ; -printf("\n" ) ; -#endif - break ; - - case EVAL_2_BYTES( 'X', '4' ): - ADFI_cray_to_little_endian( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_cray_to_little_endian( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, &from_data[8], &to_data[4], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - case EVAL_2_BYTES( 'X', '8' ): - ADFI_cray_to_little_endian( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_cray_to_little_endian( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, &from_data[8], &to_data[8], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - default: - *error_return = INVALID_DATA_TYPE ; - return ; - - } /* end switch */ -} /* end of ADFI_cray_to_little_endian */ -/* end of file ADFI_cray_to_little_endian.c */ -/* file ADFI_delete_data.c */ -/*********************************************************************** -ADFI delete data: - -Deletes all data from the file for a node. - -input: const int file_index The file index. -input: const struct NODE_HEADER Node header information. -output: int *error_return Error return. -***********************************************************************/ -void ADFI_delete_data( - const int file_index, - const struct NODE_HEADER *node_header, - int *error_return ) -{ -struct DATA_CHUNK_TABLE_ENTRY *data_chunk_table ; -int i ; - -*error_return = NO_ERROR ; - -if( node_header == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -switch( node_header->number_of_data_chunks ) { -case 0 : /** No data to free, do nothing **/ - return ; - -case 1 : /** A single data-chunk to free, so free it **/ - ADFI_file_free( file_index, &node_header->data_chunks, 0, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - -default : /** Multiple data-chunks to free. Free them, - and also the data_chunk table **/ - /** Allocate memory for the required table space in memory **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( node_header->number_of_data_chunks * sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - return ; - } /* end if */ - - /** Read in the table **/ - ADFI_read_data_chunk_table( file_index, &node_header->data_chunks, - data_chunk_table, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Free each entry in the table **/ - for( i=0; i<(int)node_header->number_of_data_chunks; i++ ) { - ADFI_file_free( file_index, &data_chunk_table[i].start, - 0, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end for */ - free( data_chunk_table ) ; - ADFI_file_free( file_index, &node_header->data_chunks, 0, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - }/* end switch */ - -/** Clear all disk entries off the priority stack for file **/ -ADFI_stack_control(file_index, 0, 0, CLEAR_STK_TYPE, DISK_PTR_STK, - 0, NULL ) ; - -} /* end of ADFI_delete_data */ -/* end of file ADFI_delete_data.c */ -/* file ADFI_delete_from_sub_node_table.c */ -/*********************************************************************** -ADFI delete from sub node table: - Delete a child from a parent's sub-node table. - -input: const int file_index Index of ADF file. -input: const struct DISK_POINTER *parent Location of the parent -input: const struct DISK_POINTER *child Location of the child. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_delete_from_sub_node_table( - const int file_index, - const struct DISK_POINTER *parent, - const struct DISK_POINTER *child, - int *error_return ) -{ - -int i, found ; -struct NODE_HEADER parent_node ; -struct SUB_NODE_TABLE_ENTRY *sub_node_table ; - -if( (parent == NULL) || (child == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_read_node_header( file_index, parent, &parent_node, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -sub_node_table = (struct SUB_NODE_TABLE_ENTRY *) - malloc( parent_node.entries_for_sub_nodes * - sizeof( struct SUB_NODE_TABLE_ENTRY ) ) ; -if( sub_node_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - return ; - } /* end if */ - -ADFI_read_sub_node_table( file_index, &parent_node.sub_node_table, - sub_node_table, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Find the child in the parent's sub-node table **/ -for( i=0, found = -1 ; i<(int)parent_node.num_sub_nodes ; i++ ) { - if( child->block == sub_node_table[i].child_location.block && - child->offset == sub_node_table[i].child_location.offset ) { - found = i ; - break ; - } /* end if */ -} /* end for */ - -if( found == -1 ) { - *error_return = SUB_NODE_TABLE_ENTRIES_BAD ; - return ; -} - - /** Move the rest of the table up to fill the hole **/ -for( i=found ; i<(int) (parent_node.num_sub_nodes-1) ; i++ ) { - sub_node_table[i].child_location.block = - sub_node_table[i+1].child_location.block ; - sub_node_table[i].child_location.offset = - sub_node_table[i+1].child_location.offset ; - strncpy ( sub_node_table[i].child_name, sub_node_table[i+1].child_name, - ADF_NAME_LENGTH ) ; - } /* end for */ - -i = parent_node.num_sub_nodes - 1 ; -sub_node_table[i].child_location.block = 0 ; -sub_node_table[i].child_location.offset = 0 ; -strncpy ( sub_node_table[i].child_name, - "unused entry in sub-node-table ", ADF_NAME_LENGTH ) ; - - /** Re-write the parent's sub-node table **/ - -ADFI_write_sub_node_table( file_index, &parent_node.sub_node_table, - parent_node.entries_for_sub_nodes, - sub_node_table, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Update the sub-node count and write the parent's node-header **/ -parent_node.num_sub_nodes -= 1; -ADFI_write_node_header( file_index, parent, &parent_node, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -/** Clear all subnode/disk entries off the priority stack for file **/ -ADFI_stack_control(file_index, 0, 0, CLEAR_STK_TYPE, SUBNODE_STK, - 0, NULL ) ; -ADFI_stack_control(file_index, 0, 0, CLEAR_STK_TYPE, DISK_PTR_STK, - 0, NULL ) ; - -free(sub_node_table); - -} /* end of ADFI_delete_from_sub_node_table */ -/* end of file ADFI_delete_from_sub_node_table.c */ -/* file ADFI_delete_sub_node_table.c */ -/*********************************************************************** -ADFI delete sub node table: - Deletes a sub-node table from the file. - -input: const int file_index Index of ADF file. -input: const struct DISK_POINTER *block_offset The block & offset of - the sub node table. -input: const unsigned int size_sub_node_table Current size of the sub - node table (usually node_header.entries_for_sub_nodes). - If zero, then no action performed. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -FREE_OF_ROOT_NODE -ADF_DISK_TAG_ERROR -FREE_OF_FREE_CHUNK_TABLE -***********************************************************************/ -void ADFI_delete_sub_node_table( - const int file_index, - const struct DISK_POINTER *block_offset, - const unsigned int size_sub_node_table, - int *error_return ) -{ -unsigned int num_bytes ; - - -*error_return = NO_ERROR ; - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -if( size_sub_node_table == 0 ) - return ; /* assume nothing to delete */ - -/* calculate size */ -num_bytes = TAG_SIZE + TAG_SIZE + DISK_POINTER_SIZE + - size_sub_node_table * (ADF_NAME_LENGTH + DISK_POINTER_SIZE); - -ADFI_file_free( file_index, block_offset, num_bytes, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -/** Clear all subnode/disk entries off the priority stack for file **/ -ADFI_stack_control(file_index, 0, 0, CLEAR_STK_TYPE, SUBNODE_STK, - 0, NULL ) ; -ADFI_stack_control(file_index, 0, 0, CLEAR_STK_TYPE, DISK_PTR_STK, - 0, NULL ) ; - -} /* end of ADFI_delete_sub_node_table */ -/* end of file ADFI_delete_sub_node_table.c */ -/* file ADFI_disk_pointer_2_ASCII_Hex.c */ -/*********************************************************************** -ADFI disk pointer to ASCII Hex: - Convert a disk pointer into an ASCII-Hex representation (for disk). - -input: const struct DISK_POINTER *block_offset Disk-pointer struct. -output: char block[8] ASCII block number. -output: char offset[4] ASCII offset number. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -***********************************************************************/ -void ADFI_disk_pointer_2_ASCII_Hex( - const struct DISK_POINTER *block_offset, - char block[8], - char offset[4], - int *error_return ) -{ - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (block == NULL) || (offset == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Convert into ASCII-Hex form **/ -ADFI_unsigned_int_2_ASCII_Hex( block_offset->block, 0, MAXIMUM_32_BITS, - 8, block, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_unsigned_int_2_ASCII_Hex( block_offset->offset, 0, DISK_BLOCK_SIZE, - 4, offset, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -} /* end of ADFI_disk_pointer_2_ASCII_Hex */ -/* end of file ADFI_disk_pointer_2_ASCII_Hex.c */ -/* file ADFI_disk_pointer_from_ASCII_Hex.c */ -/*********************************************************************** -ADFI disk pointer from ASCII Hex: - Convert an ASCII-Hex representation into a disk-pointer (for memory). - -input: const char block[8] ASCII block number. -input: const char offset[4] ASCII offset number. -output: struct DISK_POINTER *block_offset Disk-pointer struct. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -***********************************************************************/ -void ADFI_disk_pointer_from_ASCII_Hex( - const char block[8], - const char offset[4], - struct DISK_POINTER *block_offset, - int *error_return ) -{ -unsigned int tmp ; - -if( (block == NULL) || (offset == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Convert into numeric form **/ -ADFI_ASCII_Hex_2_unsigned_int( 0, MAXIMUM_32_BITS, 8, block, - &tmp, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -block_offset->block = tmp ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, DISK_BLOCK_SIZE, 4, offset, - &tmp, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -block_offset->offset = tmp ; -} /* end of ADFI_disk_pointer_from_ASCII_Hex */ -/* end of file ADFI_disk_pointer_from_ASCII_Hex.c */ -/* file ADFI_evaluate_datatype.c */ -/*********************************************************************** -ADFI evaluate datatype: - -input: const int file_index The file index (0 to MAXIMUM_FILES). -input: const char *data_type. Data-type string. -output: int *file_bytes. Number of bytes used by the data type. -output: int *machine_ bytes. Number of bytes used by the data type. -output: struct TOKENIZED_DATA_TYPE *tokenized_data_type Array. -output: char *file_format The format of this file. -output: char *machine_format The format of this machine. -output: int error_return. Error return. - - Recognized data types: - Type Notation - No data MT - Integer 32 I4 - Integer 64 I8 - Unsigned 32 U4 - Unsigned 64 U8 - Real 32 R4 - Real 64 R8 - Complex 64 X4 - Complex 128 X8 - Character (unsigned byte) C1 - Link (same as C1) LK - Byte (unsigned byte) B1 - A structure is represented as the string "I4,I4,R8". - An array of 25 integers is "I4[25]". - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -DATA_TYPE_TOO_LONG -INVALID_DATA_TYPE -***********************************************************************/ -void ADFI_evaluate_datatype( - const int file_index, - const char data_type[], - int *file_bytes, - int *machine_bytes, - struct TOKENIZED_DATA_TYPE *tokenized_data_type, - char *file_format, - char *machine_format, - int *error_return ) -{ -int str_position = 0 ; -int current_token = 0 ; -int i, str_len, size_file, size_machine ; -char data_type_string[ADF_DATA_TYPE_LENGTH + 1 ] ; -struct FILE_HEADER file_header ; - -if( (file_format == NULL) || (machine_format == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (file_bytes == NULL) || (machine_bytes == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -*file_bytes = 0 ; -*machine_bytes = 0 ; -*error_return = NO_ERROR ; - - /** Return the file & machine's format info **/ -if( file_index >= MAXIMUM_FILES ) { - *error_return = FILE_INDEX_OUT_OF_RANGE ; - return ; - } /* end if */ -*file_format = ADF_file_format[file_index] ; -*machine_format = ADF_this_machine_format ; - - /** Convert blank-filled datatype into C string **/ -ADFI_string_2_C_string( data_type, ADF_DATA_TYPE_LENGTH, data_type_string, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Upper_CASE the data-type string **/ -str_len = strlen( data_type_string ) ; -if ( str_len == 0 ) { - *error_return = STRING_LENGTH_ZERO ; - return ; -} /** end if **/ -for( i=0; i= '0') && - (data_type_string[ str_position ] <= '9') ) { - array_size = array_size * 10 + - (data_type_string[ str_position ] - '0') ; - str_position += 1 ; - } /* end while */ - if( data_type_string[ str_position ] != ']' ) { - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end if */ - str_position += 1 ; - /** Check for comma between types **/ - if( data_type_string[ str_position ] == ',' ) { - str_position += 1 ; - } /* end if */ - *file_bytes = *file_bytes + size_file * array_size ; - *machine_bytes = *machine_bytes + size_machine * array_size ; - tokenized_data_type[ current_token++ ].length = array_size ; - } - break ; - - case ',' : - str_position += 1 ; - *file_bytes = *file_bytes + size_file ; - *machine_bytes = *machine_bytes + size_machine ; - break ; - - default : /** Error condition **/ - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ - } /* end while */ -tokenized_data_type[ current_token ].type[0] = 0x00 ; -tokenized_data_type[ current_token ].type[1] = 0x00 ; -tokenized_data_type[ current_token ].file_type_size = *file_bytes; -tokenized_data_type[ current_token ].machine_type_size = *machine_bytes ; -} /* end of ADFI_evaluate_datatype */ -/* end of file ADFI_evaluate_datatype.c */ -/* file ADFI_fflush_file.c */ -/*********************************************************************** -ADFI fflush file: - To flush the file output stream. - -input: const unsigned int file_index File to use. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -ADF_FILE_NOT_OPENED -FFLUSH_ERROR -***********************************************************************/ -void ADFI_fflush_file( - const unsigned int file_index, - int *error_return ) -{ - - -int iret ; - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -iret = fflush( ADF_file[ file_index ] ) ; -if( iret != 0 ) { - *error_return = FFLUSH_ERROR ; - return ; - } /* end if */ -} /* end of ADFI_fflush_file */ -/* end of file ADFI_fflush_file.c */ -/* file ADFI_figure_machine_format.c */ -/* file ADFI_figure_machine_format.c */ -/*********************************************************************** -ADFI figure machine format: - Determine if the host computer is IEEE_BIG, IEEE_LITTLE, - CRAY, or NATIVE. Once this machines format if determined, - look at the requested format. If NATIVE, use this machines - format, otherwise use the requested format. - -input: const char *format IEEE_BIG, IEEE_LITTLE, CRAY, or NATIVE. -output: const char *machine_format 'B', 'L', 'C', 'N' -output: const char *format_to_use 'B', 'L', 'C', 'N' -output: const char *os_to_use 'B', 'L' -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -***********************************************************************/ - -static unsigned char bits[NUMBER_KNOWN_MACHINES][8][8] = { - /* IEEE BIG 32 */ - /* u.i = 123456789: */ { { 0x07, 0x5B, 0xCD, 0x15, 0x00, 0x00, 0x00, 0x00 }, - /* u.i = -123456789: */ { 0xF8, 0xA4, 0x32, 0xEB, 0x00, 0x00, 0x00, 0x00 }, - /* u.l = 1234567890L: */ { 0x49, 0x96, 0x02, 0xD2, 0x00, 0x00, 0x00, 0x00 }, - /* u.l = -1234567890L: */ { 0xB6, 0x69, 0xFD, 0x2E, 0x00, 0x00, 0x00, 0x00 }, - /* u.f = 12345.6789: */ { 0x46, 0x40, 0xE6, 0xB7, 0x00, 0x00, 0x00, 0x00 }, - /* u.f = -12345.6789: */ { 0xC6, 0x40, 0xE6, 0xB7, 0x00, 0x00, 0x00, 0x00 }, - /* u.d = 12345.6789: */ { 0x40, 0xC8, 0x1C, 0xD6, 0xE6, 0x31, 0xF8, 0xA1 }, - /* u.d = -12345.6789: */ { 0xC0, 0xC8, 0x1C, 0xD6, 0xE6, 0x31, 0xF8, 0xA1 } }, - - /* IEEE LITTLE 32 */ - /* u.i = 123456789: */ { { 0x15, 0xCD, 0x5B, 0x07, 0x00, 0x00, 0x00, 0x00 }, - /* u.i = -123456789: */ { 0xEB, 0x32, 0xA4, 0xF8, 0x00, 0x00, 0x00, 0x00 }, - /* u.l = 1234567890L: */ { 0xD2, 0x02, 0x96, 0x49, 0x00, 0x00, 0x00, 0x00 }, - /* u.l = -1234567890L: */ { 0x2E, 0xFD, 0x69, 0xB6, 0x00, 0x00, 0x00, 0x00 }, - /* u.f = 12345.6789: */ { 0xB7, 0xE6, 0x40, 0x46, 0x00, 0x00, 0x00, 0x00 }, - /* u.f = -12345.6789: */ { 0xB7, 0xE6, 0x40, 0xC6, 0x00, 0x00, 0x00, 0x00 }, - /* u.d = 12345.6789: */ { 0xA1, 0xF8, 0x31, 0xE6, 0xD6, 0x1C, 0xC8, 0x40 }, - /* u.d = -12345.6789: */ { 0xA1, 0xF8, 0x31, 0xE6, 0xD6, 0x1C, 0xC8, 0xC0 } }, - - /* IEEE BIG 64 */ - /* u.i = 123456789: */ { { 0x07, 0x5B, 0xCD, 0x15, 0x00, 0x00, 0x00, 0x00 }, - /* u.i = -123456789: */ { 0xF8, 0xA4, 0x32, 0xEB, 0x00, 0x00, 0x00, 0x00 }, - /* u.l = 1234567890L: */ { 0x00, 0x00, 0x00, 0x00, 0x49, 0x96, 0x02, 0xD2 }, - /* u.l = -1234567890L: */ { 0xFF, 0xFF, 0xFF, 0xFF, 0xB6, 0x69, 0xFD, 0x2E }, - /* u.f = 12345.6789: */ { 0x46, 0x40, 0xE6, 0xB7, 0x00, 0x00, 0x00, 0x00 }, - /* u.f = -12345.6789: */ { 0xC6, 0x40, 0xE6, 0xB7, 0x00, 0x00, 0x00, 0x00 }, - /* u.d = 12345.6789: */ { 0x40, 0xC8, 0x1C, 0xD6, 0xE6, 0x31, 0xF8, 0xA1 }, - /* u.d = -12345.6789: */ { 0xC0, 0xC8, 0x1C, 0xD6, 0xE6, 0x31, 0xF8, 0xA1 } }, - - /* IEEE LITTLE 64 */ - /* u.i = 123456789: */ { { 0x15, 0xCD, 0x5B, 0x07, 0x00, 0x00, 0x00, 0x00 }, - /* u.i = -123456789: */ { 0xEB, 0x32, 0xA4, 0xF8, 0x00, 0x00, 0x00, 0x00 }, - /* u.l = 1234567890L: */ { 0xD2, 0x02, 0x96, 0x49, 0x00, 0x00, 0x00, 0x00 }, - /* u.l = -1234567890L: */ { 0x2E, 0xFD, 0x69, 0xB6, 0xFF, 0xFF, 0xFF, 0xFF }, - /* u.f = 12345.6789: */ { 0xB7, 0xE6, 0x40, 0x46, 0x00, 0x00, 0x00, 0x00 }, - /* u.f = -12345.6789: */ { 0xB7, 0xE6, 0x40, 0xC6, 0x00, 0x00, 0x00, 0x00 }, - /* u.d = 12345.6789: */ { 0xA1, 0xF8, 0x31, 0xE6, 0xD6, 0x1C, 0xC8, 0x40 }, - /* u.d = -12345.6789: */ { 0xA1, 0xF8, 0x31, 0xE6, 0xD6, 0x1C, 0xC8, 0xC0 } }, - - /* CRAY */ - /* u.i = 123456789: */ { { 0x00, 0x00, 0x00, 0x00, 0x07, 0x5B, 0xCD, 0x15 }, - /* u.i = -123456789: */ { 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xA4, 0x32, 0xEB }, - /* u.l = 1234567890L: */ { 0x00, 0x00, 0x00, 0x00, 0x49, 0x96, 0x02, 0xD2 }, - /* u.l = -1234567890L: */ { 0xFF, 0xFF, 0xFF, 0xFF, 0xB6, 0x69, 0xFD, 0x2E }, - /* u.f = 12345.6789: */ { 0x40, 0x0E, 0xC0, 0xE6, 0xB7, 0x31, 0x8F, 0xC5 }, - /* u.f = -12345.6789: */ { 0xC0, 0x0E, 0xC0, 0xE6, 0xB7, 0x31, 0x8F, 0xC5 }, - /* u.d = 12345.6789: */ { 0x40, 0x0E, 0xC0, 0xE6, 0xB7, 0x31, 0x8F, 0xC5 }, - /* u.d = -12345.6789: */ { 0xC0, 0x0E, 0xC0, 0xE6, 0xB7, 0x31, 0x8F, 0xC5 } } - } ; - -void ADFI_figure_machine_format( - const char *format, - char *machine_format, - char *format_to_use, - char *os_to_use, - int *error_return ) -{ -char requested_format, requested_os, machine_os_size = 0; -union { int i; long l; float f; double d; unsigned char bytes[8]; } u ; -int i, k, OK ; - -if( (machine_format == NULL) || (format_to_use == NULL) || - (os_to_use == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check requested format **/ -if( format == NULL ) { - requested_format = NATIVE_FORMAT_CHAR ; - requested_os = OS_32_BIT ; - } /* end if */ -else if( (format[0] == '\0') || (format[0] == ' ') ) { - requested_format = NATIVE_FORMAT_CHAR ; - requested_os = OS_32_BIT ; - } /* end else if */ -else if( ADFI_stridx_c( IEEE_BIG_32_FORMAT_STRING, format ) == 0 ) { - requested_format = IEEE_BIG_FORMAT_CHAR ; - requested_os = OS_32_BIT ; - } /* end else if */ -else if( ADFI_stridx_c( IEEE_LITTLE_32_FORMAT_STRING, format ) == 0 ) { - requested_format = IEEE_LITTLE_FORMAT_CHAR ; - requested_os = OS_32_BIT ; - } /* end else if */ -else if( ADFI_stridx_c( IEEE_BIG_64_FORMAT_STRING, format ) == 0 ) { - requested_format = IEEE_BIG_FORMAT_CHAR ; - requested_os = OS_64_BIT ; - } /* end else if */ -else if( ADFI_stridx_c( IEEE_LITTLE_64_FORMAT_STRING, format ) == 0 ) { - requested_format = IEEE_LITTLE_FORMAT_CHAR ; - requested_os = OS_64_BIT ; - } /* end else if */ -else if( ADFI_stridx_c( CRAY_FORMAT_STRING, format ) == 0 ) { - requested_format = CRAY_FORMAT_CHAR ; - requested_os = OS_64_BIT ; - } /* end else if */ -else if( ADFI_stridx_c( NATIVE_FORMAT_STRING, format ) == 0 ) { - requested_format = NATIVE_FORMAT_CHAR ; - requested_os = OS_32_BIT ; - } /* end else if */ -else { - *error_return = ADF_FILE_FORMAT_NOT_RECOGNIZED ; - return ; - } /* end else */ - - /***** Determine this machine's numeric format *****/ - /** Check for numeric bit patterns **/ -#define ZERO_UNION() \ - for( k=0; k<8; k++ ) \ - u.bytes[k] = '\0' ; -#define CHECK_UNION(B) \ - if( (u.bytes[0] != B[0]) || (u.bytes[1] != B[1]) || \ - (u.bytes[2] != B[2]) || (u.bytes[3] != B[3]) || \ - (u.bytes[4] != B[4]) || (u.bytes[5] != B[5]) || \ - (u.bytes[6] != B[6]) || (u.bytes[7] != B[7]) ) continue ; - -OK = FALSE ; -*machine_format = NATIVE_FORMAT_CHAR ; -for( i=0; i= 8 ) machine_os_size = OS_64_BIT ; - else machine_os_size = OS_32_BIT ; - } /* end if */ - -if( ADF_this_machine_format == UNDEFINED_FORMAT_CHAR ) { - ADF_this_machine_format = *machine_format ; - ADF_this_machine_os_size = machine_os_size ; - } /* end if */ - -if( requested_format == NATIVE_FORMAT_CHAR ) { - *format_to_use = *machine_format ; - *os_to_use = machine_os_size ; - } /* end if */ -else { - *format_to_use = requested_format ; - *os_to_use = requested_os ; - } /* end if */ - -if( *machine_format == NATIVE_FORMAT_CHAR ) - *error_return = MACHINE_FORMAT_NOT_RECOGNIZED ; - -} /* end of ADFI_figure_machine_format */ -/* end of file ADFI_figure_machine_format.c */ -/* end of file ADFI_figure_machine_format.c */ -/* file ADFI_file_and_machine_compare.c */ -/*********************************************************************** -ADFI file and machine compare: - Compares file and machine formats. - -input: const int file_index The file index (0 to MAXIMUM_FILES). -output: int *compare 1 = formats compare, 0 = do not -output: int *error_return Error return - - Possible errors: -FILE_INDEX_OUT_OF_RANGE -***********************************************************************/ -void ADFI_file_and_machine_compare( - const int file_index, - const struct TOKENIZED_DATA_TYPE *tokenized_data_type, - int *compare, - int *error_return ) -{ - int machine_size, file_size, token ; - *compare = 0 ; - *error_return = NO_ERROR ; - - if( file_index < 0 || file_index >= MAXIMUM_FILES ) { - *error_return = FILE_INDEX_OUT_OF_RANGE ; - return ; - } - - if( ADF_this_machine_format == NATIVE_FORMAT_CHAR || - ADF_file_format[file_index] == NATIVE_FORMAT_CHAR ) { - struct FILE_HEADER file_header ; - /** Get file_header for the file variable sizes **/ - ADFI_read_file_header( file_index, &file_header, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - /** Make sure the sizes are the same or we are cooked!! **/ - if ( ADF_file_format[file_index] != NATIVE_FORMAT_CHAR || - file_header.sizeof_char != sizeof( char ) || - file_header.sizeof_short != sizeof( short ) || - file_header.sizeof_int != sizeof( int ) || - file_header.sizeof_long != sizeof( long ) || - file_header.sizeof_float != sizeof( float ) || - file_header.sizeof_double != sizeof( double ) || - file_header.sizeof_char_p != POINTER_SIZE( char ) || - file_header.sizeof_short_p != POINTER_SIZE( short ) || - file_header.sizeof_int_p != POINTER_SIZE( int ) || - file_header.sizeof_long_p != POINTER_SIZE( long ) || - file_header.sizeof_float_p != POINTER_SIZE( float ) || - file_header.sizeof_double_p != POINTER_SIZE( double ) - ) { - *error_return = MACHINE_FILE_INCOMPATABLE ; - return ; - } /** end if **/ - } /** end if **/ - - if( ADF_file_format[file_index] == ADF_this_machine_format && - ADF_file_os_size[file_index] == ADF_this_machine_os_size ) { - *compare = 1 ; - } else if( ADF_file_format[file_index] == ADF_this_machine_format ) { - /** If the file and machine binary type are the same and only the - sizes may be different (like long is 32 or 64), then if all the - sizes are the same then no conversion is necessary and ws can avoid - the conversion overhead and just do direct read/writes. **/ - if ( tokenized_data_type == NULL ) return ; - token = -1 ; - *compare = 1 ; - do { - token++ ; - machine_size = tokenized_data_type[ token ].machine_type_size ; - file_size = tokenized_data_type[ token ].file_type_size ; - if ( machine_size != file_size ) { - *compare = 0 ; - break ; - } - } while( tokenized_data_type[ token ].type[0] != 0 ) ; - } -} /* end of ADFI_file_and_machine_compare */ -/* end of file ADFI_file_and_machine_compare.c */ -/* file ADFI_file_block_offset_2_ID.c */ -/*********************************************************************** -ADFI file block and offset to ID: - Convert an ADF file, block, and offset to an ADF ID. - -input: const int file_index The file index (0 to MAXIMUM_FILES). -input: const unsigned long file_block The block within the file. -input: const unsigned long block_offset The offset within the block. -output: double *ID The resulting ADF ID. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -FILE_INDEX_OUT_OF_RANGE -BLOCK_OFFSET_OUT_OF_RANGE -***********************************************************************/ -void ADFI_file_block_offset_2_ID( - const int file_index, - const unsigned long file_block, - const unsigned long block_offset, - double *ID, - int *error_return ) -{ -double dd; -unsigned char * cc; - -if( ID == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; -if( file_index >= MAXIMUM_FILES ) { - *error_return = FILE_INDEX_OUT_OF_RANGE ; - return ; - } /* end if */ - -if( block_offset >= DISK_BLOCK_SIZE ) { - *error_return = BLOCK_OFFSET_OUT_OF_RANGE ; - return ; - } /* end if */ - - /** Map the bytes into the character variable **/ - /* Note that there were problems with some machines flushing small numbers - to zero causing problems with the encoding of ID (which is not in - its self a true number). The IEEE standard says that this is not - allowed and so should not be a problem except that you get a major - performance hit on the machine if you have it enforce the IEEE - standard. Thus I force the sign bit on the exponent to always be positive - so that the ID is a number greater than |1|. Previously on the - IEEE big endian the numbers would look like 3.132313E-311. The - new encoding changes the max number of open files to 16K from 64K */ - -cc = (unsigned char *) ⅆ -if ( ADF_this_machine_format == IEEE_BIG_FORMAT_CHAR ) { - cc[1] = (unsigned char) (file_index & 0x00ff) ; - cc[0] = (unsigned char) (64 + (( file_index >> 8) & 0x003f)) ; - - cc[2] = (unsigned char) (file_block & 0x000000ff) ; - cc[3] = (unsigned char) ((file_block >> 8) & 0x000000ff) ; - cc[4] = (unsigned char) ((file_block >> 16) & 0x000000ff) ; - cc[5] = (unsigned char) ((file_block >> 24) & 0x000000ff) ; - - cc[6] = (unsigned char) (block_offset & 0x00ff) ; - cc[7] = (unsigned char) ((block_offset >> 8) & 0x00ff) ; - } /* end if */ -else if ( ADF_this_machine_format == IEEE_LITTLE_FORMAT_CHAR ) { - cc[6] = (unsigned char) (file_index & 0x00ff) ; - cc[7] = (unsigned char) (64 + (( file_index >> 8) & 0x003f)) ; - - cc[2] = (unsigned char) (file_block & 0x000000ff) ; - cc[3] = (unsigned char) ((file_block >> 8) & 0x000000ff) ; - cc[4] = (unsigned char) ((file_block >> 16) & 0x000000ff) ; - cc[5] = (unsigned char) ((file_block >> 24) & 0x000000ff) ; - - cc[0] = (unsigned char) (block_offset & 0x00ff) ; - cc[1] = (unsigned char) ((block_offset >> 8) & 0x00ff) ; - } /* end else if */ -else { - cc[0] = (unsigned char) (file_index & 0x00ff) ; - cc[1] = (unsigned char) ((file_index >> 8) & 0x00ff) ; - - cc[2] = (unsigned char) (file_block & 0x000000ff) ; - cc[3] = (unsigned char) ((file_block >> 8) & 0x000000ff) ; - cc[4] = (unsigned char) ((file_block >> 16) & 0x000000ff) ; - cc[5] = (unsigned char) ((file_block >> 24) & 0x000000ff) ; - - cc[6] = (unsigned char) (block_offset & 0x00ff) ; - cc[7] = (unsigned char) ((block_offset >> 8) & 0x00ff) ; - } /* end else */ - -*ID = dd; -#ifdef PRINT_STUFF -printf("cc[0-7] = %02X %02X %02X %02X %02X %02X %02X %02X \n", - cc[0], cc[1], cc[2], cc[3], - cc[4], cc[5], cc[6], cc[7] ) ; -printf("In ADFI_file_block_offset_2_ID: ID=%lf\n",*ID); -#endif - -} /* end of ADFI_file_block_offset_2_ID */ -/* end of file ADFI_file_block_offset_2_ID.c */ -/* file ADFI_file_free.c */ -/*********************************************************************** -ADFI file free: - To free-up a chunk of file space. - -input: const int file_index The file index (0 to MAXIMUM_FILES). -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const long number_of_bytes Number of bytes to free. If 0, - then look at type of chunk to get size. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -FREE_OF_ROOT_NODE -ADF_DISK_TAG_ERROR -FREE_OF_FREE_CHUNK_TABLE -***********************************************************************/ -void ADFI_file_free( - const int file_index, - const struct DISK_POINTER *block_offset, - const long in_number_of_bytes, - int *error_return ) -{ -char tag[TAG_SIZE + 1] ; -struct DISK_POINTER end_of_chunk_tag ; -struct DISK_POINTER tmp_blk_ofst ; -struct FREE_CHUNK_TABLE free_chunk_table ; -struct FREE_CHUNK free_chunk ; -int i ; -long number_of_bytes = in_number_of_bytes ; - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -if( number_of_bytes == 0 ) { - - /** Check the disk tag to see what kind of disk chunk we have. - We need this to determine the length of the chunk. **/ - ADFI_read_file( file_index, block_offset->block, block_offset->offset, - TAG_SIZE, tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - tag[TAG_SIZE] = '\0' ; /* Null terminate the string */ - - end_of_chunk_tag.block = 0 ; - end_of_chunk_tag.offset = 0 ; - if( ADFI_stridx_c( tag, node_start_tag ) == 0 ) { /** This is a node **/ - if( (block_offset->block == ROOT_NODE_BLOCK) && - (block_offset->offset == ROOT_NODE_OFFSET) ) { - *error_return = FREE_OF_ROOT_NODE ; - return ; - } /* end if */ - end_of_chunk_tag.block = block_offset->block ; - end_of_chunk_tag.offset = block_offset->offset + NODE_HEADER_SIZE - - TAG_SIZE ; - if ( end_of_chunk_tag.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } - - /** Check disk boundary-tag **/ - ADFI_read_file( file_index, end_of_chunk_tag.block, - end_of_chunk_tag.offset, TAG_SIZE, tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - if( ADFI_stridx_c( tag, node_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - } /* end if */ - else if( ADFI_stridx_c( tag, free_chunk_table_start_tag ) == 0 ) { - /** Trying to free the free-chunk-table. This is BAD. **/ - *error_return = FREE_OF_FREE_CHUNK_TABLE ; - return ; - } /* end else if */ - else if( ADFI_stridx_c( tag, free_chunk_start_tag ) == 0 ) { - - /** Set a temporary block/offset to read disk pointer **/ - tmp_blk_ofst.block = block_offset->block ; - tmp_blk_ofst.offset = block_offset->offset + TAG_SIZE ; - if ( tmp_blk_ofst.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &tmp_blk_ofst, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } - /** Get the end_of_chunk-tag block/offset from disk **/ - ADFI_read_disk_pointer_from_disk( file_index, tmp_blk_ofst.block, - tmp_blk_ofst.offset, &end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Check disk boundary-tag **/ - ADFI_read_file( file_index, end_of_chunk_tag.block, - end_of_chunk_tag.offset, TAG_SIZE, tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - if( ADFI_stridx_c( tag, free_chunk_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - } /* end else if */ - else if( ADFI_stridx_c( tag, sub_node_start_tag ) == 0 ) { - - /** Set a temporary block/offset to read disk pointer **/ - tmp_blk_ofst.block = block_offset->block ; - tmp_blk_ofst.offset = block_offset->offset + TAG_SIZE ; - if ( tmp_blk_ofst.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &tmp_blk_ofst, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } - - /** Get the end_of_chunk-tag block/offset from disk **/ - ADFI_read_disk_pointer_from_disk( file_index, tmp_blk_ofst.block, - tmp_blk_ofst.offset, &end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Check disk boundary-tag **/ - ADFI_read_file( file_index, end_of_chunk_tag.block, - end_of_chunk_tag.offset, TAG_SIZE, tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - if( ADFI_stridx_c( tag, sub_node_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - } /* end else if */ - else if( ADFI_stridx_c( tag, data_chunk_table_start_tag ) == 0 ) { - - /** Set a temporary block/offset to read disk pointer **/ - tmp_blk_ofst.block = block_offset->block ; - tmp_blk_ofst.offset = block_offset->offset + TAG_SIZE ; - if ( tmp_blk_ofst.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &tmp_blk_ofst, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } - - /** Get the end_of_chunk-tag block/offset from disk **/ - ADFI_read_disk_pointer_from_disk( file_index, tmp_blk_ofst.block, - tmp_blk_ofst.offset, &end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Check disk boundary-tag **/ - ADFI_read_file( file_index, end_of_chunk_tag.block, - end_of_chunk_tag.offset, TAG_SIZE, tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - if( ADFI_stridx_c( tag, data_chunk_table_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - } /* end else if */ - else if( ADFI_stridx_c( tag, data_chunk_start_tag ) == 0 ) { - - /** Set a temporary block/offset to read disk pointer **/ - tmp_blk_ofst.block = block_offset->block ; - tmp_blk_ofst.offset = block_offset->offset + TAG_SIZE ; - if ( tmp_blk_ofst.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &tmp_blk_ofst, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } - - /** Get the end_of_chunk-tag block/offset from disk **/ - ADFI_read_disk_pointer_from_disk( file_index, tmp_blk_ofst.block, - tmp_blk_ofst.offset, &end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Check disk boundary-tag **/ - ADFI_read_file( file_index, end_of_chunk_tag.block, - end_of_chunk_tag.offset, TAG_SIZE, tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - if( ADFI_stridx_c( tag, data_chunk_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - } /* end else if */ - else { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end else */ - number_of_bytes = (end_of_chunk_tag.block - block_offset->block) * - DISK_BLOCK_SIZE + (end_of_chunk_tag.offset - block_offset->offset + - TAG_SIZE) ; - } /* end if */ -else { /** Use the number of bytes passed in **/ - end_of_chunk_tag.block = block_offset->block ; - end_of_chunk_tag.offset = block_offset->offset + number_of_bytes - TAG_SIZE ; - ADFI_adjust_disk_pointer( &end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - -if( number_of_bytes <= SMALLEST_CHUNK_SIZE ) { /** Too small, z-gas **/ - /** Initialize the block of 'Z's **/ - if( block_of_ZZ_initialized == FALSE ) { - for( i=0; iblock, block_offset->offset, - number_of_bytes, block_of_ZZ, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ -else { /** Add this chunk to the free table **/ - /** Get the free-chunk-table **/ - ADFI_read_free_chunk_table( file_index, &free_chunk_table, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - if( block_offset->block == end_of_chunk_tag.block ) { /* small or medium */ - if( (end_of_chunk_tag.offset + TAG_SIZE - block_offset->offset) <= - SMALL_CHUNK_MAXIMUM ) { /** SMALL chunk **/ - free_chunk.end_of_chunk_tag.block = end_of_chunk_tag.block ; - free_chunk.end_of_chunk_tag.offset = end_of_chunk_tag.offset ; - free_chunk.next_chunk.block = free_chunk_table.small_first_block.block; - free_chunk.next_chunk.offset = - free_chunk_table.small_first_block.offset ; - - free_chunk_table.small_first_block.block = block_offset->block ; - free_chunk_table.small_first_block.offset = block_offset->offset ; - - /** If linked-list was empty, also point to this as the last. **/ - if( free_chunk.next_chunk.offset == BLANK_BLOCK_OFFSET ) { - free_chunk_table.small_last_block.block = block_offset->block ; - free_chunk_table.small_last_block.offset = block_offset->offset ; - } /* end if */ - } /* end if */ - else { /** MEDIUM chunk **/ - free_chunk.end_of_chunk_tag.block = end_of_chunk_tag.block ; - free_chunk.end_of_chunk_tag.offset = end_of_chunk_tag.offset ; - free_chunk.next_chunk.block = - free_chunk_table.medium_first_block.block ; - free_chunk.next_chunk.offset = - free_chunk_table.medium_first_block.offset; - - free_chunk_table.medium_first_block.block = block_offset->block ; - free_chunk_table.medium_first_block.offset = block_offset->offset ; - - /** If linked-list was empty, also point to this as the last. **/ - if( free_chunk.next_chunk.offset == BLANK_BLOCK_OFFSET ) { - free_chunk_table.medium_last_block.block = block_offset->block ; - free_chunk_table.medium_last_block.offset = block_offset->offset ; - } /* end if */ - } /* end else */ - } /* end if */ - else { /** LARGE chunk **/ - free_chunk.end_of_chunk_tag.block = end_of_chunk_tag.block ; - free_chunk.end_of_chunk_tag.offset = end_of_chunk_tag.offset ; - free_chunk.next_chunk.block = free_chunk_table.large_first_block.block; - free_chunk.next_chunk.offset = - free_chunk_table.large_first_block.offset ; - - free_chunk_table.large_first_block.block = block_offset->block ; - free_chunk_table.large_first_block.offset = block_offset->offset ; - - /** If linked-list was empty, also point to this as the last. **/ - if( free_chunk.next_chunk.offset == BLANK_BLOCK_OFFSET ) { - free_chunk_table.large_last_block.block = block_offset->block ; - free_chunk_table.large_last_block.offset = block_offset->offset ; - } /* end if */ - } /* end else */ - - /** Put the free-chunk tags in place **/ - strncpy( free_chunk.start_tag, free_chunk_start_tag, TAG_SIZE ) ; - strncpy( free_chunk.end_tag, free_chunk_end_tag, TAG_SIZE ) ; - - /** Write out the free chunk **/ - ADFI_write_free_chunk( file_index, block_offset, &free_chunk, error_return ); - if( *error_return != NO_ERROR ) - return ; - /** Update the free-chunk-table **/ - ADFI_write_free_chunk_table( file_index, &free_chunk_table, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - - /** Delete the block/offset off the stack **/ - ADFI_stack_control(file_index, block_offset->block, block_offset->offset, - DEL_STK_ENTRY, 0, 0, NULL ) ; - -} /* end of ADFI_file_free */ -/* end of file ADFI_file_free.c */ -/* file ADFI_file_malloc.c */ -/*********************************************************************** -ADFI file malloc: - To allocate a chunk of disk space. - -input: const int file_index The file index (0 to MAXIMUM_FILES). -input: size_bytes The size in bytes to allocate. -output: const struct DISK_POINTER *block_offset Block & offset in the file. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_file_malloc( - const int file_index, - const long size_bytes, - struct DISK_POINTER *block_offset, - int *error_return ) -{ -struct FILE_HEADER file_header ; -struct FREE_CHUNK_TABLE free_chunk_table ; -struct DISK_POINTER disk_pointer, previous_disk_pointer ; -struct DISK_POINTER *first_free_block=0, *last_free_block=0; -struct FREE_CHUNK free_chunk, previous_free_chunk ; -int i ; -int memory_found = FALSE ; -unsigned long size ; - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - - /** Get the free-chunk_table **/ -ADFI_read_free_chunk_table( file_index, &free_chunk_table, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Look for the needed space in the 3 free lists. - Note that all file control headers are smaller than - the SMALLEST_CHUNK_SIZE and so will be fit later into - a block at the end of the file. This greatly improves - node creation efficiency. **/ -for( i=0; i<3; i++ ) { - if( memory_found == TRUE || size_bytes <= SMALLEST_CHUNK_SIZE ) - break ; - ADFI_set_blank_disk_pointer( &previous_disk_pointer ) ; - switch( i ) { - case 0: /** SMALL CHUNKS **/ - if( size_bytes > SMALL_CHUNK_MAXIMUM ) - continue ; /** Next in the for loop **/ - first_free_block = &free_chunk_table.small_first_block ; - last_free_block = &free_chunk_table.small_last_block ; - break ; - case 1: /** MEDIUM CHUNKS **/ - if( size_bytes > MEDIUM_CHUNK_MAXIMUM ) - continue ; /** Next in the for loop **/ - first_free_block = &free_chunk_table.medium_first_block ; - last_free_block = &free_chunk_table.medium_last_block ; - break ; - case 2: /** LARGE CHUNKS **/ - first_free_block = &free_chunk_table.large_first_block ; - last_free_block = &free_chunk_table.large_last_block ; - break ; - } /* end switch */ - - disk_pointer = *first_free_block ; - while( (memory_found != TRUE) && - ((disk_pointer.block != BLANK_FILE_BLOCK) || - (disk_pointer.offset != BLANK_BLOCK_OFFSET)) ) { - ADFI_read_free_chunk( file_index, &disk_pointer, &free_chunk, - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - size = (free_chunk.end_of_chunk_tag.block - disk_pointer.block) * - DISK_BLOCK_SIZE + - (free_chunk.end_of_chunk_tag.offset - disk_pointer.offset) + - TAG_SIZE ; - if( (long int) size >= size_bytes ) { - *block_offset = disk_pointer ; - if( (previous_disk_pointer.block != BLANK_FILE_BLOCK) || - (previous_disk_pointer.offset != BLANK_BLOCK_OFFSET) ) { - - /** Link previous free-chunk to the next free-chunk, - removing this free-chunk from the list - **/ - ADFI_read_free_chunk( file_index, &previous_disk_pointer, - &previous_free_chunk, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - previous_free_chunk.next_chunk = free_chunk.next_chunk ; - ADFI_write_free_chunk( file_index, &previous_disk_pointer, - &previous_free_chunk, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - else { - - /** Free-chunk was the first one, change entry in the free-chunk-header **/ - *first_free_block = free_chunk.next_chunk ; - ADFI_write_free_chunk_table( file_index, &free_chunk_table, - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - - if((last_free_block->block == disk_pointer.block) && - (last_free_block->offset == disk_pointer.offset)){ - if( (previous_disk_pointer.block != BLANK_FILE_BLOCK) || - (previous_disk_pointer.offset != BLANK_BLOCK_OFFSET) ) { - *last_free_block = previous_disk_pointer ; - } /* end if */ - else { - ADFI_set_blank_disk_pointer( last_free_block ) ; - } /* end else */ - ADFI_write_free_chunk_table( file_index, &free_chunk_table, - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - - size -= size_bytes ; - if ( size > 0 ) { - disk_pointer.offset += size_bytes ; - ADFI_adjust_disk_pointer( &disk_pointer, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - ADFI_file_free( file_index, &disk_pointer, size, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } - memory_found = TRUE ; - } /* end if */ - else { - previous_disk_pointer = disk_pointer ; - disk_pointer = free_chunk.next_chunk ; - } /* end else */ - } /* end while */ - } /* end if */ - - /** The end-of_file pointer points to the last byte USED, - NOT the next byte TO USE. - **/ -if( memory_found != TRUE ) { /* Append memory at end of file **/ - ADFI_read_file_header( file_index, &file_header, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - /** If the end-of_file is NOT at a block boundary, then - see if the new allocated chunk will span a block boundary. - If it will, then start at the new block if it will fit within - the block. This helps efficiency to have file control headers - located within a block boundry. - **/ - if( file_header.end_of_file.offset != DISK_BLOCK_SIZE - 1 ) { - if( (file_header.end_of_file.offset+size_bytes) >= DISK_BLOCK_SIZE && - size_bytes <= DISK_BLOCK_SIZE ) { - /** Free rest of block, allocate from next block **/ - file_header.end_of_file.offset++ ; - ADFI_file_free( file_index, &file_header.end_of_file, - DISK_BLOCK_SIZE - file_header.end_of_file.offset, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - block_offset->block = file_header.end_of_file.block + 1 ; - block_offset->offset = 0 ; - file_header.end_of_file.block++ ; - file_header.end_of_file.offset = size_bytes - 1 ; - ADFI_adjust_disk_pointer( &file_header.end_of_file, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - } /* end if */ - else { /** Use the remaining block **/ - block_offset->block = file_header.end_of_file.block ; - block_offset->offset = file_header.end_of_file.offset + 1 ; - file_header.end_of_file.offset += size_bytes ; - ADFI_adjust_disk_pointer( &file_header.end_of_file, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - } /* end if */ - else { /* already pointing to start of block **/ - block_offset->block = file_header.end_of_file.block + 1 ; - block_offset->offset = 0 ; - file_header.end_of_file.block++ ; - file_header.end_of_file.offset = size_bytes - 1 ; - ADFI_adjust_disk_pointer( &file_header.end_of_file, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - - - /** Write out the modified file header **/ - ADFI_write_file_header( file_index, &file_header, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - -} /* end of ADFI_file_malloc */ -/* end of file ADFI_file_malloc.c */ -/* file ADFI_fill_initial_file_header.c */ -/*********************************************************************** -ADFI fill initial file header: - To determine the file header information... - -input: const char format 'B', 'L', 'C', 'N' -input: const char os_size 'B', 'L' -input: const char *what_string UNIX "what" identifier. -output: struct FILE_HEADER *file_header The resulting file header information. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -ADF_FILE_FORMAT_NOT_RECOGNIZED -***********************************************************************/ -void ADFI_fill_initial_file_header( - const char format, - const char os_size, - const char *what_string, - struct FILE_HEADER *file_header, - int *error_return ) -{ -int i ; - -if( what_string == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_header == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (format != IEEE_BIG_FORMAT_CHAR) && (format != IEEE_LITTLE_FORMAT_CHAR) && - (format != CRAY_FORMAT_CHAR) && (format != NATIVE_FORMAT_CHAR) ) { - *error_return = ADF_FILE_FORMAT_NOT_RECOGNIZED ; - return ; - } /* end if */ - - /** Put the boundary tags in first. If we then overwrite them, we'll know **/ -strncpy( file_header->tag0, file_header_tags[0], TAG_SIZE ) ; -strncpy( file_header->tag1, file_header_tags[1], TAG_SIZE ) ; -strncpy( file_header->tag2, file_header_tags[2], TAG_SIZE ) ; -strncpy( file_header->tag3, file_header_tags[3], TAG_SIZE ) ; -strncpy( file_header->tag4, file_header_tags[4], TAG_SIZE ) ; -strncpy( file_header->tag5, file_header_tags[5], TAG_SIZE ) ; - - /** The UNIX "what" string" - blank terminated **/ -strncpy( file_header->what, what_string, WHAT_STRING_SIZE ) ; -if ( strlen(what_string) < WHAT_STRING_SIZE ) -{ - ADFI_blank_fill_string ( file_header->what, WHAT_STRING_SIZE ) ; -} - - /** File creation date/time - blank terminated **/ -ADFI_get_current_date( file_header->creation_date ) ; - - /** File modification date/time - same as creation time **/ -strncpy( file_header->modification_date, file_header->creation_date, - DATE_TIME_SIZE ) ; - -file_header->numeric_format = format ; -file_header->os_size = os_size ; - - /** Set sizeof() information for file data **/ -if( (format==ADF_this_machine_format && os_size==ADF_this_machine_os_size) || - format==NATIVE_FORMAT_CHAR ) -{ - file_header->sizeof_char = sizeof( char ) ; - file_header->sizeof_short = sizeof( short ) ; - file_header->sizeof_int = sizeof( int ) ; - file_header->sizeof_long = sizeof( long ) ; - file_header->sizeof_float = sizeof( float ) ; - file_header->sizeof_double = sizeof( double ) ; - file_header->sizeof_char_p = POINTER_SIZE(char); - file_header->sizeof_short_p = POINTER_SIZE( short ) ; - file_header->sizeof_int_p = POINTER_SIZE( int ) ; - file_header->sizeof_long_p = POINTER_SIZE( long ) ; - file_header->sizeof_float_p = POINTER_SIZE( float ) ; - file_header->sizeof_double_p = POINTER_SIZE( double ) ; -} /** end if **/ -else -{ - switch( EVAL_2_BYTES( format, os_size ) ) { - case EVAL_2_BYTES( 'B', 'L' ): - i = IEEE_BIG_32_FORMAT - 1 ; - break ; - case EVAL_2_BYTES( 'L', 'L' ): - i = IEEE_LITTLE_32_FORMAT - 1 ; - break ; - case EVAL_2_BYTES( 'B', 'B' ): - i = IEEE_BIG_64_FORMAT - 1 ; - break ; - case EVAL_2_BYTES( 'L', 'B' ): - i = IEEE_LITTLE_64_FORMAT - 1 ; - break ; - case EVAL_2_BYTES( 'C', 'B' ): - i = CRAY_FORMAT - 1 ; - break ; - default: - *error_return = MACHINE_FORMAT_NOT_RECOGNIZED ; - return ; - } /* end switch */ - - file_header->sizeof_char = machine_sizes[i][ 0] ; - file_header->sizeof_short = machine_sizes[i][ 3] ; - file_header->sizeof_int = machine_sizes[i][ 5] ; - file_header->sizeof_long = machine_sizes[i][ 7] ; - file_header->sizeof_float = machine_sizes[i][ 9] ; - file_header->sizeof_double = machine_sizes[i][10] ; - file_header->sizeof_char_p = machine_sizes[i][11] ; - file_header->sizeof_short_p = machine_sizes[i][12] ; - file_header->sizeof_int_p = machine_sizes[i][12] ; - file_header->sizeof_long_p = machine_sizes[i][13] ; - file_header->sizeof_float_p = machine_sizes[i][14] ; - file_header->sizeof_double_p = machine_sizes[i][15] ; -} /** end else **/ - - /** Set root node table pointers **/ -file_header->root_node.block = ROOT_NODE_BLOCK ; -file_header->root_node.offset = ROOT_NODE_OFFSET ; -file_header->end_of_file.block = ROOT_NODE_BLOCK ; -file_header->end_of_file.offset = ROOT_NODE_OFFSET + NODE_HEADER_SIZE - 1 ; -file_header->free_chunks.block = FREE_CHUNKS_BLOCK ; -file_header->free_chunks.offset = FREE_CHUNKS_OFFSET ; -ADFI_set_blank_disk_pointer( &file_header->extra ) ; - -} /* end of ADFI_fill_initial_file_header */ -/* end of file ADFI_fill_initial_file_header.c */ -/* file ADFI_fill_initial_free_chunk_table.c */ -/*********************************************************************** -ADFI fill initial free chunk header: - To fill out a new free chunk header. - -output: struct FREE_CHUNK_TABLE *free_chunk_table Resulting header info. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -***********************************************************************/ -void ADFI_fill_initial_free_chunk_table( - struct FREE_CHUNK_TABLE *free_chunk_table, - int *error_return ) -{ - -if( free_chunk_table == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -strncpy( free_chunk_table->start_tag, free_chunk_table_start_tag, TAG_SIZE ) ; -strncpy( free_chunk_table->end_tag, free_chunk_table_end_tag, TAG_SIZE ) ; - - /** Small: First and Last Blocks **/ -ADFI_set_blank_disk_pointer( &free_chunk_table->small_first_block ) ; -ADFI_set_blank_disk_pointer( &free_chunk_table->small_last_block ) ; - - /** Medium: First and Last Blocks **/ -ADFI_set_blank_disk_pointer( &free_chunk_table->medium_first_block ) ; -ADFI_set_blank_disk_pointer( &free_chunk_table->medium_last_block ) ; - - /** large: First and Last Blocks **/ -ADFI_set_blank_disk_pointer( &free_chunk_table->large_first_block ) ; -ADFI_set_blank_disk_pointer( &free_chunk_table->large_last_block ) ; -} /* end of ADFI_fill_initial_free_chunk_table */ -/* end of file ADFI_fill_initial_free_chunk_table.c */ -/* file ADFI_fill_initial_node_header.c */ -/*********************************************************************** -ADFI fill initial node header: - To fill out a new node header. - -output: struct NODE_HEADER *node_header The resulting node header information. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -***********************************************************************/ -void ADFI_fill_initial_node_header( - struct NODE_HEADER *node_header, - int *error_return ) -{ -int i ; - -if( node_header == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -strncpy( node_header->node_start_tag, node_start_tag, TAG_SIZE ) ; -strncpy( node_header->node_end_tag, node_end_tag, TAG_SIZE ) ; - - /** Blank out the name **/ -for( i=0; iname[i] = ' ' ; - - /** Blank out the label **/ -for( i=0; ilabel[i] = ' ' ; - - /** Set number of sub nodes to zero **/ -node_header->num_sub_nodes = 0 ; -node_header->entries_for_sub_nodes = 0 ; -ADFI_set_blank_disk_pointer( &node_header->sub_node_table ) ; - - /** Blank out the Data-Type, then set to eMpTy. **/ -for( i=2; idata_type[i] = ' ' ; -node_header->data_type[0] = 'M' ; -node_header->data_type[1] = 'T' ; - - - /** Zero out number of dimensions & Set dimension values to zero **/ -node_header->number_of_dimensions = 0 ; -for( i=0; idimension_values[i] = 0 ; - - /** Set number of data chunks to zero, zero out data chunk pointer **/ -node_header->number_of_data_chunks = 0 ; -ADFI_set_blank_disk_pointer( &node_header->data_chunks ) ; -} /* end of ADFI_fill_initial_node_header */ -/* end of file ADFI_fill_initial_node_header.c */ -/* file ADFI_flush_buffers.c */ -/*********************************************************************** -ADFI Flush buffers: - -input: const unsigned int file_index The file index. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -ADF_FILE_NOT_OPENED -FWRITE_ERROR -***********************************************************************/ -void ADFI_flush_buffers( - const unsigned int file_index, - int flush_mode, - int *error_return ) -{ -char data; - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; -} /* end if */ - -*error_return = NO_ERROR ; - -if ( (long int) file_index == last_wr_file ) { - /** Flush any active write buffer, file block is set to a nonsense - value so that the buffer flags are not reset **/ - ADFI_write_file ( file_index, MAXIMUM_32_BITS, 0, 0, &data, error_return ) ; - /** Reset control flags **/ - if ( flush_mode == FLUSH_CLOSE ) - last_wr_block = last_wr_file = flush_wr_block = -2 ; -} - -if ( (long int) file_index == last_rd_file && flush_mode == FLUSH_CLOSE ) { - /** Reset control flags **/ - last_rd_block = last_rd_file = num_in_rd_block = -1 ; -} - -} /* end of ADFI_flush_buffers */ -/* end of file ADFI_flush_buffers.c */ - -/*********************************************************************** -ADFI flush caches - Flushes any dirty write buffers to disk and removes buffers - from the specified file from the cache. - -input: const unsigned int file_index File to use. -input: int *error_return Error return - - Possible errors: -NO_ERROR -FSEEK_ERROR -FWRITE_ERROR -***********************************************************************/ -void ADFI_flush_caches( - const unsigned int file_index, - int *error_return ) -{ - FILE *stream = ADF_file[file_index]; - - /* Clear the disk cache. If there are multiple files open, it - will clear their disk cache, too, but that's the price of - simple code... :) */ - clearerr(stream); /* If we had an error, try clearing it to maybe flush - the remaining buffers out */ - *error_return = DC_flush(); - DC_clear( file_index ); -} - -/* file ADFI_fseek_file.c */ -/*********************************************************************** -ADFI_fseek_file: - To position the current position for fread() or fwrite(). - Need to allow for files larger than what a long int can - represent (the offset for fseek). - -input: const unsigned int file_index File to use. -input: const unsigned long file_block Block within the file. -input: const unsigned long block_offset Offset within the block. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -ADF_FILE_NOT_OPENED -FSEEK_ERROR -***********************************************************************/ -void ADFI_fseek_file( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - int *error_return ) -{ -off_t offset ; -int iret ; - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -offset = file_block * DISK_BLOCK_SIZE + block_offset ; -iret = fseeko( ADF_file[ file_index ], offset, SEEK_SET ) ; -if( iret != 0 ) { - *error_return = FSEEK_ERROR ; - return ; - } /* end if */ -} /* end of ADFI_fseek_file */ -/* end of file ADFI_fseek_file.c */ -/* file ADFI_get_current_date.c */ -/*********************************************************************** -ADFI get current date: - Returns the current date and time in a blank-filled character array. - -output: char date[] Current date/time in an array blank-filled - to DATE_TIME_SIZE. Array must be allocated - to at least DATE_TIME_SIZE. No null added. - -***********************************************************************/ -void ADFI_get_current_date( - char date[] ) -{ -time_t ct ; -int i_len ; -char *current_time_p ; - - - /** get the current time **/ -ct = time( (time_t *)NULL ) ; -current_time_p = ctime( &ct ) ; - - /** remove '\n' from ctime format **/ -i_len = strcspn ( current_time_p, "\n" ) ; -strcpy( date, current_time_p ) ; -date[i_len] = '\0' ; - - /** blank fill **/ -ADFI_blank_fill_string ( date, DATE_TIME_SIZE ) ; - -} /* end of ADFI_get_current_date */ -/* end of file ADFI_get_current_date.c */ -/* file ADFI_get_direct_children_ids.c */ -/*********************************************************************** -ADFI get direct children ids: - -Get Children ids of a Node. Return the ids of children nodes directly -associated with a parent node (no links are followed). The ids of the -children are NOT guaranteed to be returned in any particular order. -If it is desired to follow potential links for the node ID, then -call ADFI_chase_link() and pass the resultant link ID to this function. -NOTE: link nodes do not have direct children. - - -ADFI_get_direct_children_ids( ID, num_ids, ids, error_return ) -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *node_block_offset Block & offset in file. -output: int *num_ids The number of ids returned. -output: double **ids An allocated array of ids (free this space). -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -MEMORY_ALLOCATION_FAILED -FILE_INDEX_OUT_OF_RANGE -BLOCK_OFFSET_OUT_OF_RANGE -ADF_FILE_NOT_OPENED -ADF_DISK_TAG_ERROR -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_get_direct_children_ids( - const unsigned int file_index, - const struct DISK_POINTER *node_block_offset, - int *num_ids, - double **ids, - int *error_return ) -{ -int i ; -struct DISK_POINTER sub_node_block_offset ; -struct NODE_HEADER node ; -struct SUB_NODE_TABLE_ENTRY sub_node_table_entry ; - -*error_return = NO_ERROR ; - -if( num_ids == NULL || ids == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -*num_ids = 0 ; -*ids = NULL ; - -ADFI_read_node_header( file_index, node_block_offset, &node, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Check for zero children, return if 0 **/ -if( node.num_sub_nodes == 0 ) { - return ; - } /* end if */ - -*ids = (double *) malloc ( node.num_sub_nodes * sizeof(double) ) ; -if( *ids == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - return ; - } /* end if */ - - /** point to the first child **/ -sub_node_block_offset.block = node.sub_node_table.block ; -sub_node_block_offset.offset = node.sub_node_table.offset + - (TAG_SIZE + DISK_POINTER_SIZE ) ; - - /** Return the ids for all the children **/ -*num_ids = node.num_sub_nodes ; -for( i=0; i< *num_ids; i++ ) { - ADFI_adjust_disk_pointer( &sub_node_block_offset, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Read one sub-node table entry **/ - ADFI_read_sub_node_table_entry( file_index, &sub_node_block_offset, - &sub_node_table_entry, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Get the ID from the sub-node table **/ - ADFI_file_block_offset_2_ID( file_index, - sub_node_table_entry.child_location.block, - sub_node_table_entry.child_location.offset, &(*ids)[i], - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Increment the disk-pointer **/ - sub_node_block_offset.offset += (ADF_NAME_LENGTH + DISK_POINTER_SIZE) ; - } /* end for */ -} -/* end of file ADFI_get_direct_children_ids.c */ -/* file ADFI_get_file_index_from_name.c */ -/*********************************************************************** -ADFI get file index from name: - -Searches file list for given name. Returns file index and Root ID -if name is found in list. - -input: const char *file_name Name of file -output: int *found 1 = name found, 0 = not found -output: unsigned int *file_index File-index -output: double *ID ID of files root node -output: int *error_return Error return -***********************************************************************/ -void ADFI_get_file_index_from_name( - const char *file_name, - int *found, - unsigned int *file_index, - double *ID, - int *error_return ) -{ -double root_ID ; -int i ; - - -*error_return = NO_ERROR ; -*found = 0; - -if( (file_index == NULL) || (ID == NULL) || (found == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_name == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -for( i=0; i 12) ) { - *error_return = BAD_NUMBER_OF_DIMENSIONS ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -offset = 0 ; -accumlated_size = 1 ; -for( i=0; (unsigned)i MAXIMUM_FILES || - index2 < 0 || index2 > MAXIMUM_FILES ) - return(0); - -#if CACHEWRITES - return( ADF_file_info[index1].device == ADF_file_info[index2].device && - ADF_file_info[index1].inode == ADF_file_info[index2].inode ); -#else - return(index1 == index2); -#endif -} - -/* file ADFI_little_endian_32_swap_64.c */ -/*********************************************************************** -ADFI little endian 32 swap 64: - -input: const char from_format Format to convert from. 'B','L','C','N' -input: const char from_os_size Format to convert from. 'B','L' -input: const char to_format Format to convert to. -input: const char to_os_size Format to convert to. 'B','L' -input: const char data_type[2] The type of data to convert. - MT I4 I8 U4 U8 R4 R8 X4 X8 C1 B1 -input: const unsigned long delta_from_bytes Number of from_bytes used. -input: const unsigned long delta_to_bytes Number of to_bytes used. -input: const char *from_data The data to convert from. -output: char *to_data The resulting data. -output: int *error_return Error return. - - Recognized data types: - Machine representations - Type Notation IEEE_BIG IEEE_LITTLE Cray - 32 64 32 64 - No data MT - Integer 32 I4 I4 I4 I4 I4 I8 - Integer 64 I8 -- I8 -- I8 I8 - Unsigned 32 U4 I4 I4 I4 I4 I8 - Unsigned 64 U8 -- I8 -- I8 I8 - Real 32 R4 R4 R4 R4 R4 R8 - Real 64 R8 R8 R8 R8 R8 R8 - Complex 64 X4 R4R4 R4R4 R4R4 R4R4 R8R8 - Complex 128 X8 R8R8 R8R8 R8R8 R8R8 R8R8 - Character (unsigned byte) C1 C1 C1 C1 C1 C1 - Byte (unsigned byte) B1 C1 C1 C1 C1 C1 - -Machine Numeric Formats: -***IEEE_BIG (SGI-Iris Assembly Language Programmer's Guide, pages 1-2, 6-3) -I4: Byte0 Byte1 Byte2 Byte3 - MSB---------------------LSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: sign-bit, 8-bit exponent, 23-bit mantissa - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -Machine Numeric Formats: -***IEEE_LITTLE ( The backwards Big Endian ) -I4: Byte0 Byte1 Byte2 Byte3 - LSB---------------------MSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: 23-bit mantissa, 8-bit exponent, sign-bit - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: 52-bit mantissa, 11-bit exponent, sign-bit - -Note: To convert between these two formats the order of the bytes is reversed -since by definition the Big endian starts at the LSB and goes to the MSB where -the little goes form the MSB to the LSB of the word. -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_little_endian_32_swap_64( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -if ( delta_to_bytes == delta_from_bytes ) { - memcpy( to_data, from_data, delta_from_bytes ) ; - } /* end if */ -else if ( delta_from_bytes < delta_to_bytes ) { - switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - case EVAL_2_BYTES( 'I', '8' ): - if( (from_data[3] & 0x80) == 0x80 ) { /* Negative number */ - to_data[7] = 0xff ; - to_data[6] = 0xff ; - to_data[5] = 0xff ; - to_data[4] = 0xff ; - } /* end if */ - else { - to_data[7] = 0x00 ; - to_data[6] = 0x00 ; - to_data[5] = 0x00 ; - to_data[4] = 0x00 ; - } /* end else */ - to_data[3] = from_data[3] ; - to_data[2] = from_data[2] ; - to_data[1] = from_data[1] ; - to_data[0] = from_data[0] ; - break ; - default: - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ - } /* end else if */ -else { - switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - case EVAL_2_BYTES( 'I', '8' ): - to_data[3] = from_data[3] ; - to_data[2] = from_data[2] ; - to_data[1] = from_data[1] ; - to_data[0] = from_data[0] ; - break ; - default: - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ - } /* end else */ - -} /* end of ADFI_little_endian_32_swap_64 */ -/* end of file ADFI_little_endian_32_swap_64.c */ -/* file ADFI_little_endian_to_cray.c */ -/*********************************************************************** -ADFI little endian to cray: - -input: const char from_format Format to convert from. 'B','L','C','N' -input: const char from_os_size Format to convert from. 'B','L' -input: const char to_format Format to convert to. -input: const char to_os_size Format to convert to. 'B','L' -input: const char data_type[2] The type of data to convert. - MT I4 I8 U4 U8 R4 R8 X4 X8 C1 B1 -input: const unsigned long delta_from_bytes Number of from_bytes used. -input: const unsigned long delta_to_bytes Number of to_bytes used. -input: const char *from_data The data to convert from. -output: char *to_data The resulting data. -output: int *error_return Error return. - - Recognized data types: - Machine representations - Type Notation IEEE_BIG IEEE_LITTLE Cray - 32 64 32 64 - No data MT - Integer 32 I4 I4 I4 I4 I4 I8 - Integer 64 I8 -- I8 -- I8 I8 - Unsigned 32 U4 I4 I4 I4 I4 I8 - Unsigned 64 U8 -- I8 -- I8 I8 - Real 32 R4 R4 R4 R4 R4 R8 - Real 64 R8 R8 R8 R8 R8 R8 - Complex 64 X4 R4R4 R4R4 R4R4 R4R4 R8R8 - Complex 128 X8 R8R8 R8R8 R8R8 R8R8 R8R8 - Character (unsigned byte) C1 C1 C1 C1 C1 C1 - Byte (unsigned byte) B1 C1 C1 C1 C1 C1 - -Machine Numeric Formats: -***IEEE_BIG (SGI-Iris Assembly Language Programmer's Guide, pages 1-2, 6-3) -I4: Byte0 Byte1 Byte2 Byte3 - MSB---------------------LSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: sign-bit, 8-bit exponent, 23-bit mantissa - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -***Cray (Cray CFT77 Reference Manual, pages G-1 G-2) -I8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - MSB-----------------------------------------------------LSB -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, exponent-sign, 14-bit exponent, 48-bit mantissa -Note: Exponent sign: 1 in this bits indicates a positive exponent sign, - thus bit 62 is the inverse of bit 61 (the sign in the exponent). - The exception to this is a zero, in which all 64 bits are zero! - The interpreation of the floating-point number is: - >>> .mantissia(fraction) X 2^exponent. <<< - The mantissia is left justified (the leftmost bit is a 1). - This MUST be done! - -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_little_endian_to_cray( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ -int i, exp ; - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - - case EVAL_2_BYTES( 'M', 'T' ): - *error_return = NO_DATA ; - return ; - - case EVAL_2_BYTES( 'C', '1' ): - case EVAL_2_BYTES( 'B', '1' ): - to_data[0] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'I', '4' ): - if( (from_data[3] & 0x80) == 0x80 ) { /* Negative number */ - to_data[0] = 0xff ; - to_data[1] = 0xff ; - to_data[2] = 0xff ; - to_data[3] = 0xff ; - } /* end if */ - else { - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - } /* end else */ - to_data[4] = from_data[3] ; - to_data[5] = from_data[2] ; - to_data[6] = from_data[1] ; - to_data[7] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'U', '4' ): - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - to_data[4] = from_data[3] ; - to_data[5] = from_data[2] ; - to_data[6] = from_data[1] ; - to_data[7] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'I', '8' ): - if( (from_data[3] & 0x80) == 0x80 ) { /* Negative number */ - to_data[0] = 0xff ; - to_data[1] = 0xff ; - to_data[2] = 0xff ; - to_data[3] = 0xff ; - } /* end if */ - else { - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - } /* end else */ - for( i=0; i<(int)delta_from_bytes; i++ ) - to_data[8-delta_from_bytes+i] = from_data[delta_from_bytes-1-i] ; - break ; - - case EVAL_2_BYTES( 'U', '8' ): - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - for( i=0; i<(int)delta_from_bytes; i++ ) - to_data[8-delta_from_bytes+i] = from_data[delta_from_bytes-1-i] ; - break ; - - case EVAL_2_BYTES( 'R', '4' ): - for( i=0; i<8; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[3] == 0x00) && (from_data[2] == 0x00) && - (from_data[1] == 0x00) && (from_data[0] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[0] = from_data[3] & 0x80 ; - - /** Convert the exponent **/ - /** 8 bits to 14 bits. Sign extent from 8 to 14 **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = (from_data[3] & 0x3f) << 1 ; - if( (from_data[2] & 0x80) == 0x80 ) - exp += 1 ; - if( (from_data[3] & 0x40) == 0x00 ) /* set sign */ - exp -= 128 ; - exp += 2 ; - - to_data[1] = exp & 0xff ; - if( exp < 0 ) - to_data[0] |= 0x3f ; /* exponent sign 0, sign extend exponent */ - else - to_data[0] |= 0x40 ; /* exponent sign 1 */ - - /** Convert the mantissia **/ - /** 23 bits to 48 bits. Left shift 25 bits, zero fill **/ - to_data[2] = from_data[2] | 0x80 ; - to_data[3] = from_data[1] ; - to_data[4] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'R', '8' ): - for( i=0; i<8; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[7] == 0x00) && (from_data[6] == 0x00) && - (from_data[5] == 0x00) && (from_data[4] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[0] = from_data[7] & 0x80 ; - - /** Convert the exponent **/ - /** 11 bits to 14 bits. Sign extent from 11 to 14 **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = ((from_data[7] & 0x3f) << 4) + ((from_data[6]>>4)&0x0f) ; - - if( (from_data[7] & 0x40) == 0x00 ) /* set sign */ - exp -= 1024 ; - exp += 2 ; - - to_data[1] = (unsigned int)(exp & 0xff) ; - to_data[0] |= ((exp>>8) & 0x03) ; - if( exp < 0 ) - to_data[0] |= 0x3c ; /* exponent sign 0, sign extend exponent */ - else - to_data[0] |= 0x40 ; /* exponent sign 1 */ - - /** Convert the mantissia **/ - /** 52 bits to 48 bits. Use 48, drop last 4 bits **/ - to_data[2] = 0x80 | ((from_data[6]<<3)&0x78) | - ((from_data[5]>>5)&0x07) ; - for( i=3; i<8; i++ ) - to_data[i] = ((from_data[7-i+1]<<3)&0xF8) | - ((from_data[7-i]>>5)&0x07) ; -#ifdef PRINT_STUFF -printf("from:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", from_data[i] ) ; -printf("to:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", to_data[i] ) ; -printf("\n" ) ; -#endif - break ; - - case EVAL_2_BYTES( 'X', '4' ): - ADFI_little_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_little_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, &from_data[4], &to_data[8], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - case EVAL_2_BYTES( 'X', '8' ): - ADFI_little_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_little_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, &from_data[8], &to_data[8], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - default: - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ -} /* end of ADFI_little_endian_to_cray */ -/* end of file ADFI_little_endian_to_cray.c */ -/* file ADFI_open_file.c */ -/*********************************************************************** -ADFI open file: - - Track the files used by index. - Also track which files are within a given system so a close for - the system can close all related files. - -input: const char *file The filename to open. -input: const char *status The status in which to open the file. - Allowable values are: - READ_ONLY - File must exist. Writing NOT allowed. - OLD - File must exist. Reading and writing allowed. - NEW - File must not exist. - SCRATCH - New file. Filename is ignored. - UNKNOWN - OLD if file exists, else NEW is used. -input: const int top_file_index -1 if this is the top file. -output: unsigned int *file_index Returned index of the file. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -TOO_MANY_ADF_FILES_OPENED -ADF_FILE_STATUS_NOT_RECOGNIZED -FILE_OPEN_ERROR -***********************************************************************/ -void ADFI_open_file( - const char *file, - const char *status, - const int top_file_index, - unsigned int *file_index, - int *error_return ) -{ -int index ; -FILE *f_ret ; -#if CACHEWRITES && !kUsePathsForUniqueness -struct stat info; -#endif - -if( (status == NULL) || - ((file == NULL) && (ADFI_stridx_c( status, "SCRATCH" ) != 0) ) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_index == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -/* Flush buffers just in case we are open the same file again and - any of the buffers contain information without which we could not - successfully open the file again. */ -if (last_wr_file >= 0) - ADFI_flush_buffers(last_wr_file, FLUSH_CLOSE, error_return); -DC_flush(); - -/* Initialize the priority satck if it has not been done */ -if (STACK_INIT==-1) ADFI_stack_control(0,0,0,INIT_STK,0,0,NULL); - -for( index=0; index= MAXIMUM_FILES ) { - *error_return = TOO_MANY_ADF_FILES_OPENED ; - return ; - } /* end if */ - -ADF_file_format[index] = UNDEFINED_FORMAT ; -ADF_file_os_size[index] = UNDEFINED_FORMAT ; - -/*** - READ_ONLY - File must exist. Writing NOT allowed. - OLD - File must exist. Reading and writing allowed. - NEW - File must not exist. - SCRATCH - New file. Filename is ignored. - UNKNOWN - OLD if file exists, else NEW is used. -***/ -#if defined(_WIN32) && !defined(__WIN32_BINARY__) - _fmode = O_BINARY ; -#endif -if( ADFI_stridx_c( status, "READ_ONLY" ) == 0 ) { -#if defined(_WIN32) && defined(__WIN32_BINARY__) - f_ret = fopen( file, "rb" ) ; /** Open for reading **/ -#else - f_ret = fopen( file, "r" ) ; /** Open for reading **/ -#endif - } /* end if */ -else if( ADFI_stridx_c( status, "OLD" ) == 0 ) { -#if defined(_WIN32) && defined(__WIN32_BINARY__) - f_ret = fopen( file, "rb+" ) ; /** Open for both reading & writing **/ -#else - f_ret = fopen( file, "r+" ) ; /** Open for both reading & writing **/ -#endif - } /* end else if */ -else if( ADFI_stridx_c( status, "NEW" ) == 0 ) { -#if defined(_WIN32) && defined(__WIN32_BINARY__) - f_ret = fopen( file, "wb+" ) ; /** open new file, or truncate old file */ -#else - f_ret = fopen( file, "w+" ) ; /** open new file, or truncate old file */ -#endif - } /* end else if */ -else if( ADFI_stridx_c( status, "SCRATCH" ) == 0 ) { - f_ret = tmpfile(); - } /* end else if */ -else if( ADFI_stridx_c( status, "UNKNOWN" ) == 0 ) { -#if defined(_WIN32) && defined(__WIN32_BINARY__) - f_ret = fopen( file, "ab+" ) ; /** open new, or use existing file **/ -#else - f_ret = fopen( file, "a+" ) ; /** open new, or use existing file **/ -#endif - } /* end else if */ -else { - *error_return = ADF_FILE_STATUS_NOT_RECOGNIZED ; - goto Error_Exit ; - } /* end else */ - -if( f_ret == NULL ) { - *error_return = FILE_OPEN_ERROR ; - goto Error_Exit ; - } /* end if */ - -file_in_use[ index ] = 1 ; -first_file_in_system[ index ] = top_file_index ; -ADF_file[ index ] = f_ret ; -file_version_update[ index ][ 0 ] = '\0' ; -*file_index = index ; -sprintf( file_open_mode[index], "%s", status ) ; -if( ADFI_stridx_c( status, "SCRATCH" ) == 0 ) { - names_of_files[index][0] = '\0' ; - } /* end if */ -else { - sprintf( names_of_files[index], "%s", file ) ; - } /* end else */ - -#if CACHEWRITES -#if kUsePathsForUniqueness -{ - int i, size, first_free = -1; - char *path; -#if defined(_WIN32) -{ - /** Note: since some of the ADF errors conflict with Windows' errors - (namely NO_ERROR and NO_DATA), comparing the results of GetLastError(), - should it be used in the future, should not be done against these - errors. */ - char *short_path; - - size = GetFullPathNameA(file, 0, NULL, NULL); - short_path = (char *)malloc(size * sizeof(char)); /* Size includes the \0 */ - GetFullPathNameA(file, size, short_path, NULL); - size = GetLongPathNameA(short_path, NULL, 0); - path = (char *)malloc((size + 1) * sizeof(char)); /* Size does not include - the \0 this time */ - GetLongPathNameA(short_path, path, size); - free(short_path); -} -#else -/* A Unix implementation is included for completeness. However, Unix should - really have kUsePathsForUniqueness defined to 0, so that the stat() command - is used, particularly since realpath() has a potential buffer overflow. */ - char *dir = "", *tmppath, real_path[16000]; - - if (file[0] == '/') - tmppath = strdup(file); - else { - size = 4096; - dir = (char *)malloc(size * sizeof(char)); - while (!getcwd(dir, size)) { - free(dir); - size += 4096; - dir = (char *)malloc(size * sizeof(char)); - } - tmppath = (char *)malloc((strlen(dir) + strlen(file) + 3) * sizeof(char)); - sprintf(tmppath, "%s/%s", dir, file); - free(dir); - } - - if (!realpath(tmppath, real_path)) - path = tmppath; - else { - path = strdup(real_path); - free(tmppath); - } -#endif /* WIN32 */ - - for (i = 0; i < MAXIMUM_FILES; ++i) { - if (first_free == -1 && ADF_file_paths[i].count == 0) - first_free = i; - if (ADF_file_paths[i].count > 0 && - strcmp(path, ADF_file_paths[i].path) == 0) - break; - } - if (i < MAXIMUM_FILES) { - ADF_file_paths[i].count++; - ADF_file_info[index].device = i; - free(path); - } - else { - ADF_file_info[index].device = first_free; - ADF_file_paths[first_free].path = path; - ADF_file_paths[first_free].count = 1; - } - ADF_file_info[index].inode = 0; -} -#else -fstat( fileno( f_ret ), &info ) ; -ADF_file_info[index].device = info.st_dev; -ADF_file_info[index].inode = info.st_ino; -#endif /* kUsePathsForUniqueness */ -#endif /* CACHEWRITES */ - -return ; - -Error_Exit: - /** Clear this file's entry **/ -if( ADF_file[ index ] != 0 ) { - if( fclose( ADF_file[ index ] ) != 0 ) - *error_return = FILE_CLOSE_ERROR ; - } /* end if */ -file_in_use[ index ] = 0 ; -first_file_in_system[ index ] = -1 ; -ADF_file[ index ] = NULL ; -file_version_update[ index ][ 0 ] = '\0' ; - -} /* end of ADFI_open_file */ -/* end of file ADFI_open_file.c */ -/* file ADFI_read_chunk_length.c */ -/*********************************************************************** -ADFI read chunk length: - Read the header of the chunk. If it is a variable sized - chunk, then the first 2 things in is are: - Tag, and pointer to end_of_chunk-tag - If NOT variable, then determine what type of chunk it is - and return a pointer to the end_of_chunk-tag: - - If the incomming pointers are 0 0, then we are looking - at the file header. - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -output: char tag[TAG_SIZE] The tag from the chunk. -output: struct DISK_POINTER *end_of_chunk_tag End of chunk. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ - -void ADFI_read_chunk_length( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - char tag[TAG_SIZE+1], - struct DISK_POINTER *end_of_chunk_tag, - int *error_return ) -{ -char info[ TAG_SIZE + DISK_POINTER_SIZE ] ; -struct DISK_POINTER current_block_offset ; -unsigned long count ; - -if( (block_offset == NULL) || (end_of_chunk_tag == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( tag == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -end_of_chunk_tag->block = 0 ; -end_of_chunk_tag->offset = 0 ; - - /** File Header **/ -if( (block_offset->block == 0) && (block_offset->offset == 0) ) { - - /** point to end-tag **/ - end_of_chunk_tag->offset = FILE_HEADER_SIZE - TAG_SIZE ; - tag[0] = file_header_tags[0][0] ; - tag[1] = file_header_tags[0][1] ; - tag[2] = file_header_tags[0][2] ; - tag[3] = file_header_tags[0][3] ; - } /* end if */ - - /** Free-Chunk Table **/ -else if( (block_offset->block == 0) && - (block_offset->offset == FREE_CHUNKS_OFFSET) ) { - - /** point to end-tag **/ - end_of_chunk_tag->offset = - (FREE_CHUNKS_OFFSET + FREE_CHUNK_TABLE_SIZE) - TAG_SIZE ; - tag[0] = free_chunk_table_start_tag[0] ; - tag[1] = free_chunk_table_start_tag[1] ; - tag[2] = free_chunk_table_start_tag[2] ; - tag[3] = free_chunk_table_start_tag[3] ; - } /* end if */ -else { - - /** Check for 'z's in the file. This is free-data, too small - to include tags and pointers - **/ - count = 0 ; - ADFI_read_file( file_index, block_offset->block, block_offset->offset, - 1, info, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - if( info[0] == 'z' ) { - current_block_offset.block = block_offset->block ; - current_block_offset.offset = block_offset->offset ; - while( info[0] == 'z' ) { - count++ ; - current_block_offset.offset++ ; - ADFI_adjust_disk_pointer( ¤t_block_offset, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - info[0] = '\0' ; - ADFI_read_file( file_index, current_block_offset.block, - current_block_offset.offset, 1, info, error_return ) ; - if( (*error_return == FSEEK_ERROR) || (*error_return == FREAD_ERROR)){ - break ; - } /* end if */ - if( *error_return != NO_ERROR ) - return ; - } /* end while */ - end_of_chunk_tag->block = block_offset->block ; - end_of_chunk_tag->offset = block_offset->offset + count - TAG_SIZE ; - ADFI_adjust_disk_pointer( end_of_chunk_tag, error_return ) ; - tag[0] = tag[1] = tag[2] = tag[3] = 'z' ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - else { - /** Read TAG and disk_pointer **/ - ADFI_read_file( file_index, block_offset->block, block_offset->offset, - TAG_SIZE + DISK_POINTER_SIZE, info, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /* Copy the tag **/ - tag[0] = info[0] ; - tag[1] = info[1] ; - tag[2] = info[2] ; - tag[3] = info[3] ; - tag[4] = '\0' ; - - /** Check for known tags **/ - if( ADFI_stridx_c( tag, node_start_tag ) == 0 ) { /** Node **/ - end_of_chunk_tag->block = block_offset->block ; - end_of_chunk_tag->offset = block_offset->offset + - NODE_HEADER_SIZE - TAG_SIZE ; - ADFI_adjust_disk_pointer( end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - else { - - /** Convert pointers into numeric form **/ - ADFI_disk_pointer_from_ASCII_Hex( &info[TAG_SIZE], - &info[DISK_POINTER_SIZE], end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - } /* end else */ - } /* end else */ - -} /* end of ADFI_read_chunk_length */ -/* end of file ADFI_read_chunk_length.c */ -/* file ADFI_read_data_chunk.c */ -/*********************************************************************** -ADFI read data chunk: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const char *data_type The defined datatype. -input: const int data_size Size of data entity in bytes. -input: const long chunk_bytes Number of bytes in data chunk. -input: const long start_offset Starting offset into the data chunk -input: const long total_bytes Number of bytes to read in data chunk. -output: char *data Pointer to the resulting data. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_DISK_TAG_ERROR -REQUESTED_DATA_TOO_LONG -***********************************************************************/ -void ADFI_read_data_chunk( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct TOKENIZED_DATA_TYPE *tokenized_data_type, - const int data_size, - const long chunk_bytes, - const long start_offset, - const long total_bytes, - char *data, - int *error_return ) -{ -int format_compare ; -char tag[TAG_SIZE + 1] ; -struct DISK_POINTER data_start, end_of_chunk_tag ; -long chunk_total_bytes ; - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (tokenized_data_type == NULL) || (data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -if( total_bytes+start_offset > chunk_bytes ) { - *error_return = REQUESTED_DATA_TOO_LONG ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Get tag and chunk length **/ -ADFI_read_chunk_length( file_index, block_offset, tag, &end_of_chunk_tag, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; -tag[TAG_SIZE] = '\0' ; - - /** Check start-of-chunk tag **/ -if( ADFI_stridx_c( tag, data_chunk_start_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - - /** Check end-of-chunk tag **/ -ADFI_read_file( file_index, end_of_chunk_tag.block, end_of_chunk_tag.offset, - TAG_SIZE, tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -tag[TAG_SIZE] = '\0' ; - -if( ADFI_stridx_c( tag, data_chunk_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - - /** Point to the start of the data **/ -data_start.block = block_offset->block ; -data_start.offset = block_offset->offset + start_offset + - DISK_POINTER_SIZE + TAG_SIZE ; -ADFI_adjust_disk_pointer( &data_start, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** calculate the total number of data bytes **/ -chunk_total_bytes = end_of_chunk_tag.offset - data_start.offset + start_offset - + (end_of_chunk_tag.block - data_start.block) * DISK_BLOCK_SIZE ; -if( chunk_bytes > chunk_total_bytes ) { - *error_return = REQUESTED_DATA_TOO_LONG ; - return ; - } /* end if */ -else { - if( chunk_bytes < chunk_total_bytes ) - *error_return = REQUESTED_DATA_TOO_LONG ; - - /** check for need of data translation **/ - ADFI_file_and_machine_compare( file_index, tokenized_data_type, - &format_compare, error_return ); - if( *error_return != NO_ERROR ) - return ; - if( format_compare == 1 ) { - /** Read the data off of disk **/ - ADFI_read_file( file_index, data_start.block, data_start.offset, - total_bytes, data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - else { - ADFI_read_data_translated( file_index, data_start.block, - data_start.offset, tokenized_data_type, data_size, - total_bytes, data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - } /* end else */ - -} /* end of ADFI_read_data_chunk */ -/* end of file ADFI_read_data_chunk.c */ -/* file ADFI_read_data_chunk_table.c */ -/*********************************************************************** -ADFI read data chunk table: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -output: struct DATA_CHUNK_TABLE_ENTRY data_chunk_table[] Array of DC entries. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_read_data_chunk_table( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct DATA_CHUNK_TABLE_ENTRY data_chunk_table[], - int *error_return ) -{ -char tag[ TAG_SIZE + 1 ] ; -struct DISK_POINTER end_of_chunk_tag, tmp_block_offset ; -unsigned int i, number_of_bytes_to_read ; - -if( (block_offset == NULL) || (data_chunk_table == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - /** Get the tag and the length **/ -ADFI_read_chunk_length( file_index, block_offset, tag, - &end_of_chunk_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -tag[TAG_SIZE] = '\0' ; - - /** Compare the start tag **/ -if( ADFI_stridx_c( tag, data_chunk_table_start_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - -number_of_bytes_to_read = - (end_of_chunk_tag.block - block_offset->block) * DISK_BLOCK_SIZE + - (end_of_chunk_tag.offset - block_offset->offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - - /** Read the data from disk **/ -tmp_block_offset.block = block_offset->block ; -tmp_block_offset.offset = block_offset->offset + TAG_SIZE ; - -for( i=0; i number_of_data_elements ) { - chunk_size -= ( number_of_elements_read - number_of_data_elements ) ; - delta_from_bytes = chunk_size * data_size ; - delta_to_bytes = chunk_size * machine_size ; - } - ADFI_read_file( file_index, disk_pointer.block, disk_pointer.offset, - delta_from_bytes, (char *)from_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - ADFI_convert_number_format( - ADF_file_format[file_index], /* from format */ - ADF_file_os_size[file_index], /* from os size */ - ADF_this_machine_format, /* to format */ - ADF_this_machine_os_size, /* to os size */ - FROM_FILE_FORMAT, - tokenized_data_type, chunk_size, from_data, - to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - to_data += delta_to_bytes ; - disk_pointer.offset += delta_from_bytes ; - if ( disk_pointer.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &disk_pointer, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - } /* end while */ - -} /* end of ADFI_read_data_translated */ -/* end of file ADFI_read_data_translated.c */ -/* file ADFI_read_disk_block.c */ -/*********************************************************************** -ADFI read disk block: - - Possible errors: -NO_ERROR -***********************************************************************/ -void ADFI_read_disk_block() -{ -fprintf(stderr,"Subroutine ADFI_read_disk_block is not yet implemented...\n" ) ; -} /* end of ADFI_read_disk_block */ -/* end of file ADFI_read_disk_block.c */ -/* file ADFI_read_disk_pointer_from_disk.c */ -/*********************************************************************** -ADFI read disk pointer from disk: - Given a pointer to a disk pointer, read it from disk and convert - it into numeric form. - -input: const unsigned int file_index File to read from. -input: const unsigned long file_block Block within the file. -input: const unsigned long block_offset Offset within the block. -output: struct DISK_POINTER *block_and_offset Resulting disk pointer. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_read_disk_pointer_from_disk( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - struct DISK_POINTER *block_and_offset, - int *error_return ) -{ -char disk_block_offset[DISK_POINTER_SIZE] ; - -if( block_and_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( block_offset > DISK_BLOCK_SIZE ) { - *error_return = BLOCK_OFFSET_OUT_OF_RANGE ; - return ; - } /* end if */ - - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check the stack for block/offset **/ -#if 0 -if ( ADFI_stack_control(file_index, file_block, block_offset, - GET_STK, DISK_PTR_STK, - DISK_POINTER_SIZE, disk_block_offset ) != NO_ERROR ) { -#endif - - /** Get the block/offset from disk **/ - ADFI_read_file( file_index, file_block, block_offset, - DISK_POINTER_SIZE, disk_block_offset, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Set the block/offset onto the stack **/ -#if 0 - ADFI_stack_control(file_index, file_block, block_offset, - SET_STK, DISK_PTR_STK, - DISK_POINTER_SIZE, disk_block_offset ); -} /* end if */ -#endif - - /** Convert into numeric form **/ -ADFI_disk_pointer_from_ASCII_Hex( &disk_block_offset[0], &disk_block_offset[8], - block_and_offset, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -} /* end of ADFI_read_disk_pointer_from_disk */ -/* end of file ADFI_read_disk_pointer_from_disk.c */ -/* file ADFI_read_file.c */ -/*********************************************************************** -ADFI read file: - Read a number of bytes from an open ADF file from a given - file, block, and offset. Buffering is done in an attempt to - improve performance of repeatedly reading small pieces of - contiguous data. Note: read buffering also affects the - write function, i.e, all writes must reset the read buffer. - -input: const unsigned int file_index File to read from. -input: const unsigned long file_block Block within the file. -input: const unsigned long block_offset Offset within the block. -input: const unsigned int data_length Length of the data to read. -input: char *data Address of the data. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -FREAD_ERROR -***********************************************************************/ -void ADFI_read_file( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - const unsigned int data_length, - char *data, - int *error_return ) -{ -int iret ; - - -if( data == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** No need to buffer large pieces of data or to take special - measures to cross block boundaries **/ - -if( data_length + block_offset > DISK_BLOCK_SIZE ) { - - /** We'd better flush the cache before we read, otherwise we will - get bogus data if our read overlaps with a cached block. **/ - DC_flush_range(file_index, file_block, file_block + (block_offset + data_length) / DISK_BLOCK_SIZE); - - /** Position the file **/ - ADFI_fseek_file( file_index, file_block, block_offset, error_return ) ; - if( *error_return != NO_ERROR ) { - return ; - } /* end if */ - - /** Read the data from disk **/ - iret = fread( data, 1, data_length, ADF_file[ file_index ] ) ; - if( iret != (int)data_length ) { - *error_return = FREAD_ERROR ; - return ; - } /* end if */ - - return; -} /* end if */ - - /** For smaller pieces of data, read a block at a time. This will improve - performance if neighboring data is requested a small piece at a time - (strided reads, file overhead). - - Some assumptions apply to the block size. With some experimenting, - 1K blocks do not offer much improvement. 4K blocks (4096 bytes) - do improve performance remarkably. This is due to the fact that the - file structure is based of 4K blocks with offsets. - **/ - -if( num_in_rd_block < DISK_BLOCK_SIZE || /*- buffer is not full -*/ - (long int) file_block != last_rd_block || /*- a different block -*/ - (long int) file_index != last_rd_file ) { /*- entirely different file -*/ - - /** buffer is not current, re-read **/ - - if ( (long int) file_block == last_wr_block && - ADFI_is_same_file( file_index, last_wr_file ) ) { - - /* Copy data from write buffer */ - memcpy( rd_block_buffer, wr_block_buffer, DISK_BLOCK_SIZE ); - iret = DISK_BLOCK_SIZE; - } - else { - - if ( !DC_get_block( file_index, file_block, rd_block_buffer ) ) { - - /** Position the file **/ - ADFI_fseek_file( file_index, file_block, 0, error_return ) ; - if( *error_return != NO_ERROR ) { - - return ; - } /* end if */ - - /** Read the data from disk **/ - iret = fread( rd_block_buffer, 1, DISK_BLOCK_SIZE, ADF_file[ file_index ] ) ; - if( iret == EOF || iret == 0 ) { - *error_return = FREAD_ERROR ; - - return ; - } /* end if */ - DC_add_block(file_index, file_block, 0, rd_block_buffer, error_return); - } - else - iret = DISK_BLOCK_SIZE; - - } /* end if */ - - /** Remember buffer information **/ - last_rd_block = file_block ; - last_rd_file = file_index ; - num_in_rd_block = iret ; - -} /* end if */ - - /*read from buffer*/ -memcpy( data, &rd_block_buffer[block_offset], data_length ); - -} /* end of ADFI_read_file */ -/* end of file ADFI_read_file.c */ -/* file ADFI_read_file_header.c */ -/*********************************************************************** -ADFI read file header: - -input: const unsigned int file_index The file index. -output: struct FILE_HEADER *file_header Pointer to a file-header struct. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_read_file_header( - const unsigned int file_index, - struct FILE_HEADER *file_header, - int *error_return ) -{ -char disk_header[ FILE_HEADER_SIZE ] ; - -if( file_header == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check the stack for header **/ -if ( ADFI_stack_control(file_index, 0, 0, GET_STK, FILE_STK, - FILE_HEADER_SIZE, disk_header ) != NO_ERROR ) { - - /** Read in the header into memory **/ - ADFI_read_file( file_index, 0, 0, FILE_HEADER_SIZE, disk_header, - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Check memory tags for proper data **/ - if( strncmp( &disk_header[32], file_header_tags[0], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - - if( strncmp( &disk_header[64], file_header_tags[1], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - - if( strncmp( &disk_header[96], file_header_tags[2], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - - if( strncmp( &disk_header[102], file_header_tags[3], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - - if( strncmp( &disk_header[130], file_header_tags[4], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - - if( strncmp( &disk_header[182], file_header_tags[5], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - - /** Set the header onto the stack **/ - ADFI_stack_control(file_index, 0, 0, SET_STK, FILE_STK, - FILE_HEADER_SIZE, disk_header ); -} /* end if */ - -/** OK the memory tags look good, let's convert disk-formatted header - into memory **/ -strncpy( (char *)file_header->what, &disk_header[ 0], 32 ) ; -strncpy( (char *)file_header->tag0, &disk_header[ 32], TAG_SIZE ) ; -strncpy( (char *)file_header->creation_date, &disk_header[ 36], DATE_TIME_SIZE); -strncpy( (char *)file_header->tag1, &disk_header[ 64], TAG_SIZE ) ; -strncpy( (char *)file_header->modification_date, &disk_header[ 68], - DATE_TIME_SIZE ) ; -strncpy( (char *)file_header->tag2, &disk_header[ 96], TAG_SIZE ) ; -file_header->numeric_format = disk_header[100] ; -file_header->os_size = disk_header[101] ; -strncpy( (char *)file_header->tag3, &disk_header[102], TAG_SIZE ) ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[106], - &file_header->sizeof_char, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[108], - &file_header->sizeof_short, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[110], - &file_header->sizeof_int, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[112], - &file_header->sizeof_long, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[114], - &file_header->sizeof_float, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[116], - &file_header->sizeof_double, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[118], - &file_header->sizeof_char_p, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[120], - &file_header->sizeof_short_p, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[122], - &file_header->sizeof_int_p, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[124], - &file_header->sizeof_long_p, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[126], - &file_header->sizeof_float_p, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[128], - &file_header->sizeof_double_p, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -strncpy( file_header->tag4, &disk_header[130], TAG_SIZE ) ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_header[134], &disk_header[142], - &file_header->root_node, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_header[146], &disk_header[154], - &file_header->end_of_file, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_header[158], &disk_header[166], - &file_header->free_chunks, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_header[170], &disk_header[178], - &file_header->extra, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -strncpy( file_header->tag5, &disk_header[182], TAG_SIZE ) ; - - - /** Check memory tags for proper data **/ -if( strncmp( file_header->tag0, file_header_tags[0], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag1, file_header_tags[1], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag2, file_header_tags[2], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag3, file_header_tags[3], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag4, file_header_tags[4], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag5, file_header_tags[5], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -} /* end of ADFI_read_file_header */ -/* end of file ADFI_read_file_header.c */ -/* file ADFI_read_free_chunk.c */ -/*********************************************************************** -ADFI read free chunk: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -output: struct DISK_POINTER *end_of_chunk_tag End of free chunk tag. -output: struct DISK_POINTER *next_chunk Next free chunk in list. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_DISK_TAG_ERROR -***********************************************************************/ -void ADFI_read_free_chunk( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct FREE_CHUNK *free_chunk, - int *error_return ) -{ -char tag[TAG_SIZE + 1] ; -struct DISK_POINTER chunk_block_offset ; - -if( (block_offset == NULL) || (free_chunk == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Get the tag and the length **/ -ADFI_read_chunk_length( file_index, block_offset, tag, - &(free_chunk->end_of_chunk_tag), error_return ) ; -if( *error_return != NO_ERROR ) - return ; -tag[TAG_SIZE] = '\0' ; - - /** Compare the start tag **/ -if( ADFI_stridx_c( tag, free_chunk_start_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - - /** Set block offset to the start of the chunk **/ - -chunk_block_offset = *block_offset ; -chunk_block_offset.offset += TAG_SIZE + DISK_POINTER_SIZE ; -ADFI_adjust_disk_pointer( &chunk_block_offset, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Read the data from disk **/ - -ADFI_read_disk_pointer_from_disk( file_index, chunk_block_offset.block, - chunk_block_offset.offset, &(free_chunk->next_chunk), error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_read_file( file_index, free_chunk->end_of_chunk_tag.block, - free_chunk->end_of_chunk_tag.offset, TAG_SIZE, tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Compare the end tag **/ -if( ADFI_stridx_c( tag, free_chunk_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - -strncpy( free_chunk->start_tag, free_chunk_start_tag, 4 ) ; -strncpy( free_chunk->end_tag, free_chunk_end_tag, 4 ) ; -} /* end of ADFI_read_free_chunk */ -/* end of file ADFI_read_free_chunk.c */ -/* file ADFI_read_free_chunk_table.c */ -/*********************************************************************** -ADFI read free chunk table: - -input: const unsigned int file_index The file index. -output: struct FREE_CHUNK_TABLE *free_chunk_table Pointer to table. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_DISK_TAG_ERROR -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_read_free_chunk_table( - const unsigned int file_index, - struct FREE_CHUNK_TABLE *free_chunk_table, - int *error_return ) -{ -char disk_free_chunk_data[ FREE_CHUNK_TABLE_SIZE ] ; - -if( free_chunk_table == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check the stack for free chunk **/ -if ( ADFI_stack_control(file_index, FREE_CHUNKS_BLOCK, FREE_CHUNKS_OFFSET, - GET_STK, FREE_CHUNK_STK, FREE_CHUNK_TABLE_SIZE, - disk_free_chunk_data ) != NO_ERROR ) { - - /** Read the free-chunk table off of disk **/ - ADFI_read_file( file_index, FREE_CHUNKS_BLOCK, FREE_CHUNKS_OFFSET, - FREE_CHUNK_TABLE_SIZE, disk_free_chunk_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Check disk tags **/ - if( ADFI_stridx_c( &disk_free_chunk_data[0], free_chunk_table_start_tag ) != - 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end of */ - - if( ADFI_stridx_c( &disk_free_chunk_data[FREE_CHUNK_TABLE_SIZE - TAG_SIZE], - free_chunk_table_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end of */ - - /** Set the free chunk onto the stack **/ - ADFI_stack_control(file_index, FREE_CHUNKS_BLOCK, FREE_CHUNKS_OFFSET, - SET_STK, FREE_CHUNK_STK, FREE_CHUNK_TABLE_SIZE, - disk_free_chunk_data ); -} /* end if */ - - /** Convert into memory **/ -strncpy( (char *)free_chunk_table->start_tag, &disk_free_chunk_data[ 0], - TAG_SIZE ) ; -strncpy( (char *)free_chunk_table->end_tag, - &disk_free_chunk_data[ FREE_CHUNK_TABLE_SIZE - TAG_SIZE ], TAG_SIZE ) ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_free_chunk_data[ TAG_SIZE], - &disk_free_chunk_data[DISK_POINTER_SIZE], - &free_chunk_table->small_first_block, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_free_chunk_data[16], - &disk_free_chunk_data[24], &free_chunk_table->small_last_block, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_free_chunk_data[28], - &disk_free_chunk_data[36], &free_chunk_table->medium_first_block, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_free_chunk_data[40], - &disk_free_chunk_data[48], &free_chunk_table->medium_last_block, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_free_chunk_data[52], - &disk_free_chunk_data[60], &free_chunk_table->large_first_block, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_free_chunk_data[64], - &disk_free_chunk_data[72], &free_chunk_table->large_last_block, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Check memory tags **/ -if( ADFI_stridx_c( free_chunk_table->start_tag, free_chunk_table_start_tag ) - != 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end of */ - -if( ADFI_stridx_c( free_chunk_table->end_tag, free_chunk_table_end_tag ) - != 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end of */ - -} /* end of ADFI_read_free_chunk_table */ -/* end of file ADFI_read_free_chunk_table.c */ -/* file ADFI_read_node_header.c */ -/*********************************************************************** -ADFI read node header: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -output: struct NODE_HEADER *node_header Pointer to node header. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_DISK_TAG_ERROR -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_read_node_header( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct NODE_HEADER *node_header, - int *error_return ) -{ -char disk_node_data[ NODE_HEADER_SIZE ] ; -int i ; - -if( (block_offset == NULL) || (node_header == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check the stack for header **/ -if ( ADFI_stack_control(file_index, block_offset->block, block_offset->offset, - GET_STK, NODE_STK, NODE_HEADER_SIZE, - disk_node_data ) != NO_ERROR ) { - - /** Get the node header from disk **/ - ADFI_read_file( file_index, block_offset->block, block_offset->offset, - NODE_HEADER_SIZE, disk_node_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Check disk tags **/ - if( ADFI_stridx_c( &disk_node_data[0], node_start_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end of */ - - if( ADFI_stridx_c( &disk_node_data[ NODE_HEADER_SIZE - TAG_SIZE ], - node_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - - /** Set the header onto the stack **/ - ADFI_stack_control(file_index, block_offset->block, block_offset->offset, - SET_STK, NODE_STK, NODE_HEADER_SIZE, disk_node_data ); -} /* end if */ - - /** Convert into memory **/ -strncpy( (char *)node_header->node_start_tag, &disk_node_data[ 0], TAG_SIZE ) ; -strncpy( (char *)node_header->node_end_tag, - &disk_node_data[ NODE_HEADER_SIZE - TAG_SIZE], TAG_SIZE ) ; - -strncpy( (char *)node_header->name, &disk_node_data[ TAG_SIZE], - ADF_NAME_LENGTH ) ; -strncpy( (char *)node_header->label, &disk_node_data[ 36], ADF_LABEL_LENGTH ) ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, MAXIMUM_32_BITS, 8, &disk_node_data[ 68], - &node_header->num_sub_nodes, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, MAXIMUM_32_BITS, 8, &disk_node_data[ 76], - &node_header->entries_for_sub_nodes, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_node_data[84], &disk_node_data[92], - &node_header->sub_node_table, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -strncpy( (char *)node_header->data_type, &disk_node_data[ 96], - ADF_DATA_TYPE_LENGTH ) ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 12, 2, &disk_node_data[128], - &node_header->number_of_dimensions, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -for( i=0; idimension_values[i], - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end for */ - -ADFI_ASCII_Hex_2_unsigned_int( 0, 65535, 4, &disk_node_data[226], - &node_header->number_of_data_chunks, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_node_data[230], &disk_node_data[238], - &node_header->data_chunks, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Check memory tags **/ -if( ADFI_stridx_c( node_header->node_start_tag, node_start_tag ) != 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end of */ - -if( ADFI_stridx_c( node_header->node_end_tag, node_end_tag ) != 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end of */ - -} /* end of ADFI_read_node_header */ -/* end of file ADFI_read_node_header.c */ -/* file ADFI_read_sub_node_table.c */ -/*********************************************************************** -ADFI read sub node table: - - At this point, reading of the ENTIRE table is required. - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -output: struct SUB_NODE_TABLE_ENTRY sub_node_table[] Array of SN entries. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_read_sub_node_table( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct SUB_NODE_TABLE_ENTRY sub_node_table[], - int *error_return ) -{ -char tag[TAG_SIZE + 1] ; -struct DISK_POINTER end_of_chunk_tag, current_child ; -unsigned int number_of_children, i ; - -if( (block_offset == NULL) || (sub_node_table == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Get tag and length **/ -ADFI_read_chunk_length( file_index, block_offset, tag, - &end_of_chunk_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -tag[TAG_SIZE] = '\0' ; - - /** calculate the number of chuldren in the sub-node table **/ -number_of_children = ( - (end_of_chunk_tag.block - block_offset->block) * DISK_BLOCK_SIZE + - (end_of_chunk_tag.offset - block_offset->offset) ) / - (DISK_POINTER_SIZE + ADF_NAME_LENGTH) ; - -current_child.block = block_offset->block ; -current_child.offset = block_offset->offset + TAG_SIZE + DISK_POINTER_SIZE ; -ADFI_adjust_disk_pointer( ¤t_child, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Read and convert the variable-length table into memory **/ -for( i=0; iblock, block_offset->offset, - GET_STK, SUBNODE_STK, ADF_NAME_LENGTH + DISK_POINTER_SIZE, - sub_node_entry_disk_data ) != NO_ERROR ) { - - /** Read the entry from disk **/ - ADFI_read_file( file_index, block_offset->block, block_offset->offset, - ADF_NAME_LENGTH + DISK_POINTER_SIZE, sub_node_entry_disk_data, - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Set the subnode onto the stack **/ - ADFI_stack_control(file_index, block_offset->block, block_offset->offset, - SET_STK, SUBNODE_STK, ADF_NAME_LENGTH + DISK_POINTER_SIZE, - sub_node_entry_disk_data ); -} /* end if */ - - /** Copy the name **/ -strncpy( sub_node_table_entry->child_name, &sub_node_entry_disk_data[0], - ADF_NAME_LENGTH ) ; - - /** Convert the disk-pointer **/ -ADFI_disk_pointer_from_ASCII_Hex( &sub_node_entry_disk_data[ ADF_NAME_LENGTH ], - &sub_node_entry_disk_data[ ADF_NAME_LENGTH + 8 ], - &sub_node_table_entry->child_location, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -} /* end of ADFI_read_sub_node_table_entry */ -/* end of file ADFI_read_sub_node_table_entry.c */ -/* file ADFI_remember_file_format.c */ -/********************************************************************** -ADFI remember file format: - Track the file format used: - -input: const int file_index Index for the file. -input: const char numeric_format Format for the file. -input: const char os_size operating system size for the file. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -FILE_INDEX_OUT_OF_RANGE -**********************************************************************/ -void ADFI_remember_file_format( - const int file_index, - const char numeric_format, - const char os_size, - int *error_return ) -{ -if( (file_index < 0) || (file_index > MAXIMUM_FILES) ) { - *error_return = FILE_INDEX_OUT_OF_RANGE ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; -ADF_file_format[file_index] = numeric_format ; -ADF_file_os_size[file_index] = os_size ; -} -/* end of file ADFI_remember_file_format.c */ -/* file ADFI_remember_version_update.c */ -/*********************************************************************** -ADFI remember version update: - Stores the what-string (which contains the file version number) so - that it can be written after the first successful update. After the - file has been updated once, the remembered what-string is "forgotten". - -input: const int file_index File index to write to. -input: const char *what_string What string to remember (contains version) -output: int *error_return Error return. - - Possible errors: -FILE_INDEX_OUT_OF_RANGE -NULL_STRING_POINTER -STRING_LENGTH_ZERO -***********************************************************************/ -void ADFI_remember_version_update( - const int file_index, - const char *what_string, - int *error_return ) -{ - -*error_return = NO_ERROR ; - -if( (file_index < 0) || (file_index > MAXIMUM_FILES) ) { - *error_return = FILE_INDEX_OUT_OF_RANGE ; - return ; - } /* end if */ - -if( what_string == NULL ) { - *error_return = NULL_STRING_POINTER ; - return; - } /* end if */ - -if( what_string[0] == '\0' ) { - *error_return = STRING_LENGTH_ZERO ; - return; - } /* end if */ - -if( strlen( what_string ) > WHAT_STRING_SIZE ) { - *error_return = STRING_LENGTH_TOO_BIG ; - return ; - } /* end if */ - -strcpy( file_version_update[ file_index ], what_string ) ; - -} /* end of ADFI_remember_version_update */ -/* end of file ADFI_remember_version_update.c */ -/* file ADFI_set_blank_disk_pointer.c */ -/********************************************************************** -ADFI_set_blank_disk_pointer: - Set the block and offset to the defined "blank", or unused values. - -output: struct DISK_POINTER *block_offset Block & offset in the file. - - Possible errors: -None allowed -**********************************************************************/ -void ADFI_set_blank_disk_pointer( - struct DISK_POINTER *block_offset ) -{ -block_offset->block = BLANK_FILE_BLOCK ; -block_offset->offset = BLANK_BLOCK_OFFSET ; -} /* end of ADFI_set_blank_disk_pointer */ -/* end of file ADFI_set_blank_disk_pointer.c */ -/* file ADFI_stack_control.c */ -/*********************************************************************** -ADFI stack control: - -input: const unsigned int file_index The file index. -input: const unsigned long file_block Block within the file. -input: const unsigned long block_offset Offset within the block. -input: const int stack_mode Control mode: INIT, GET or SET -input; const int stack_type Type of stack entry to process: FILE, NODE, etc.. -input: const unsigned int data_length Length of the data to buffer. -input/output: char *stack_data The character string buffered, is input for - mode SET and output for mode GET. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -PRISTK_NOT_FOUND - Note: errors are only important for GET mode since you must then go ahead - and read the data fom the file. The stack is only meant to speed things - up, not stop the process !!! -***********************************************************************/ -int ADFI_stack_control( const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - const int stack_mode, - const int stack_type, - const unsigned long data_length, - char *stack_data ) -{ -int i; -int low_priority; -int insert_index = -1; /* lint */ -int found; - -if( stack_data == NULL && (stack_mode == GET_STK || stack_mode == SET_STK) ) { - return NULL_STRING_POINTER ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 && stack_mode != INIT_STK ) { - return ADF_FILE_NOT_OPENED ; - } /* end if */ - -/* Process depending on the mode */ - - switch( stack_mode ) { - case INIT_STK: - case CLEAR_STK: - case CLEAR_STK_TYPE: - /* Clear all entries with current file_index and or type, - if file_index is 0 then clear all the entries!! */ - for (i=0; i 0 ) free(PRISTK[i].stack_data); - PRISTK[i].file_index = -1; - PRISTK[i].file_block = 0; - PRISTK[i].block_offset = 0; - PRISTK[i].stack_type = -1; - PRISTK[i].priority_level = -1; - } /* end for */ - if ( stack_mode == INIT_STK ) STACK_INIT = 1; - /* just in case link or linked-to node deleted */ - last_link_ID = 0.0; - break ; - case GET_STK: - /* Try and find the entry in the current stack by matching the - file index, block and offset, if found copy data else if - not return with an error. */ - for (i=0; i= 0 ) { - /* Existing entry so lower its priority, if it is the lowest - then save its index for possible replacement. */ - if ( PRISTK[i].priority_level > low_priority ) { - low_priority = PRISTK[i].priority_level; - insert_index = i; - } /* end if */ - PRISTK[i].priority_level++; - } /* end else if */ - else if ( found == 'f' ) { - /* An empty entry set pointer for possible insertion */ - low_priority = MAX_STACK * MAX_STACK; - insert_index = i; - found = 'e'; - } /* end else if */ - } /* end for */ - /* If the item was already on the stack then we are done */ - if ( found == 't' ) return NO_ERROR; - /* Insert the data onto the stack at the index_insert location. */ - i = insert_index; - if ( PRISTK[i].priority_level > 0 ) free(PRISTK[i].stack_data); - PRISTK[i].stack_data = ( char * ) malloc(data_length*sizeof(char)); - if ( PRISTK[i].stack_data == NULL ) { - /* Error allocating memory buffer so clear stack and punt */ - PRISTK[i].file_index = -1; - PRISTK[i].file_block = 0; - PRISTK[i].block_offset = 0; - PRISTK[i].stack_type = -1; - PRISTK[i].priority_level = -1; - return NO_ERROR; - } /* end if */ - strncpy( PRISTK[i].stack_data, stack_data, data_length ); - PRISTK[i].file_index = file_index; - PRISTK[i].file_block = file_block; - PRISTK[i].block_offset = block_offset; - PRISTK[i].stack_type = stack_type; - PRISTK[i].priority_level = 1; - break ; - } /* end switch */ - - return NO_ERROR; - -} /* end of ADFI_stack_control */ -/* end of file ADFI_stack_control.c */ -/* file ADFI_stridx_c.c */ -/********************************************************************** -ADFI stridx c: - To find the location of a substring within a string. This - routine is case InSeNsItIvE!!! - - It is NOT assumed that the substring is already upper-case!!! - -input: const char *str The string to search in. -input: const char *substr The substring to search for. -output: int return-value The position in str where substr was found. - -1 if substr was not found. - - Possible errors: -none: Errors are not allowed. -***********************************************************************/ -int ADFI_stridx_c( - const char *str, - const char *substr ) -{ -int i, j, k ; - -if( str == NULL || substr == NULL || substr[0] == '\0' ) { - return -1 ; /* not found - nothing to check */ -} - -for( i=0; str[i] != '\0'; i++ ) { - for( j=i, k=0; TO_UPPER( str[j] ) == TO_UPPER( substr[k] ); j++ ) { - if( substr[++k] == '\0' ) - return i ; /* the substring was found */ - } /* end for */ - } /* end for */ -return -1 ; /* the substring was not found */ -} /* end of ADFI_stridx_c */ -/* end of file ADFI_stridx_c.c */ -/* file ADFI_string_2_C_string.c */ -/********************************************************************** -ADFI string to C string: - Create a C string of the maximum length (+1 for null) which is - null terminated and has no trailing blanks. - -input: const char *string Input string. -input: const int string_length Length of input string to use. -output: char *c_string Returned C string. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -**********************************************************************/ -void ADFI_string_2_C_string( - const char *string, - const int string_length, - char *c_string, - int *error_return ) -{ -int i, iend ; - -if( (string == NULL) || (c_string == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Skip and trailing blanks **/ -for( iend=string_length-1; iend>=0; iend-- ) { - if( string[ iend ] != ' ' ) { - break ; - } /* end if */ - } /* end for */ - - /** Copy the non-trailing blank portion of the string **/ -for( i=0; i<=iend; i++ ) - c_string[i] = string[i] ; - - /** NULL terminate the C string **/ -c_string[i] = '\0' ; -} /* end of ADFI_string_2_C_string */ -/* end of file ADFI_string_2_C_string.c */ -/* file ADFI_unsigned_int_2_ASCII_Hex.c */ -/*********************************************************************** -ADFI unsigned int to ASCII hex: - Convert an unsigned int to an ASCII-Hex string. - -input: const unsigned int number The integer number to convert to ASCII. -input: const unsigned int minimum The expected minimum number in the int. -input: const unsigned int maximum The expected maximum number in the int. -input: const unsigned int string_length The length of the returned string. -output: char string[] The string. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NUMBER_LESS_THAN_MINIMUM -NUMBER_GREATER_THAN_MAXIMUM -STRING_LENGTH_ZERO -STRING_LENGTH_TOO_BIG -***********************************************************************/ -void ADFI_unsigned_int_2_ASCII_Hex( - const unsigned int number, - const unsigned int minimum, - const unsigned int maximum, - const unsigned int string_length, - char string[], - int *error_return ) -{ -unsigned int i, /** Index from 0 to string_length - 1 **/ - ir, /** Index from string_length - 1 to 0 **/ - j, /** Temoprary integer variable **/ - num ; /** Working value of ther number **/ - -if( string == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( number < minimum ) { - *error_return = NUMBER_LESS_THAN_MINIMUM ; - return ; - } /* end if */ - -if( number > maximum ) { - *error_return = NUMBER_GREATER_THAN_MAXIMUM ; - return ; - } /* end if */ - -if( string_length == 0 ) { - *error_return = STRING_LENGTH_ZERO ; - return ; - } /* end if */ - -if( string_length > 8 ) { - *error_return = STRING_LENGTH_TOO_BIG ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Convert the number using power-of-2 table **/ -num = number ; -for( i=0, ir=string_length - 1; i= pows[ ir ] ) { - j = num / pows[ ir ] ; - num = num - j * pows[ ir ] ; - } /* end if */ - else - j = 0 ; - string[i] = ASCII_Hex[ j ] ; - } /* end for */ -} /* end of ADFI_unsignedlong_2_ASCII_Hex */ -/* end of file ADFI_unsigned_int_2_ASCII_Hex.c */ -/* file ADFI_write_data_chunk.c */ -/*********************************************************************** -ADFI write data chunk: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const struct TOKENIZED_DATA_TYPE *tokenized_data_type Array. -input: const int data_size Size of data entity in bytes. -input: const long chunk_bytes Number of bytes in data chunk. -input: const long start_offset Starting offset into the data chunk -input: const long total_bytes Number of bytes to write in data chunk. -input: const char *data Pointer to the data. If 0, zero data. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_write_data_chunk( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - const struct TOKENIZED_DATA_TYPE *tokenized_data_type, - const int data_size, - const long chunk_bytes, - const long start_offset, - const long total_bytes, - const char *data, - int *error_return ) -{ -int format_compare ; -struct DISK_POINTER current_location, end_of_chunk_tag ; - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( tokenized_data_type == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -if( total_bytes+start_offset > chunk_bytes ) { - *error_return = REQUESTED_DATA_TOO_LONG ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Write the tag **/ -ADFI_write_file( file_index, block_offset->block, block_offset->offset, - TAG_SIZE, data_chunk_start_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Calculate the end-of-chunk-tag pointer **/ -end_of_chunk_tag.block = block_offset->block ; -end_of_chunk_tag.offset = block_offset->offset + TAG_SIZE + - DISK_POINTER_SIZE + chunk_bytes ; -ADFI_adjust_disk_pointer( &end_of_chunk_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Adjust location and write end-of-chunk pointer **/ -current_location.block = block_offset->block ; -current_location.offset = block_offset->offset + TAG_SIZE ; -ADFI_adjust_disk_pointer( ¤t_location, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_write_disk_pointer_2_disk( file_index, current_location.block, - current_location.offset, &end_of_chunk_tag, error_return ) ; - -current_location.offset += start_offset + DISK_POINTER_SIZE ; -ADFI_adjust_disk_pointer( ¤t_location, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** write the data **/ -if( data == NULL ) { /** Zero out the file data **/ - - /** If the data-pointer is NULL, write zeros to the file **/ - - /** Initialize the block of zeros **/ - if( block_of_00_initialized == FALSE ) { - int i ; - for( i=0; i DISK_BLOCK_SIZE ) { - long t_bytes = total_bytes ; - - /** If the number of bytes to write is larger than the block of - zeros we have, write out a series of zero blocks... - **/ - - /** write out the remainder of this block **/ - ADFI_write_file( file_index, current_location.block, - current_location.offset, DISK_BLOCK_SIZE - current_location.offset + 1, - block_of_00, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - current_location.block++ ; - current_location.offset = 0 ; - t_bytes -= (DISK_BLOCK_SIZE - current_location.offset + 1) ; - - /** Write blocks of zeros, then a partial block **/ - while( t_bytes > 0 ) { - ADFI_write_file( file_index, current_location.block, - current_location.offset, MIN( DISK_BLOCK_SIZE, t_bytes), - block_of_00, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - t_bytes -= (MIN( DISK_BLOCK_SIZE, t_bytes)) ; - } /* end while */ - - } /* end if */ - else { - - /** Write a partial block of zeros to disk **/ - ADFI_write_file( file_index, current_location.block, - current_location.offset, total_bytes, block_of_00, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - } /* end if */ -else { - - /** check for need of data translation **/ - ADFI_file_and_machine_compare( file_index, tokenized_data_type, - &format_compare, error_return ); - if( *error_return != NO_ERROR ) - return ; - if( format_compare == 1 ) { - /** Write the data to disk **/ - ADFI_write_file( file_index, current_location.block, - current_location.offset, total_bytes, data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - else { - ADFI_write_data_translated( file_index, current_location.block, - current_location.offset, tokenized_data_type, data_size, - total_bytes, data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - } /* end else */ - - /** Write the ending tag to disk **/ -ADFI_write_file( file_index, end_of_chunk_tag.block, end_of_chunk_tag.offset, - TAG_SIZE, data_chunk_end_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -} /* end of ADFI_write_data_chunk */ -/* end of file ADFI_write_data_chunk.c */ -/* file ADFI_write_data_chunk_table.c */ -/*********************************************************************** -ADFI write data chunk table: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const int number_of_data_chunks Number of entries to write. -output: struct DATA_CHUNK_TABLE_ENTRY data_chunk_table[] Array of entries. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_write_data_chunk_table( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - const int number_of_data_chunks, - struct DATA_CHUNK_TABLE_ENTRY data_chunk_table[], - int *error_return ) -{ -struct DISK_POINTER disk_pointer, end_of_chunk_tag ; -int i ; - -if( (block_offset == NULL) || (data_chunk_table == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Write Starting boundary tag **/ -disk_pointer.block = block_offset->block ; -disk_pointer.offset = block_offset->offset ; -ADFI_write_file( file_index, disk_pointer.block, disk_pointer.offset, - TAG_SIZE, data_chunk_table_start_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -disk_pointer.offset += TAG_SIZE ; -ADFI_adjust_disk_pointer( &disk_pointer, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Calculate the end-of-chunk-tag location **/ -end_of_chunk_tag.block = disk_pointer.block ; -end_of_chunk_tag.offset = disk_pointer.offset + DISK_POINTER_SIZE + - number_of_data_chunks * 2 * DISK_POINTER_SIZE ; -ADFI_adjust_disk_pointer( &end_of_chunk_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_write_disk_pointer_2_disk( file_index, disk_pointer.block, - disk_pointer.offset, &end_of_chunk_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Write data chunk table entries **/ -disk_pointer.offset += DISK_POINTER_SIZE ; -for( i=0; i number_of_data_elements ) { - chunk_size -= ( number_of_elements_written - number_of_data_elements ) ; - delta_to_bytes = chunk_size * data_size ; - delta_from_bytes = chunk_size * machine_size ; - } - ADFI_convert_number_format( - ADF_this_machine_format, /* from format */ - ADF_this_machine_os_size, /* from os size */ - ADF_file_format[file_index], /* to format */ - ADF_file_os_size[file_index], /* to os size */ - TO_FILE_FORMAT, - tokenized_data_type, chunk_size, from_data, - to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - ADFI_write_file( file_index, disk_pointer.block, disk_pointer.offset, - delta_to_bytes, (char *)to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - from_data += delta_from_bytes ; - disk_pointer.offset += delta_to_bytes ; - if ( disk_pointer.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &disk_pointer, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - } /* end while */ - -} /* end of ADFI_write_data_translated */ -/* end of file ADFI_write_data_translated.c */ -/* file ADFI_write_disk_block.c */ -/*********************************************************************** -ADFI write disk block: -***********************************************************************/ -void ADFI_write_disk_block() -{ -fprintf(stderr,"Subroutine ADFI_write_disk_block is not yet implemented...\n" ) ; -} /* end of ADFI_write_disk_block */ -/* end of file ADFI_write_disk_block.c */ -/* file ADFI_write_disk_pointer_2_disk.c */ -/*********************************************************************** -ADFI write disk pointer 2 disk: - Given a pointer to a disk pointer, convert it to ASCII Hex - and write it to disk. - -input: const unsigned int file_index File to write to. -input: const unsigned long file_block Block within the file. -input: const unsigned long block_offset Offset within the block. -input: const struct DISK_POINTER *block_and_offset Disk pointer. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_write_disk_pointer_2_disk( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - const struct DISK_POINTER *block_and_offset, - int *error_return ) -{ -char disk_block_offset[DISK_POINTER_SIZE] ; - -if( block_and_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Convert into ASCII_Hex form **/ -ADFI_disk_pointer_2_ASCII_Hex( block_and_offset, &disk_block_offset[0], - &disk_block_offset[8], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Put the block/offset to disk **/ -ADFI_write_file( file_index, file_block, block_offset, - DISK_POINTER_SIZE, disk_block_offset, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Set the block/offset onto the stack **/ -#if 0 -ADFI_stack_control(file_index, file_block, block_offset, - SET_STK, DISK_PTR_STK, DISK_POINTER_SIZE, - disk_block_offset ); -#endif - -} /* end of ADFI_write_disk_pointer_2_disk */ -/* end of file ADFI_write_disk_pointer_2_disk.c */ -/* file ADFI_write_file.c */ -/*********************************************************************** -ADFI write file: - Write a number of bytes to an ADF file, given the file, - block, and block offset. - -input: const unsigned int file_index File to write to. -input: const unsigned long file_block Block within the file. -input: const unsigned long block_offset Offset within the block. -input: const unsigned int data_length Length of the data to write. -input: const char *data Address of the data. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -FWRITE_ERROR -***********************************************************************/ -void ADFI_write_file( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - const unsigned int data_length, - const char *data, - int *error_return ) -{ -int iret ; -unsigned long end_block ; - -if( data == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** If the read buffer overlaps the buffer then reset it to make - sure its currrent **/ - -end_block = file_block+(block_offset+data_length)/DISK_BLOCK_SIZE+1; -if ( last_rd_file == (long int) file_index && last_rd_block >= (long int) file_block && - last_rd_block <= (long int) end_block ) - last_rd_block = last_rd_file = num_in_rd_block = -1 ; - - /** Check to see if we need to flush the write buffer. this happens if we - are writing a large chunk or the write moves out of the current block. - If the data length is zero then just flush the buffer and return. - Note that the ADF_modification_date routine will flush the buffer - after any write operations !! **/ - -if( ( (unsigned long int) data_length + block_offset > DISK_BLOCK_SIZE || - last_wr_block != (long int) file_block || last_wr_file != (long int) file_index || - data_length == 0 ) && flush_wr_block > 0 ) { - - -#if CACHEWRITES - DC_add_block(last_wr_file, last_wr_block, 1, wr_block_buffer, error_return); -#else - /** Position the file **/ - ADFI_fseek_file( last_wr_file, last_wr_block, 0, error_return ) ; - if( *error_return != NO_ERROR ) { - return ; - } /* end if */ - - /** write the buffer **/ - iret=fwrite( wr_block_buffer, 1, DISK_BLOCK_SIZE, ADF_file[last_wr_file] ); -#endif - - flush_wr_block = -2 ; /** Make sure we don't flush twice due to error **/ - -#if !CACHEWRITES - if( iret != DISK_BLOCK_SIZE ) { - *error_return = FWRITE_ERROR ; - return ; - } /* end if */ -#endif - - /** If the write buffer overlaps the buffer then reset it to make - sure its currrent, set flush buffer flag to false. **/ - if ( last_wr_file == (long int) file_index && last_wr_block >= (long int) file_block && - last_wr_block <= (long int) end_block ) - last_wr_block = last_wr_file = -2 ; - -} /* end if */ -if ( data_length == 0 ) return; /** Just a buffer flush **/ - - /** No need to buffer large pieces of data or to take special - measures to cross block boundaries **/ - -if( data_length + block_offset > DISK_BLOCK_SIZE ) { - - char start_block_data[DISK_BLOCK_SIZE], end_block_data[DISK_BLOCK_SIZE]; - long start_pos = file_block * DISK_BLOCK_SIZE + block_offset; - off_t end_pos = start_pos + data_length; - unsigned long ending_block = end_pos / DISK_BLOCK_SIZE; - - if (file_block + 1 <= ending_block - 1) - DC_flush_range(file_index, file_block + 1, ending_block - 1); - - /** Position the file **/ - ADFI_fseek_file( file_index, file_block, block_offset, error_return ) ; - if( *error_return != NO_ERROR ) { - return ; - } /* end if */ - - /** write the data **/ - iret = fwrite( data, 1, data_length, ADF_file[ file_index ] ) ; - if( iret != (int) data_length ) { - *error_return = FWRITE_ERROR ; - return ; - } /* end if */ - - /** Now make sure the cache matches up */ - if (DC_get_block(file_index, file_block, start_block_data)) { - memcpy(start_block_data + block_offset, data, - DISK_BLOCK_SIZE - block_offset); - DC_add_block(file_index, file_block, 0, start_block_data, - error_return); - } - if (DC_get_block(file_index, ending_block, end_block_data)) { - memcpy(end_block_data, data + ending_block * DISK_BLOCK_SIZE - start_pos, - end_pos % DISK_BLOCK_SIZE); - DC_add_block(file_index, ending_block, 0, end_block_data, error_return); - } - - return; -} /* end if */ - - /** For smaller pieces of data, write a block at a time. This will improve - performance if neighboring data is writen a small piece at a time - (strided reads, file overhead). - - Some assumptions apply to the block size. With some experimenting, - 1K blocks do not offer much improvement. 4K blocks (4096 bytes) - do improve performance remarkably. This is due to the fact that the - file structure is based of 4K blocks with offsets. Also the CRAY - loves 4K block writes!! - **/ - -if( (long int) file_block != last_wr_block || /*- a different block -*/ - (long int) file_index != last_wr_file ) { /*- entirely different file -*/ - - /** buffer is not current, re-read **/ - - if ( (long int) file_block == last_rd_block && (long int) file_index == last_rd_file ) { - - /* Copy data from read buffer */ - memcpy( wr_block_buffer, rd_block_buffer, DISK_BLOCK_SIZE ); - iret = num_in_rd_block; - } - else { - - if ( !DC_get_block( file_index, file_block, wr_block_buffer ) ) { - /** Position the file **/ - ADFI_fseek_file( file_index, file_block, 0, error_return ) ; - if( *error_return != NO_ERROR ) { - return ; - } /* end if */ - - /** Read the data from disk **/ - iret=fread( wr_block_buffer, 1, DISK_BLOCK_SIZE, ADF_file[file_index] ) ; - if( iret == EOF || iret < DISK_BLOCK_SIZE ) { - if ( iret < 0 ) iret = 0; - memset(&wr_block_buffer[iret], (size_t) ' ', DISK_BLOCK_SIZE-iret); - } /* end if */ -/* For some reason the Sun gets occasial corruptions unless the block is - cached. There appears to be no reason in the code for this, and it works - for other platforms. It might possibly have something to do with - disk block sizes on Solaris? I am removing the else on Solaris, but - because it is late in the beta for StarCCM+ I am leaving the other platforms - unchanged (although it should be safe for the other platforms, too) - Geoff P 2/06 */ -#ifndef __sun /* This is defined in both GCC and the Sun compiler */ - else -#endif - DC_add_block( file_index, file_block, 0, wr_block_buffer, error_return); - } /* end if */ - - /** Remember buffer information **/ - last_wr_block = file_block ; - last_wr_file = file_index ; - } - -} /* end if */ - - /** Write into the buffer and set flush buffer flag **/ -memcpy( &wr_block_buffer[block_offset], data, data_length ); -flush_wr_block = 1 ; - -} /* end of ADFI_write_file */ -/* end of file ADFI_write_file.c */ -/* file ADFI_write_file_header.c */ -/*********************************************************************** -ADFI write file header: - To take information in the FILE_HEADER structure and format it - for disk, and write it out. -input: const int file_index File index to write to. -input: const FILE_HEADER *file_header The file header structure. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_MEMORY_TAG_ERROR -ADF_DISK_TAG_ERROR -***********************************************************************/ -void ADFI_write_file_header( - const int file_index, - const struct FILE_HEADER *file_header, - int *error_return ) -{ -char disk_header[ FILE_HEADER_SIZE ] ; - -if( file_header == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check memory tags for proper data **/ -if( strncmp( file_header->tag0, file_header_tags[0], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag1, file_header_tags[1], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag2, file_header_tags[2], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag3, file_header_tags[3], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag4, file_header_tags[4], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag5, file_header_tags[5], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -/** OK the memory tags look good, let's format the file header information - into the disk format and write it out. -**/ -strncpy( &disk_header[ 0], (char *)file_header->what, WHAT_STRING_SIZE ) ; -strncpy( &disk_header[ 32], (char *)file_header->tag0, TAG_SIZE ) ; -strncpy( &disk_header[ 36], (char *)file_header->creation_date, DATE_TIME_SIZE); -strncpy( &disk_header[ 64], (char *)file_header->tag1, TAG_SIZE ) ; -strncpy( &disk_header[ 68], (char *)file_header->modification_date, - DATE_TIME_SIZE ) ; -strncpy( &disk_header[ 96], (char *)file_header->tag2, TAG_SIZE ) ; -disk_header[100] = file_header->numeric_format ; -disk_header[101] = file_header->os_size ; -strncpy( &disk_header[102], (char *)file_header->tag3, TAG_SIZE ) ; - -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_char, 0, 255, 2, - &disk_header[106], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_short, 0, 255, 2, - &disk_header[108], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_int, 0, 255, 2, - &disk_header[110], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_long, 0, 255, 2, - &disk_header[112], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_float, 0, 255, 2, - &disk_header[114], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_double, 0, 255, 2, - &disk_header[116], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_char_p, 0, 255, 2, - &disk_header[118], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_short_p, 0, 255, 2, - &disk_header[120], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_int_p, 0, 255, 2, - &disk_header[122], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_long_p, 0, 255, 2, - &disk_header[124], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_float_p, 0, 255, 2, - &disk_header[126], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_double_p, 0, 255, 2, - &disk_header[128], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -strncpy( &disk_header[130], file_header->tag4, TAG_SIZE ) ; - -ADFI_disk_pointer_2_ASCII_Hex( &file_header->root_node, &disk_header[134], - &disk_header[142], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &file_header->end_of_file, &disk_header[146], - &disk_header[154], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &file_header->free_chunks, &disk_header[158], - &disk_header[166], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &file_header->extra, &disk_header[170], - &disk_header[178], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -strncpy( &disk_header[182], file_header->tag5, TAG_SIZE ) ; - - /** Now write the disk header out... **/ -ADFI_write_file( file_index, 0, 0, FILE_HEADER_SIZE, disk_header, - error_return ) ; - /** Set the header onto the stack **/ -ADFI_stack_control(file_index, 0, 0, SET_STK, FILE_STK, - FILE_HEADER_SIZE, disk_header ); -} /* end of ADFI_write_file_header */ -/* end of file ADFI_write_file_header.c */ -/* file ADFI_write_free_chunk.c */ -/*********************************************************************** -ADFI write free chunk: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const struct FREE_CHUNK *free_chunk Pointer to free-chunk. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_write_free_chunk( - const int file_index, - const struct DISK_POINTER *block_offset, - const struct FREE_CHUNK *free_chunk, - int *error_return ) -{ -unsigned int i ; -struct DISK_POINTER current_location ; - -if( (block_offset == NULL) || (free_chunk == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Initialize the block of 'X's **/ -if( block_of_XX_initialized == FALSE ) { - for( i=0; istart_tag, free_chunk_start_tag, TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( free_chunk->end_tag, free_chunk_end_tag, TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - - /** Write start TAG **/ -ADFI_write_file( file_index, block_offset->block, block_offset->offset, - TAG_SIZE, free_chunk->start_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Write disk pointers **/ -current_location.block = block_offset->block ; -current_location.offset = block_offset->offset + TAG_SIZE ; -ADFI_adjust_disk_pointer( ¤t_location, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_write_disk_pointer_2_disk( file_index, current_location.block, - current_location.offset, - &free_chunk->end_of_chunk_tag, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -current_location.offset += DISK_POINTER_SIZE ; -ADFI_adjust_disk_pointer( ¤t_location, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_write_disk_pointer_2_disk( file_index, current_location.block, - current_location.offset, - &free_chunk->next_chunk, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Write out a bunch of 'x's in the free chunk's empty space **/ -current_location.offset += DISK_POINTER_SIZE ; -ADFI_adjust_disk_pointer( ¤t_location, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Fill in partial end of a block **/ -if( (current_location.block != free_chunk->end_of_chunk_tag.block) && - (current_location.offset != 0 ) ) { - ADFI_write_file( file_index, current_location.block, - current_location.offset, DISK_BLOCK_SIZE - current_location.offset, - block_of_XX, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - current_location.block++ ; - current_location.offset = 0 ; - } /* end if */ - - /** Fill in intermediate whole blocks **/ -while( current_location.block < free_chunk->end_of_chunk_tag.block ) { - ADFI_write_file( file_index, current_location.block, - 0, DISK_BLOCK_SIZE, block_of_XX, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - current_location.block++ ; - } /* end if */ - - /** Fill in partial block to end-of-free-chunk **/ -if( current_location.offset < free_chunk->end_of_chunk_tag.offset ) { - ADFI_write_file( file_index, current_location.block, - current_location.offset, - free_chunk->end_of_chunk_tag.offset - current_location.offset, - block_of_XX, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - - /** Now (finally) write out the free_chunk-end_tag **/ -ADFI_write_file( file_index, current_location.block, - free_chunk->end_of_chunk_tag.offset, TAG_SIZE, free_chunk->end_tag, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -} /* end of ADFI_write_free_chunk */ -/* end of file ADFI_write_free_chunk.c */ -/* file ADFI_write_free_chunk_table.c */ -/*********************************************************************** -ADFI write free chunk table: - To take information in the FREE_CHUNK_TABLE structure and format it - for disk, and write it out. -input: const int file_index File index to write to. -input: const FREE_CHUNK_TABLE *free_chunk_table The free_chunk header struct. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_write_free_chunk_table( - const int file_index, - const struct FREE_CHUNK_TABLE *free_chunk_table, - int *error_return ) -{ -char disk_free_chunk_data[ FREE_CHUNK_TABLE_SIZE ] ; - -if( free_chunk_table == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check memory tags for proper data **/ -if( strncmp( free_chunk_table->start_tag, free_chunk_table_start_tag, - TAG_SIZE ) != 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( free_chunk_table->end_tag, free_chunk_table_end_tag, - TAG_SIZE ) != 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -/** OK the memory tags look good, let's format the free_chunk header - information into the disk format and write it out. -**/ -strncpy( &disk_free_chunk_data[ 0], (char *)free_chunk_table->start_tag, - TAG_SIZE ) ; - -ADFI_disk_pointer_2_ASCII_Hex( &free_chunk_table->small_first_block, - &disk_free_chunk_data[TAG_SIZE], - &disk_free_chunk_data[DISK_POINTER_SIZE], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &free_chunk_table->small_last_block, - &disk_free_chunk_data[16], &disk_free_chunk_data[24], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &free_chunk_table->medium_first_block, - &disk_free_chunk_data[28], &disk_free_chunk_data[36], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &free_chunk_table->medium_last_block, - &disk_free_chunk_data[40], &disk_free_chunk_data[48], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &free_chunk_table->large_first_block, - &disk_free_chunk_data[52], &disk_free_chunk_data[60], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &free_chunk_table->large_last_block, - &disk_free_chunk_data[64], &disk_free_chunk_data[72], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -strncpy( &disk_free_chunk_data[ 76], (char *)free_chunk_table->end_tag, - TAG_SIZE ) ; - - /** Now write the free_chunk header out to disk... **/ -ADFI_write_file( file_index, FREE_CHUNKS_BLOCK, FREE_CHUNKS_OFFSET, - FREE_CHUNK_TABLE_SIZE, disk_free_chunk_data, error_return ) ; - /** Set the free chunk onto the stack **/ -ADFI_stack_control(file_index, FREE_CHUNKS_BLOCK, FREE_CHUNKS_OFFSET, - SET_STK, FREE_CHUNK_STK, FREE_CHUNK_TABLE_SIZE, - disk_free_chunk_data ); -} /* end of ADFI_write_free_chunk_table */ -/* end of file ADFI_write_free_chunk_table.c */ -/* file ADFI_write_modification_date.c */ -/*********************************************************************** -ADFI write modification date: - Writes the current date/time into the modification date field of - the file header. Also updates the file version (what string) - in the header if the file version global variable has been set - - after writing, file version global variable is unset so that it is - only written once. - -input: const int file_index File index to write to. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -FWRITE_ERROR -***********************************************************************/ -void ADFI_write_modification_date( - const int file_index, - int *error_return ) -{ -int i_block_offset ; -char mod_date[DATE_TIME_SIZE] ; - - -*error_return = NO_ERROR ; - -ADFI_get_current_date( mod_date ) ; - - /** block offset depends on the location the of modification date - in the FILE_HEADER structure **/ -i_block_offset = WHAT_STRING_SIZE + TAG_SIZE + DATE_TIME_SIZE + TAG_SIZE ; -ADFI_write_file( file_index, 0, i_block_offset, DATE_TIME_SIZE, mod_date, - error_return ) ; -if( *error_return != NO_ERROR ) { - return; - } /* end if */ - - /** Flush the write buffer to ensure the file is current!! **/ -ADFI_flush_buffers( file_index, FLUSH, error_return ); -if( *error_return != NO_ERROR ) { - return; - } /* end if */ - -if( file_version_update[ file_index ][ 0 ] != '\0' ) -{ - i_block_offset = 0 ; /* what-string is first field in header */ - ADFI_write_file( file_index, 0, i_block_offset, WHAT_STRING_SIZE, - file_version_update[ file_index ], error_return ) ; - -/** reset the version to default so that it only gets updated once **/ - file_version_update[ file_index ][ 0 ] = '\0' ; - if( *error_return != NO_ERROR ) { - return; - } /* end if */ - } /* end if */ - -} /* end of ADFI_write_modification_date */ -/* end of file ADFI_write_modification_date.c */ -/* file ADFI_write_node_header.c */ -/*********************************************************************** -ADFI write node header: - To take information in the NODE_HEADER structure and format it - for disk, and write it out. -input: const int file_index File index to write to. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const NODE_HEADER *node_header The node header structure. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_write_node_header( - const int file_index, - const struct DISK_POINTER *block_offset, - const struct NODE_HEADER *node_header, - int *error_return ) -{ -int i ; -char disk_node_data[ NODE_HEADER_SIZE ] ; - -if( (block_offset == NULL) || (node_header == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -/** Check memory tags for proper data **/ -if( strncmp( node_header->node_start_tag, node_start_tag, TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( node_header->node_end_tag, node_end_tag, TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -/** OK the memory tags look good, let's format the node header information - into the disk format and write it out. -**/ -strncpy( &disk_node_data[ 0], (char *)node_header->node_start_tag, TAG_SIZE ) ; -strncpy( &disk_node_data[ TAG_SIZE], (char *)node_header->name, - ADF_NAME_LENGTH ); -strncpy( &disk_node_data[ 36], (char *)node_header->label, ADF_LABEL_LENGTH ) ; - -ADFI_unsigned_int_2_ASCII_Hex( node_header->num_sub_nodes, 0, - MAXIMUM_32_BITS, 8, &disk_node_data[ 68], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_unsigned_int_2_ASCII_Hex( node_header->entries_for_sub_nodes, 0, - MAXIMUM_32_BITS, 8, &disk_node_data[ 76], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &node_header->sub_node_table, - &disk_node_data[84], &disk_node_data[92], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -strncpy( &disk_node_data[ 96], (char *)node_header->data_type, - ADF_DATA_TYPE_LENGTH ) ; - -ADFI_unsigned_int_2_ASCII_Hex( node_header->number_of_dimensions, 0, - 12, 2, &disk_node_data[128], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -for( i=0; idimension_values[i], 0, - MAXIMUM_32_BITS, 8, &disk_node_data[130+(i*8)], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end for */ - -ADFI_unsigned_int_2_ASCII_Hex( node_header->number_of_data_chunks, 0, - 65535, 4, &disk_node_data[226], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &node_header->data_chunks, - &disk_node_data[230], &disk_node_data[238], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -strncpy( &disk_node_data[242], (char *)node_header->node_end_tag, TAG_SIZE ) ; - - /** Now write the node-header out to disk... **/ -ADFI_write_file( file_index, block_offset->block, block_offset->offset, - NODE_HEADER_SIZE, disk_node_data, error_return ) ; - /** Set the header onto the stack **/ -ADFI_stack_control(file_index, block_offset->block, block_offset->offset, - SET_STK, NODE_STK, NODE_HEADER_SIZE, disk_node_data ); -} /* end of ADFI_write_node_header */ -/* end of file ADFI_write_node_header.c */ -/* file ADFI_write_sub_node_table.c */ -/*********************************************************************** -ADFI write sub node table: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const int number_of_sub_nodes Number of sub-node entries. -input: struct SUB_NODE_TABLE_ENTRY sub_node_table[] Array of sub-node entries. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_write_sub_node_table( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - const int number_of_sub_nodes, - struct SUB_NODE_TABLE_ENTRY sub_node_table[], - int *error_return ) -{ -int i ; -struct DISK_POINTER end_of_chunk_tag, current_child ; - -if( (block_offset == NULL) || (sub_node_table == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** calculate the end-of-chunk tag pointer **/ -end_of_chunk_tag.block = block_offset->block ; -end_of_chunk_tag.offset = block_offset->offset + TAG_SIZE + DISK_POINTER_SIZE + - number_of_sub_nodes * (ADF_NAME_LENGTH + DISK_POINTER_SIZE) ; -ADFI_adjust_disk_pointer( &end_of_chunk_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Write start TAG **/ -ADFI_write_file( file_index, block_offset->block, block_offset->offset, - TAG_SIZE, sub_node_start_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Write disk pointer **/ -current_child.block = block_offset->block ; -current_child.offset = block_offset->offset + TAG_SIZE ; -ADFI_adjust_disk_pointer( ¤t_child, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_write_disk_pointer_2_disk( file_index, current_child.block, - current_child.offset, &end_of_chunk_tag, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Format and write out the table entries **/ -current_child.offset += DISK_POINTER_SIZE ; -for( i=0; ichild_name, - ADF_NAME_LENGTH ) ; -ADFI_disk_pointer_2_ASCII_Hex( &sub_node_table_entry->child_location, - &sub_node_entry_disk_data[ ADF_NAME_LENGTH ], - &sub_node_entry_disk_data[ ADF_NAME_LENGTH + 8 ], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Now write it out to disk **/ -ADFI_write_file( file_index, block_offset->block, block_offset->offset, - ADF_NAME_LENGTH + DISK_POINTER_SIZE, - sub_node_entry_disk_data, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Set the subnode onto the stack **/ -ADFI_stack_control(file_index, block_offset->block, block_offset->offset, - SET_STK, SUBNODE_STK, ADF_NAME_LENGTH + DISK_POINTER_SIZE, - sub_node_entry_disk_data ); - -} /* end of ADFI_write_sub_node_table_entry */ -/* end of file ADFI_write_sub_node_table_entry.c */ -/* file ADFI_strtok.c */ -/*********************************************************************** -ADFI get string token: This routine simulates strtok except it returns the -current postion in the string tobe used later. Thas avoids the problem of -trying using strtok in a recrusive subroutine call which does not work! - -input/output: *string - the string to parse tokens from. - returns string with token replaced by nil. -input/output: *string_pos - the string position to begin parsing should - be placed at the beginning of the string. - returns postion after last token to continue - string parsing. Token may change from last call. -input: *token - The token to search for. -function return: - a pointer to the desired substring. - A NULL returns indicates the end of the string. - -***********************************************************************/ -char *ADFI_strtok( - char *string, - char **string_pos, - char *token ) -{ - char *tmp_ptr ; - char *sub_string ; - int string_len ; - - if ( string_pos == NULL ) return NULL ; - if( token == NULL || string == NULL || *string_pos == NULL ) return NULL ; - - /* Get the length left in the string */ - - string_len = strlen ( *string_pos ) ; - if ( string_len == 0 ) return NULL ; - - /* Find the first character in the string which does not match the token */ - tmp_ptr = *string_pos ; - while ( string_len > 0 ) { - if ( tmp_ptr[0] == token[0] ) { - tmp_ptr++ ; - string_len-- ; - } - else { - break ; - } /* end if */ - } /* end while */ - if ( string_len == 0 ) return NULL ; - - /* Set the begining fof the sub string */ - sub_string = tmp_ptr ; - - /* Find the next token or the end of the string */ - - while ( string_len > 0 ) { - if ( tmp_ptr[0] != token[0] ) { - tmp_ptr++ ; - string_len-- ; - } - else { - tmp_ptr[0] = '\0' ; - break ; - } /* end if */ - } /* end while */ - - /* Set location for the next search */ - - if ( string_len > 0 ) - *string_pos = &tmp_ptr[1] ; - else - *string_pos = NULL ; - - return sub_string ; - -} /* end of ADFI_strtok */ -/* end of file ADFI_strtok.c */ -/* end of combine 2.0 */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_internals.cpp b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_internals.cpp deleted file mode 100644 index 2b303b98c9..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_internals.cpp +++ /dev/null @@ -1,5 +0,0 @@ -extern "C" { - -#include "ADF_internals.c" - -} diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_internals.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_internals.h deleted file mode 100644 index 18ad2daad5..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_internals.h +++ /dev/null @@ -1,1004 +0,0 @@ -/** -File: ADF_internals.h - ---------------------------------------------------------------------- - BOEING - ---------------------------------------------------------------------- - Project: CGNS - Author: Tom Dickens 865-6122 tpd6908@yak.ca.boeing.com - Date: 3/2/1995 - Purpose: Provide declarations for the internal ADF-Core routines. - ---------------------------------------------------------------------- - ---------------------------------------------------------------------- - -**/ - -#ifndef ADF_INTERNALS_INCLUDE -#define ADF_INTERNALS_INCLUDE -#include "ADF.h" - -#ifndef MAKEDEPEND -#include /* needed for toupper */ -#endif - -/*********************************************************************** - Defines -***********************************************************************/ - - /* the length of items in a sub_node_list is a multiple of LIST_CHUNK */ -#define LIST_CHUNK 8 -#define LIST_CHUNK_GROW_FACTOR 1.5 - - /** File parameters **/ -#ifndef DISK_BLOCK_SIZE -#define DISK_BLOCK_SIZE 4096 -#endif -#define MAXIMUM_FILES 128 -#define MAXIMUM_32_BITS (4294967295U) - -#define BLANK_FILE_BLOCK 0 -#define BLANK_BLOCK_OFFSET DISK_BLOCK_SIZE - - /** Sizes of things on disk **/ -#define FILE_HEADER_SIZE 186 -#define FREE_CHUNK_TABLE_SIZE 80 -#define FREE_CHUNK_ENTRY_SIZE 32 -#define NODE_HEADER_SIZE 246 -#define DISK_POINTER_SIZE 12 -#define TAG_SIZE 4 -#define WHAT_STRING_SIZE 32 -#define DATE_TIME_SIZE 28 - - /* smallest amount of data (chunk) to be allocated. Minimum size - corresponds to the free-chunk minimum size for the free-chunk - linked lists. - */ -#define SMALLEST_CHUNK_SIZE NODE_HEADER_SIZE -#define SMALL_CHUNK_MAXIMUM 1024 -#define MEDIUM_CHUNK_MAXIMUM DISK_BLOCK_SIZE - -#define FREE_CHUNKS_BLOCK 0 -#define FREE_CHUNKS_OFFSET FILE_HEADER_SIZE -#define ROOT_NODE_BLOCK 0 -#define ROOT_NODE_OFFSET (FREE_CHUNKS_OFFSET + FREE_CHUNK_TABLE_SIZE) - -#define ROOT_NODE_NAME "ADF MotherNode" -#define ROOT_NODE_LABEL "Root Node of ADF File" - - /** Machine formats **/ -#define UNDEFINED_FORMAT 0 -#define IEEE_BIG_32_FORMAT 1 -#define IEEE_LITTLE_32_FORMAT 2 -#define IEEE_BIG_64_FORMAT 3 -#define IEEE_LITTLE_64_FORMAT 4 -#define CRAY_FORMAT 5 -#define NATIVE_FORMAT 99 - -#define UNDEFINED_FORMAT_CHAR 'U' -#define IEEE_BIG_FORMAT_CHAR 'B' -#define IEEE_LITTLE_FORMAT_CHAR 'L' -#define CRAY_FORMAT_CHAR 'C' -#define NATIVE_FORMAT_CHAR 'N' -#define OS_64_BIT 'B' -#define OS_32_BIT 'L' - -#define IEEE_BIG_32_FORMAT_STRING "IEEE_BIG_32" -#define IEEE_LITTLE_32_FORMAT_STRING "IEEE_LITTLE_32" -#define IEEE_BIG_64_FORMAT_STRING "IEEE_BIG_64" -#define IEEE_LITTLE_64_FORMAT_STRING "IEEE_LITTLE_64" -#define CRAY_FORMAT_STRING "CRAY" -#define NATIVE_FORMAT_STRING "NATIVE" - -#ifndef FALSE -#define FALSE (0) -#endif - -#ifndef TRUE -#define TRUE (-1) -#endif - -/*********************************************************************** - Defined Marcos -***********************************************************************/ - /** Upper case a character **/ - /** Need to use the system macros for the Cray optimizer **/ -#define TO_UPPER( c ) ((islower(c))?(toupper(c)):(c)) - -#define MIN(a,b) (((a)<(b))?(a):(b)) -#define MAX(a,b) (((a)>(b))?(a):(b)) - -/*********************************************************************** - Structures: -***********************************************************************/ - /** A DISK_POINTER tracks the block number (from 0) and the offset - within a block. - **/ -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -struct DISK_POINTER { - unsigned long block ; /* 0 to 4,294,967,295 (8 ASCII-Hex bytes) */ - unsigned long offset ; /* 0 to 4096 (4 ASCII-Hex bytes) */ - } ; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -struct FILE_HEADER { - char what [WHAT_STRING_SIZE] ; - char tag0 [TAG_SIZE] ; - char creation_date [DATE_TIME_SIZE] ; - char tag1 [TAG_SIZE] ; - char modification_date [DATE_TIME_SIZE] ; - char tag2 [TAG_SIZE] ; - char numeric_format ; - char os_size ; - char tag3 [TAG_SIZE] ; - unsigned int sizeof_char ; - unsigned int sizeof_short ; - unsigned int sizeof_int ; - unsigned int sizeof_long ; - unsigned int sizeof_float ; - unsigned int sizeof_double ; - unsigned int sizeof_char_p ; - unsigned int sizeof_short_p ; - unsigned int sizeof_int_p ; - unsigned int sizeof_long_p ; - unsigned int sizeof_float_p ; - unsigned int sizeof_double_p ; - char tag4 [TAG_SIZE] ; - struct DISK_POINTER root_node ; - struct DISK_POINTER end_of_file ; - struct DISK_POINTER free_chunks ; - struct DISK_POINTER extra ; - char tag5 [TAG_SIZE] ; - } ; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -struct FREE_CHUNK_TABLE { - char start_tag [TAG_SIZE] ; - struct DISK_POINTER small_first_block ; - struct DISK_POINTER small_last_block ; - struct DISK_POINTER medium_first_block ; - struct DISK_POINTER medium_last_block ; - struct DISK_POINTER large_first_block ; - struct DISK_POINTER large_last_block ; - char end_tag [TAG_SIZE] ; - } ; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -struct FREE_CHUNK { - char start_tag [TAG_SIZE] ; - struct DISK_POINTER end_of_chunk_tag ; - struct DISK_POINTER next_chunk ; - char end_tag [TAG_SIZE] ; - } ; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -struct NODE_HEADER { - char node_start_tag [TAG_SIZE] ; - char name [ADF_NAME_LENGTH] ; - char label [ADF_LABEL_LENGTH] ; - unsigned int num_sub_nodes ; - unsigned int entries_for_sub_nodes ; - struct DISK_POINTER sub_node_table ; - char data_type [ADF_DATA_TYPE_LENGTH] ; - unsigned int number_of_dimensions ; - unsigned int dimension_values [ADF_MAX_DIMENSIONS] ; - unsigned int number_of_data_chunks ; - struct DISK_POINTER data_chunks ; - char node_end_tag [TAG_SIZE] ; - } ; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -struct DATA_CHUNK_TABLE_ENTRY { - struct DISK_POINTER start ; - struct DISK_POINTER end ; - } ; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -struct SUB_NODE_TABLE_ENTRY { - char child_name[ ADF_NAME_LENGTH ] ; - struct DISK_POINTER child_location ; - } ; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -struct TOKENIZED_DATA_TYPE { - char type[2] ; - int file_type_size ; - int machine_type_size ; - unsigned long length ; - } ; -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -/*********************************************************************** - Prototypes for Internal CORE Utility Routines -***********************************************************************/ - -#if defined (__cplusplus) - extern "C" { -#endif - -extern void ADFI_Abort( - const int error_code ) ; - -extern void ADFI_ASCII_Hex_2_unsigned_int( - const unsigned int minimum, - const unsigned int maximum, - const unsigned int string_length, - const char string[], - unsigned int *number, - int *error_return ) ; - -extern void ADFI_add_2_sub_node_table( - const int file_index, - const struct DISK_POINTER *parent, - const struct DISK_POINTER *child, - int *error_return ) ; - -extern void ADFI_adjust_disk_pointer( - struct DISK_POINTER *block_offset, - int *error_return ) ; - -extern void ADFI_big_endian_to_cray( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ); - -extern void ADFI_big_little_endian_swap( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ); - -extern void ADFI_big_endian_32_swap_64( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ); - -extern void ADFI_blank_fill_string( - char *str, - const int length ) ; - -extern void ADFI_chase_link( - const double ID, - double *LID, - unsigned int *file_index, - struct DISK_POINTER *block_offset, - struct NODE_HEADER *node_header, - int *error_return ) ; - -extern void ADFI_check_4_child_name( - const int file_index, - const struct DISK_POINTER *parent, - const char *name, - int *found, - struct DISK_POINTER *sub_node_entry_location, - struct SUB_NODE_TABLE_ENTRY *sub_node_entry, - int *error_return ) ; - -extern void ADFI_check_string_length( - const char *str, - const int max_length, - int *error_return ) ; - -extern void ADFI_close_file( - const int top_file_index, - int *error_return ) ; - -extern void ADFI_compare_node_names( - const char *name, - const char *new_name, - int *names_match, - int *error_return ) ; - -extern void ADFI_convert_number_format( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const int convert_dir, - const struct TOKENIZED_DATA_TYPE *tokenized_data_type, - const unsigned int length, - unsigned char *from_data, - unsigned char *to_data, - int *error_return ) ; - -extern void ADFI_count_total_array_points( - const unsigned int ndim, - const unsigned int dims[], - const int dim_start[], - const int dim_end[], - const int dim_stride[], - unsigned long *total_points, - unsigned long *starting_offset, - int *error_return ) ; - -extern void ADFI_cray_to_big_endian( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ); - -extern void ADFI_cray_to_little_endian( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ); - -extern void ADFI_delete_data( - const int file_index, - const struct NODE_HEADER *node_header, - int *error_return ) ; - -extern void ADFI_delete_from_sub_node_table( - const int file_index, - const struct DISK_POINTER *parent, - const struct DISK_POINTER *child, - int *error_return ) ; - -extern void ADFI_delete_sub_node_table( - const int file_index, - const struct DISK_POINTER *block_offset, - const unsigned int size_sub_node_table, - int *error_return ) ; - -extern void ADFI_disk_pointer_2_ASCII_Hex( - const struct DISK_POINTER *block_offset, - char block[8], - char offset[4], - int *error_return ) ; - -extern void ADFI_disk_pointer_from_ASCII_Hex( - const char block[8], - const char offset[4], - struct DISK_POINTER *block_offset, - int *error_return ) ; - -extern void ADFI_evaluate_datatype( - const int file_index, - const char data_type[], - int *bytes_file, - int *bytes_machine, - struct TOKENIZED_DATA_TYPE *tokenized_data_type, - char *file_format, - char *machine_format, - int *error_return ) ; - -extern void ADFI_figure_machine_format( - const char *format, - char *machine_format, - char *format_to_use, - char *os_to_use, - int *error_return ) ; - -extern void ADFI_file_and_machine_compare( - const int file_index, - const struct TOKENIZED_DATA_TYPE *tokenized_data_type, - int *compare, - int *error_return ) ; - -extern void ADFI_file_block_offset_2_ID( - const int file_index, - const unsigned long file_block, - const unsigned long block_offset, - double *ID, - int *error_return ) ; - -extern void ADFI_file_free( - const int file_index, - const struct DISK_POINTER *block_offset, - const long number_of_bytes, - int *error_return ) ; - -extern void ADFI_file_malloc( - const int file_index, - const long size_bytes, - struct DISK_POINTER *block_offset, - int *error_return ) ; - -extern void ADFI_fill_initial_file_header( - const char format, - const char os_size, - const char *what_string, - struct FILE_HEADER *file_header, - int *error_return ) ; - -extern void ADFI_fill_initial_free_chunk_table( - struct FREE_CHUNK_TABLE *free_chunk_table, - int *error_return ) ; - -extern void ADFI_fill_initial_node_header( - struct NODE_HEADER *node_header, - int *error_return ) ; - -extern void ADFI_fseek_file( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - int *error_return ) ; - -extern void ADFI_get_current_date( - char date[] ) ; - -extern void ADFI_get_direct_children_ids( - const unsigned int file_index, - const struct DISK_POINTER *node_block_offset, - int *num_ids, - double **ids, - int *error_return ) ; - -extern void ADFI_get_file_index_from_name( - const char *file_name, - int *found, - unsigned int *file_index, - double *ID, - int *error_return ) ; - -extern void ADFI_ID_2_file_block_offset( - const double ID, - unsigned int *file_index, - unsigned long *file_block, - unsigned long *block_offset, - int *error_return ) ; - -extern void ADFI_increment_array( - const unsigned int ndim, - const unsigned int dims[], - const int dim_start[], - const int dim_end[], - const int dim_stride[], - int current_position[], - unsigned long *element_offset, - int *error_return ) ; - -extern void ADFI_is_block_in_core() ; - -extern void ADFI_little_endian_to_cray( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ); - -extern void ADFI_little_endian_32_swap_64( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ); - -extern void ADFI_open_file( - const char *file, - const char *status, - const int top_file_index, - unsigned int *file_index, int *error_return ) ; - -extern void ADFI_read_chunk_length( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - char tag[4], - struct DISK_POINTER *end_of_chunk_tag, - int *error_return ) ; - -extern void ADFI_read_data_chunk( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct TOKENIZED_DATA_TYPE *tokenized_data_type, - const int data_size, - const long chunk_bytes, - const long start_offset, - const long total_bytes, - char *data, - int *error_return ) ; - -extern void ADFI_read_data_chunk_table( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct DATA_CHUNK_TABLE_ENTRY data_chunk_table[], - int *error_return ) ; - -extern void ADFI_read_data_translated( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - const struct TOKENIZED_DATA_TYPE *tokenized_data_type, - const int data_size, - const long total_bytes, - char *data, - int *error_return ) ; - -extern void ADFI_read_disk_block() ; - -extern void ADFI_read_disk_pointer_from_disk( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - struct DISK_POINTER *block_and_offset, - int *error_return ) ; - -extern void ADFI_read_file( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - const unsigned int data_length, - char *data, - int *error_return ) ; - -extern void ADFI_read_file_header( - const unsigned int file_index, - struct FILE_HEADER *file_header, - int *error_return ) ; - -extern void ADFI_read_free_chunk( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct FREE_CHUNK *free_chunk, - int *error_return ) ; - -extern void ADFI_read_free_chunk_table( - const unsigned int file_index, - struct FREE_CHUNK_TABLE *free_chunk_table, - int *error_return ) ; - -extern void ADFI_read_node_header( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct NODE_HEADER *node_header, - int *error_return ) ; - -extern void ADFI_read_sub_node_table( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct SUB_NODE_TABLE_ENTRY sub_node_table[], - int *error_return ) ; - -extern void ADFI_read_sub_node_table_entry( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct SUB_NODE_TABLE_ENTRY *sub_node_table_entry, - int *error_return ) ; - -extern void ADFI_remember_file_format( - const int file_index, - const char numeric_format, - const char os_size, - int *error_return ) ; - -extern void ADFI_remember_version_update( - const int file_index, - const char *what_string, - int *error_return ) ; - -extern void ADFI_set_blank_disk_pointer( - struct DISK_POINTER *block_offset) ; - -extern int ADFI_stridx_c( - const char *str1, - const char *str2 ) ; - -extern void ADFI_string_2_C_string( - const char *string, - const int string_length, - char *c_string, - int *error_return ) ; - -extern char *ADFI_strtok( - char *string, - char **string_pos, - char *token ) ; - -extern void ADFI_unsigned_int_2_ASCII_Hex( - const unsigned int number, - const unsigned int minimum, - const unsigned int maximum, - const unsigned int string_length, - char string[], - int *error_return ) ; - -extern void ADFI_write_data_chunk( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - const struct TOKENIZED_DATA_TYPE *tokenized_data_type, - const int data_size, - const long chunk_bytes, - const long start_offset, - const long total_bytes, - const char *data, - int *error_return ) ; - -extern void ADFI_write_data_chunk_table( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - const int number_of_data_chunks, - struct DATA_CHUNK_TABLE_ENTRY data_chunk_table[], - int *error_return ) ; - -extern void ADFI_write_data_translated( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - const struct TOKENIZED_DATA_TYPE *tokenized_data_type, - const int data_size, - const long total_bytes, - const char *data, - int *error_return ) ; - -extern void ADFI_write_disk_block() ; - -extern void ADFI_write_disk_pointer_2_disk( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - const struct DISK_POINTER *block_and_offset, - int *error_return ) ; - -extern void ADFI_write_file( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - const unsigned int data_length, - const char *data, - int *error_return ) ; - -extern void ADFI_write_file_header( - const int file_index, - const struct FILE_HEADER *file_header, - int *error_return ) ; - -extern void ADFI_write_free_chunk( - const int file_index, - const struct DISK_POINTER *block_offset, - const struct FREE_CHUNK *free_chunk, - int *error_return ) ; - -extern void ADFI_write_free_chunk_table( - const int file_index, - const struct FREE_CHUNK_TABLE *free_chunk_table, - int *error_return ) ; - -extern void ADFI_write_modification_date( - const int file_index, - int *error_return ) ; - -extern void ADFI_write_node_header( - const int file_index, - const struct DISK_POINTER *block_offset, - const struct NODE_HEADER *node_header, - int *error_return ) ; - -extern void ADFI_write_sub_node_table( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - const int number_of_sub_nodes, - struct SUB_NODE_TABLE_ENTRY sub_node_table[], - int *error_return ) ; - -extern void ADFI_write_sub_node_table_entry( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct SUB_NODE_TABLE_ENTRY *sub_node_table_entry, - int *error_return ) ; - -extern void ADFI_flush_buffers( - const unsigned int file_index, - int flush_mode, - int *error_return ) ; - -extern void ADFI_flush_caches( - const unsigned int file_index, - int *error_return ) ; - -extern void ADFI_fflush_file( - const unsigned int file_index, - int *error_return ) ; - -extern int ADFI_is_same_file( - int index1, - int index2 ) ; - -extern int ADFI_stack_control( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - const int stack_mode, const int stack_type, - const unsigned long data_length, - char *stack_data ) ; - - -/*********************************************************************** - Prototypes for the FORTRAN to C Interface Routines -***********************************************************************/ -#include "ADF_fbind.h" - -extern void FNAME(adfcna2,ADFCNA2)( - const Fdouble *PID, - const Fint *istart, - const Fint *imaxnum, - const Fint *idim, - const Fint *name_length, - Fint *inum_ret, - Fchar names, - Fint *error_return ) ; - -extern void FNAME(adfcid2,ADFCID2)( - const Fdouble *PID, - const Fint *istart, - const Fint *imaxnum, - Fint *inum_ret, - Fdouble *cIDs, - Fint *error_return ) ; - -extern void FNAME(adfcre2,ADFCRE2)( - const Fdouble *PID, - const Fchar name, - const Fint *name_length, - Fdouble *ID, - Fint *error_return ) ; - -extern void FNAME(adfdcl2,ADFDCL2)( - const Fdouble *Root_ID, - Fint *error_return ) ; - -extern void FNAME(adfdde2,ADFDDE2)( - const Fchar filename, - const Fint *name_length, - Fint *error_return ) ; - -extern void FNAME(adfdgc2,ADFDGC2)( - const Fdouble *ID, - Fint *error_return ) ; - -extern void FNAME(adfdgf2,ADFDGF2)( - const Fdouble *Root_ID, - Fchar format, - const Fint *format_length, - Fint *error_return ) ; - -extern void FNAME(adfdop2,ADFDOP2)( - const Fchar filename, - const Fint *filename_length, - Fchar status_in, - const Fint *status_length, - const Fchar format, - const Fint *format_length, - Fdouble *Root_ID, - Fint *error_return ) ; - -extern void FNAME(adfdsf2,ADFDSF2)( - const Fdouble *Root_ID, - const Fchar format, - const Fint *format_length, - Fint *error_return ) ; - -extern void FNAME(adfdve2,ADFDVE2)( - const Fdouble *Root_ID, - Fchar version, - Fchar creation_date, - Fchar modification_date, - const Fint *v_length, - const Fint *c_length, - const Fint *m_length, - Fint *error_return ) ; - -extern void FNAME(adfdel2,ADFDEL2)( - const Fdouble *PID, - const Fdouble *ID, - Fint *error_return ) ; - -extern void FNAME(adferr2,ADFERR2)( - const Fint *error_return_input, - Fchar error_string, - const Fint *str_length ) ; - -extern void FNAME(adfftd2,ADFFTD2)( - const Fdouble *ID, - Fint *error_return ) ; - -extern void FNAME(adfgdt2,ADFGDT2)( - const Fdouble *ID, - Fchar data_type, - const Fint *data_type_length, - Fint *error_return ) ; - -extern void FNAME(adfgdv2,ADFGDV2)( - const Fdouble *ID, - Fint dim_vals[], - Fint *error_return ) ; - -extern void FNAME(adfges2,ADFGES2)( - Fint *error_state, - Fint *error_return ) ; - -extern void FNAME(adfglb2,ADFGLB2)( - const Fdouble *ID, - Fchar label, - const Fint *label_length, - Fint *error_return ) ; - -extern void FNAME(adfglk2,ADFGLK2)( - const Fdouble *ID, - Fchar filename, - const Fint *filename_length, - Fchar link_path, - const Fint *link_path_length, - Fint *error_return ) ; - -extern void FNAME(adfgna2,ADFGNA2)( - const Fdouble *ID, - Fchar name, - const Fint *name_length, - Fint *error_return ) ; - -extern void FNAME(adfgni2,ADFGNI2)( - const Fdouble *PID, - const Fchar name, - const Fint *name_length, - Fdouble *ID, - Fint *error_return ) ; - -extern void FNAME(adfgnd2,ADFGND2)( - const Fdouble *ID, - Fint *num_dims, - Fint *error_return ) ; - -extern void FNAME(adfgri2,ADFGRI2)( - const Fdouble *ID, - Fdouble *Root_ID, - Fint *error_return ) ; - -extern void FNAME(adfisl2,ADFISL2)( - const Fdouble *ID, - Fint *link_path_length, - Fint *error_return ) ; - -extern void FNAME(adflve2,ADFLVE2)( - Fchar version, - const Fint *version_length, - Fint *error_return ) ; - -extern void FNAME(adflin2,ADFLIN2)( - const Fdouble *PID, - const Fchar name, - const Fchar file, - const Fchar name_in_file, - const Fint *name_length, - const Fint *file_length, - const Fint *nfile_length, - Fdouble *ID, - Fint *error_return ) ; - -extern void FNAME(adfmov2,ADFMOV2)( - const Fdouble *PID, - const Fdouble *ID, - const Fdouble *NPID, - Fint *error_return ) ; - -extern void FNAME(adfncl2,ADFNCL2)( - const Fdouble *ID, - Fint *num_children, - Fint *error_return ) ; - -extern void FNAME(adfpdi2,ADFPDI2)( - const Fdouble *ID, - const Fchar data_type, - const Fint *data_type_length, - const Fint *dims, - const Fint dim_vals[], - Fint *error_return ) ; - -extern void FNAME(adfpna2,ADFPNA2)( - const Fdouble *PID, - const Fdouble *ID, - const Fchar name, - const Fint *name_length, - Fint *error_return ) ; - -extern void FNAME(adfrall,ADFRALL)( - const Fdouble *ID, - Fchar data, - Fint *error_return ) ; - -extern void FNAME(adfrblk,ADFRBLK)( - const Fdouble *ID, - const int *b_start, - const int *b_end, - Fchar data, - Fint *error_return ) ; - -extern void FNAME(adfread,ADFREAD)( - const Fdouble *ID, - const Fint s_start[], - const Fint s_end[], - const Fint s_stride[], - const Fint *m_num_dims, - const Fint m_dims[], - const Fint m_start[], - const Fint m_end[], - const Fint m_stride[], - Fchar data, - Fint *error_return ) ; - -extern void FNAME(adfses2,ADFSES2)( - const Fint *error_state, - Fint *error_return ) ; - -extern void FNAME(adfslb2,ADFSLB2)( - const Fdouble *ID, - const Fchar label, - const Fint *label_length, - Fint *error_return ) ; - -extern void FNAME(adfwall,ADFWALL)( - const Fdouble *ID, - const Fchar data, - Fint *error_return ) ; - -extern void FNAME(adfwblk,ADFWBLK)( - const Fdouble *ID, - const int *b_start, - const int *b_end, - Fchar data, - Fint *error_return ) ; - -extern void FNAME(adfwrit,ADFWRIT)( - const Fdouble *ID, - const Fint s_start[], - const Fint s_end[], - const Fint s_stride[], - const Fint *m_num_dims, - const Fint m_dims[], - const Fint m_start[], - const Fint m_end[], - const Fint m_stride[], - const Fchar data, - Fint *error_return ) ; - - - -#if defined (__cplusplus) - } -#endif - -#endif diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_internals.mod.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_internals.mod.c deleted file mode 100644 index 199acfc024..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_internals.mod.c +++ /dev/null @@ -1,9803 +0,0 @@ -#include -#include -#include -#include -#define kTimerNameMaxChars 255 -struct _Timer { - char name[kTimerNameMaxChars+1]; - struct timeval start; - struct timeval end; - double time; - long iterations; -}; -typedef struct _Timer Timer; -void tCreate(Timer *t, char *name) -{ - strncpy(t->name, name, kTimerNameMaxChars); - t->name[kTimerNameMaxChars] = '\0'; - t->iterations = 0; - t->time = 0.0; -} - -void tStart(Timer *t) -{ - gettimeofday(&t->start, 0); -} - -void tEnd(Timer *t) -{ - gettimeofday(&t->end, 0); - - struct timeval dt; - if ((dt.tv_usec = t->end.tv_usec - t->start.tv_usec) < 0) - { - dt.tv_usec += 1000000; - dt.tv_sec = t->end.tv_sec - t->start.tv_sec - 1; - } - else - dt.tv_sec = t->end.tv_sec - t->start.tv_sec; - - t->time += dt.tv_sec + dt.tv_usec * 1.0e-6; - t->iterations++; -} - -void tPrint(Timer *t) -{ - int i, nTabsAvoided = strlen(t->name) / 8; - char tabStr[] = " "; - for (i = 0; i < 5 - nTabsAvoided; ++i) - tabStr[i] = '\t'; - tabStr[i] = '\0'; - printf("%s%s%d\t%f\n", t->name, tabStr, t->iterations, t->time); -} - -Timer gADFI_add_2_sub_node_table_Timer; -Timer gADFI_add_2_sub_node_table_fmalloc_Timer; -Timer gADFI_add_2_sub_node_table_write_child_Timer; -Timer gADFI_add_2_sub_node_table_update_parent_Timer; -Timer gADFI_adjust_disk_pointer_Timer; -Timer gADFI_check_4_child_name_Timer; -Timer gADFI_close_file_Timer; -Timer gADFI_delete_data_Timer; -Timer gADFI_delete_from_sub_node_table_Timer; -Timer gADFI_delete_sub_node_table_Timer; -Timer gADFI_evaluate_datatype_Timer; -Timer gADFI_fflush_file_Timer; -Timer gADFI_file_and_machine_compare_Timer; -Timer gADFI_file_free_Timer; -Timer gADFI_file_free_free_Timer; -Timer gADFI_file_malloc_Timer; -Timer gADFI_flush_buffers_Timer; -Timer gADFI_fseek_file_Timer; -Timer gADFI_get_direct_children_ids_Timer; -Timer gADFI_open_file_Timer; -Timer gADFI_read_chunk_length_Timer; -Timer gADFI_read_data_chunk_Timer; -Timer gADFI_read_data_chunk_table_Timer; -Timer gADFI_read_data_translated_Timer; -Timer gADFI_read_disk_pointer_from_disk_Timer; -Timer gADFI_read_file_Timer; -Timer gADFI_read_file_header_Timer; -Timer gADFI_read_free_chunk_Timer; -Timer gADFI_read_free_chunk_table_Timer; -Timer gADFI_read_node_header_Timer; -Timer gADFI_read_sub_node_table_Timer; -Timer gADFI_read_sub_node_table_entry_Timer; -Timer gADFI_write_data_chunk_Timer; -Timer gADFI_write_data_chunk_table_Timer; -Timer gADFI_write_data_translated_Timer; -Timer gADFI_write_disk_pointer_2_disk_Timer; -Timer gADFI_write_file_Timer; -Timer gADFI_write_file_fseek_Timer; -Timer gADFI_write_file_flush_Timer; -Timer gADFI_write_file_flush_fwrite_Timer; -Timer gADFI_write_file_large_Timer; -Timer gADFI_write_file_small_Timer; -Timer gADFI_write_file_header_Timer; -Timer gADFI_write_free_chunk_Timer; -Timer gADFI_write_free_chunk_table_Timer; -Timer gADFI_write_modification_date_Timer; -Timer gADFI_write_node_header_Timer; -Timer gADFI_write_node_header_write_Timer; -Timer gADFI_write_sub_node_table_Timer; -Timer gADFI_write_sub_node_table_entry_Timer; - -Timer gADF_Create_Node_Timer; -Timer gADF_Create_Node_Prep_Timer; -Timer gADF_Create_Node_Write_Timer; -Timer gADF_Create_Node_After_Timer; -Timer gADF_Create_Node_With_Label_Timer; -Timer gADF_Create_Node_With_Label_Prep_Timer; -Timer gADF_Create_Node_With_Label_Write_Timer; -Timer gADF_Create_Node_With_Label_After_Timer; -Timer gADF_Children_Names_Timer; -Timer gADF_Children_IDs_Timer; -Timer gADF_Database_Close_Timer; -Timer gADF_Database_Get_Format_Timer; -Timer gADF_Database_Open_Timer; -Timer gADF_Database_Set_Format_Timer; -Timer gADF_Database_Version_Timer; -Timer gADF_Delete_Timer; -Timer gADF_Get_Data_Type_Timer; -Timer gADF_Get_Dimension_Values_Timer; -Timer gADF_Get_Label_Timer; -Timer gADF_Get_Link_Path_Timer; -Timer gADF_Get_Name_Timer; -Timer gADF_Get_Node_ID_Timer; -Timer gADF_Get_Number_of_Dimensions_Timer; -Timer gADF_Get_Root_ID_Timer; -Timer gADF_Is_Link_Timer; -Timer gADF_Number_of_Children_Timer; -Timer gADF_Put_Dimension_Information_Timer; -Timer gADF_Put_Name_Timer; -Timer gADF_Read_All_Data_Timer; -Timer gADF_Read_Block_Data_Timer; -Timer gADF_Read_Data_Timer; -Timer gADF_Set_Label_Timer; -Timer gADF_Write_All_Data_Timer; -Timer gADF_Write_Block_Data_Timer; -Timer gADF_Write_Data_Timer; - -void tCreateAll() -{ - tCreate(&gADFI_add_2_sub_node_table_Timer, "ADFI_add_2_sub_node_table"); - tCreate(&gADFI_add_2_sub_node_table_fmalloc_Timer, "ADFI_add_2_sub_node_table (file malloc)"); - tCreate(&gADFI_add_2_sub_node_table_write_child_Timer, "ADFI_add_2_sub_node_table (child)"); - tCreate(&gADFI_add_2_sub_node_table_update_parent_Timer, "ADFI_add_2_sub_node_table (parent)"); - tCreate(&gADFI_adjust_disk_pointer_Timer, "ADFI_adjust_disk_pointer"); - tCreate(&gADFI_check_4_child_name_Timer, "ADFI_check_4_child_name"); - tCreate(&gADFI_close_file_Timer, "ADFI_close_file"); - tCreate(&gADFI_delete_data_Timer, "ADFI_delete_data"); - tCreate(&gADFI_delete_from_sub_node_table_Timer, "ADFI_delete_from_sub_node_table"); - tCreate(&gADFI_delete_sub_node_table_Timer, "ADFI_delete_sub_node_table"); - tCreate(&gADFI_evaluate_datatype_Timer, "ADFI_evaluate_datatype"); - tCreate(&gADFI_fflush_file_Timer, "ADFI_fflush_file"); - tCreate(&gADFI_file_and_machine_compare_Timer, "ADFI_file_and_machine_compare"); - tCreate(&gADFI_file_free_Timer, "ADFI_file_free"); - tCreate(&gADFI_file_free_free_Timer, "ADFI_file_free free part"); - tCreate(&gADFI_file_malloc_Timer, "ADFI_file_malloc"); - tCreate(&gADFI_flush_buffers_Timer, "ADFI_flush_buffers"); - tCreate(&gADFI_fseek_file_Timer, "ADFI_fseek_file"); - tCreate(&gADFI_get_direct_children_ids_Timer, "ADFI_get_direct_children_ids"); - tCreate(&gADFI_open_file_Timer, "ADFI_open_file"); - tCreate(&gADFI_read_chunk_length_Timer, "ADFI_read_chunk_length"); - tCreate(&gADFI_read_data_chunk_Timer, "ADFI_read_data_chunk"); - tCreate(&gADFI_read_data_chunk_table_Timer, "ADFI_read_data_chunk_table"); - tCreate(&gADFI_read_data_translated_Timer, "ADFI_read_data_translated"); - tCreate(&gADFI_read_disk_pointer_from_disk_Timer, "ADFI_read_disk_pointer_from_disk"); - tCreate(&gADFI_read_file_Timer, "ADFI_read_file"); - tCreate(&gADFI_read_file_header_Timer, "ADFI_read_file_header"); - tCreate(&gADFI_read_free_chunk_Timer, "ADFI_read_free_chunk"); - tCreate(&gADFI_read_free_chunk_table_Timer, "ADFI_read_free_chunk_table"); - tCreate(&gADFI_read_node_header_Timer, "ADFI_read_node_header"); - tCreate(&gADFI_read_sub_node_table_Timer, "ADFI_read_sub_node_table"); - tCreate(&gADFI_read_sub_node_table_entry_Timer, "ADFI_read_sub_node_table_entry"); - tCreate(&gADFI_write_data_chunk_Timer, "ADFI_write_data_chunk"); - tCreate(&gADFI_write_data_chunk_table_Timer, "ADFI_write_data_chunk_table"); - tCreate(&gADFI_write_data_translated_Timer, "ADFI_write_data_translated"); - tCreate(&gADFI_write_disk_pointer_2_disk_Timer, "ADFI_write_disk_pointer_2_disk"); - tCreate(&gADFI_write_file_Timer, "ADFI_write_file"); - tCreate(&gADFI_write_file_fseek_Timer, "ADFI_write_file (fseek)"); - tCreate(&gADFI_write_file_flush_Timer, "ADFI_write_file (flush)"); - tCreate(&gADFI_write_file_flush_fwrite_Timer, "ADFI_write_file (flush - fwrite)"); - tCreate(&gADFI_write_file_small_Timer, "ADFI_write_file (small)"); - tCreate(&gADFI_write_file_large_Timer, "ADFI_write_file (large)"); - tCreate(&gADFI_write_file_header_Timer, "ADFI_write_file_header"); - tCreate(&gADFI_write_free_chunk_Timer, "ADFI_write_free_chunk"); - tCreate(&gADFI_write_free_chunk_table_Timer, "ADFI_write_free_chunk_table"); - tCreate(&gADFI_write_modification_date_Timer, "ADFI_write_modification_date"); - tCreate(&gADFI_write_node_header_Timer, "ADFI_write_node_header"); - tCreate(&gADFI_write_node_header_write_Timer, "ADFI_write_node_header (write)"); - tCreate(&gADFI_write_sub_node_table_Timer, "ADFI_write_sub_node_table"); - tCreate(&gADFI_write_sub_node_table_entry_Timer, "ADFI_write_sub_node_table_entry"); - - tCreate(&gADF_Create_Node_Timer, "ADF_Create_Node"); - tCreate(&gADF_Create_Node_Prep_Timer, "ADF_Create_Node (preparation)"); - tCreate(&gADF_Create_Node_Write_Timer, "ADF_Create_Node (file write)"); - tCreate(&gADF_Create_Node_After_Timer, "ADF_Create_Node (after write)"); - tCreate(&gADF_Create_Node_With_Label_Timer, "ADF_Create_Node_With_Label"); - tCreate(&gADF_Create_Node_With_Label_Prep_Timer, "ADF_Create_Node_With_Label (preparation)"); - tCreate(&gADF_Create_Node_With_Label_Write_Timer, "ADF_Create_Node_With_Label (file write)"); - tCreate(&gADF_Create_Node_With_Label_After_Timer, "ADF_Create_Node_With_Label (after write)"); - tCreate(&gADF_Children_Names_Timer, "ADF_Children_Names"); - tCreate(&gADF_Children_IDs_Timer, "ADF_Children_IDs"); - tCreate(&gADF_Database_Close_Timer, "ADF_Database_Close"); - tCreate(&gADF_Database_Get_Format_Timer, "ADF_Database_Get_Format"); - tCreate(&gADF_Database_Open_Timer, "ADF_Database_Open"); - tCreate(&gADF_Database_Set_Format_Timer, "ADF_Database_Set_Format"); - tCreate(&gADF_Database_Version_Timer, "ADF_Database_Version"); - tCreate(&gADF_Delete_Timer, "ADF_Delete"); - tCreate(&gADF_Get_Data_Type_Timer, "ADF_Get_Data_Type"); - tCreate(&gADF_Get_Dimension_Values_Timer, "ADF_Get_Dimension_Values"); - tCreate(&gADF_Get_Label_Timer, "ADF_Get_Label"); - tCreate(&gADF_Get_Link_Path_Timer, "ADF_Get_Link_Path"); - tCreate(&gADF_Get_Name_Timer, "ADF_Get_Name"); - tCreate(&gADF_Get_Node_ID_Timer, "ADF_Get_Node_ID"); - tCreate(&gADF_Get_Number_of_Dimensions_Timer, "ADF_Get_Number_of_Dimensions"); - tCreate(&gADF_Get_Root_ID_Timer, "ADF_Get_Root_ID"); - tCreate(&gADF_Is_Link_Timer, "ADF_Is_Link"); - tCreate(&gADF_Number_of_Children_Timer, "ADF_Number_of_Children"); - tCreate(&gADF_Put_Dimension_Information_Timer, "ADF_Put_Dimension_Information"); - tCreate(&gADF_Put_Name_Timer, "ADF_Put_Name"); - tCreate(&gADF_Read_All_Data_Timer, "ADF_Read_All_Data"); - tCreate(&gADF_Read_Block_Data_Timer, "ADF_Read_Block_Data"); - tCreate(&gADF_Read_Data_Timer, "ADF_Read_Data"); - tCreate(&gADF_Set_Label_Timer, "ADF_Set_Label"); - tCreate(&gADF_Write_All_Data_Timer, "ADF_Write_All_Data"); - tCreate(&gADF_Write_Block_Data_Timer, "ADF_Write_Block_Data"); - tCreate(&gADF_Write_Data_Timer, "ADF_Write_Data"); -} -void tPrintAll() -{ - tPrint(&gADFI_add_2_sub_node_table_Timer); - tPrint(&gADFI_add_2_sub_node_table_fmalloc_Timer); - tPrint(&gADFI_add_2_sub_node_table_write_child_Timer); - tPrint(&gADFI_add_2_sub_node_table_update_parent_Timer); - tPrint(&gADFI_adjust_disk_pointer_Timer); - tPrint(&gADFI_check_4_child_name_Timer); - tPrint(&gADFI_close_file_Timer); - tPrint(&gADFI_delete_data_Timer); - tPrint(&gADFI_delete_from_sub_node_table_Timer); - tPrint(&gADFI_delete_sub_node_table_Timer); - tPrint(&gADFI_evaluate_datatype_Timer); - tPrint(&gADFI_fflush_file_Timer); - tPrint(&gADFI_file_and_machine_compare_Timer); - tPrint(&gADFI_file_free_Timer); - tPrint(&gADFI_file_free_free_Timer); - tPrint(&gADFI_file_malloc_Timer); - tPrint(&gADFI_flush_buffers_Timer); - tPrint(&gADFI_fseek_file_Timer); - tPrint(&gADFI_get_direct_children_ids_Timer); - tPrint(&gADFI_open_file_Timer); - tPrint(&gADFI_read_chunk_length_Timer); - tPrint(&gADFI_read_data_chunk_Timer); - tPrint(&gADFI_read_data_chunk_table_Timer); - tPrint(&gADFI_read_data_translated_Timer); - tPrint(&gADFI_read_disk_pointer_from_disk_Timer); - tPrint(&gADFI_read_file_Timer); - tPrint(&gADFI_read_file_header_Timer); - tPrint(&gADFI_read_free_chunk_Timer); - tPrint(&gADFI_read_free_chunk_table_Timer); - tPrint(&gADFI_read_node_header_Timer); - tPrint(&gADFI_read_sub_node_table_Timer); - tPrint(&gADFI_read_sub_node_table_entry_Timer); - tPrint(&gADFI_write_data_chunk_Timer); - tPrint(&gADFI_write_data_chunk_table_Timer); - tPrint(&gADFI_write_data_translated_Timer); - tPrint(&gADFI_write_disk_pointer_2_disk_Timer); - tPrint(&gADFI_write_file_Timer); - tPrint(&gADFI_write_file_fseek_Timer); - tPrint(&gADFI_write_file_flush_Timer); - tPrint(&gADFI_write_file_flush_fwrite_Timer); - tPrint(&gADFI_write_file_small_Timer); - tPrint(&gADFI_write_file_large_Timer); - tPrint(&gADFI_write_file_header_Timer); - tPrint(&gADFI_write_free_chunk_Timer); - tPrint(&gADFI_write_free_chunk_table_Timer); - tPrint(&gADFI_write_modification_date_Timer); - tPrint(&gADFI_write_node_header_Timer); - tPrint(&gADFI_write_node_header_write_Timer); - tPrint(&gADFI_write_sub_node_table_Timer); - tPrint(&gADFI_write_sub_node_table_entry_Timer); - printf("\n"); - tPrint(&gADF_Create_Node_Timer); - tPrint(&gADF_Create_Node_Prep_Timer); - tPrint(&gADF_Create_Node_Write_Timer); - tPrint(&gADF_Create_Node_After_Timer); - tPrint(&gADF_Create_Node_With_Label_Timer); - tPrint(&gADF_Create_Node_With_Label_Prep_Timer); - tPrint(&gADF_Create_Node_With_Label_Write_Timer); - tPrint(&gADF_Create_Node_With_Label_After_Timer); - tPrint(&gADF_Children_Names_Timer); - tPrint(&gADF_Children_IDs_Timer); - tPrint(&gADF_Database_Close_Timer); - tPrint(&gADF_Database_Get_Format_Timer); - tPrint(&gADF_Database_Open_Timer); - tPrint(&gADF_Database_Set_Format_Timer); - tPrint(&gADF_Database_Version_Timer); - tPrint(&gADF_Delete_Timer); - tPrint(&gADF_Get_Data_Type_Timer); - tPrint(&gADF_Get_Dimension_Values_Timer); - tPrint(&gADF_Get_Label_Timer); - tPrint(&gADF_Get_Link_Path_Timer); - tPrint(&gADF_Get_Name_Timer); - tPrint(&gADF_Get_Node_ID_Timer); - tPrint(&gADF_Get_Number_of_Dimensions_Timer); - tPrint(&gADF_Get_Root_ID_Timer); - tPrint(&gADF_Is_Link_Timer); - tPrint(&gADF_Number_of_Children_Timer); - tPrint(&gADF_Put_Dimension_Information_Timer); - tPrint(&gADF_Put_Name_Timer); - tPrint(&gADF_Read_All_Data_Timer); - tPrint(&gADF_Read_Block_Data_Timer); - tPrint(&gADF_Read_Data_Timer); - tPrint(&gADF_Set_Label_Timer); - tPrint(&gADF_Write_All_Data_Timer); - tPrint(&gADF_Write_Block_Data_Timer); - tPrint(&gADF_Write_Data_Timer); - printf("\n"); -} - - -/* created by combine 2.0 */ -/* file ADFI_AAA_var.c */ -/*** -File: ADF_internals.c - ---------------------------------------------------------------------- - BOEING - ---------------------------------------------------------------------- - Project: CGNS - Author: Tom Dickens 234-1024 tpd6908@yak.ca.boeing.com - Date: 3/2/1995 - Purpose: Provide the underlying support for the ADF-Core. - ---------------------------------------------------------------------- - ---------------------------------------------------------------------- -Notes: Integer numbers are stored on disk as ASCII-hex numbers. - 2 bytes gives a number from 0 to 255, - 4 bytes 0 to 65,535, - 8 bytes 0 to 4,294,967,295, - and 12 bytes from 0 to 281,474,976,710,655. - -Pointers are 12 bytes. - 8 bytes pointing to a 4096-byte chunk on disk, - and 4 bytes is an offset into that chunk. -This gives a maximum file size of 17,592,186,048,512 bytes (17.5 Tera bytes). - - ---------------------------------------------------------------------- - The tables below detail the format of the information which - makes up the ADF file. - - There are 7 different, unique types of data "chunks" used. - Three of these are of fixed length, and the other four are - variable in length. - - With the exception of numeric data (user's data), all information - in an ADF file is written in ASCII. - - Uniquely-defined boundary-tags are used to surround all "chunks" - of information. These tags are checked to confirm "chunk" type - and also to ensure data integrity. - ---------------------------------------------------------------------- - 186 Physical disk-First block -bytes start end description range / format - 32 0 31 "what" description "@(#)ADF Database Version AXXxxx>" - 4 32 35 "AdF0" boundary tag Tag - 28 36 63 Creation date/time "Wed Apr 19 09:33:25 1995 " - 4 64 67 "AdF1" boundary tag Tag - 28 68 95 Modification date/time "Wed Apr 19 09:33:29 1995 " - 4 96 99 "AdF2" boundary tag Tag - 1 100 100 Numeric format ['B', 'L', 'C', 'N'] - 1 101 101 Duplicate of numeric format ['B', 'L', 'C', 'N'] - 4 102 105 "AdF3" boundary tag Tag - 2 106 107 sizeof( char ) 0 to 255 - 2 108 109 sizeof( short ) 0 to 255 - 2 110 111 sizeof( int ) 0 to 255 - 2 112 113 sizeof( long ) 0 to 255 - 2 114 115 sizeof( float ) 0 to 255 - 2 116 117 sizeof( double ) 0 to 255 - 2 118 119 sizeof( char * ) 0 to 255 - 2 120 121 sizeof( short * ) 0 to 255 - 2 122 123 sizeof( int *) 0 to 255 - 2 124 125 sizeof( long * ) 0 to 255 - 2 126 127 sizeof( float *) 0 to 255 - 2 128 129 sizeof( double *) 0 to 255 - 4 130 133 "AdF4" boundary tag Tag - 12 134 145 Root-node header pointer Disk chunk, chunk offset. - 12 146 157 End-of-File pointer Disk chunk, chunk offset. - 12 158 169 Free-Chunk table pointer Disk chunk, chunk offset. - 12 170 181 Extra pointer Disk chunk, chunk offset. - 4 182 185 "AdF5" boundary tag Tag - - - 80 Free-Chunk table -bytes start end description range / format - 4 0 3 "fCbt" boundary tag Tag - 12 4 15 First small block pointer Disk chunk, chunk offset. - 12 16 27 Last small block pointer Disk chunk, chunk offset. - 12 28 39 First medium block pointer Disk chunk, chunk offset. - 12 40 51 Last medium block pointer Disk chunk, chunk offset. - 12 52 63 First large block pointer Disk chunk, chunk offset. - 12 64 75 Last large block pointer Disk chunk, chunk offset. - 4 76 79 "fcte" boundarg tag Tag - - - Variable: min 32 Free Chunk -bytes start end description range / format - 4 0 3 "FreE" boundary tag Tag - 12 4 15 Pointer to End-of-Chunk-Tag - 12 16 27 Pointer to Next-Chunk in list - 0 28 - more free space - 4 28 31 "EndC" boundarg tag Tag - -Note: There can occur other free space "gas" in the file which are smaller - than the 32-bytes needed to have tags and pointers. The convention - in these cases is to just fill the entire free space with the letter - z, lower-case. - - 246 Node header -bytes start end description range / format - 4 0 3 "NoDe" boundary tag Tag - 32 4 35 Name Text: Blank filled - 32 36 67 Label Text: Blank filled - 8 68 75 Number of sub-nodes 0 to 4,294,967,295 - 8 76 83 Entries for sub-nodes 0 to 4,294,967,295 - 12 84 95 Pointer to sub-node table Disk chunk, chunk offset. - 32 96 127 Data-type Text: Blank filled - 2 128 129 Number of dimensions 0 to 12 - 8 130 137 Dimension value 0 0 to 4,294,967,295 - 8 138 145 Dimension value 1 0 to 4,294,967,295 - 8 146 153 Dimension value 2 0 to 4,294,967,295 - 8 154 161 Dimension value 3 0 to 4,294,967,295 - 8 162 169 Dimension value 4 0 to 4,294,967,295 - 8 170 177 Dimension value 5 0 to 4,294,967,295 - 8 178 185 Dimension value 6 0 to 4,294,967,295 - 8 186 193 Dimension value 7 0 to 4,294,967,295 - 8 194 201 Dimension value 8 0 to 4,294,967,295 - 8 202 209 Dimension value 9 0 to 4,294,967,295 - 8 210 217 Dimension value 10 0 to 4,294,967,295 - 8 218 225 Dimension value 11 0 to 4,294,967,295 - 4 226 229 Number of data chunks 0 to 65,535 - 12 230 241 Pointer to data chunk (or table) Disk chunk, chunk offset. - 4 242 245 "TaiL" boundary tag Tag - - - Variable: min 64 Sub-node table -bytes start end description range / format - 4 0 3 "SNTb" boundary tag Tag - 12 4 15 Pointer to End-of-Table-Tag - 32 16 47 Child's name Text: Blank filled - 12 48 59 Pointer to child Disk chunk, chunk offset. - 32 - - Child's name Text: Blank filled - 12 - - Pointer to child Disk chunk, chunk offset. - 32 - - Child's name Text: Blank filled - 12 - - Pointer to child Disk chunk, chunk offset. - 32 - - Child's name Text: Blank filled - 12 - - Pointer to child Disk chunk, chunk offset. - 32 - - Child's name Text: Blank filled - 12 - - Pointer to child Disk chunk, chunk offset. - 32 - - Child's name Text: Blank filled - 12 - - Pointer to child Disk chunk, chunk offset. - 4 60 63 "snTE" boundary tag Tag - - - Variable: min 44 Data-chunk table -bytes start end description range / format - 4 0 3 "DCtb" boundary tag Tag - 12 4 15 Pointer to End-of-Table-Tag - 12 16 27 Pointer to data start Disk chunk, chunk offset. - 12 28 39 Pointer to data end Disk chunk, chunk offset. - 12 - - Pointer to data start Disk chunk, chunk offset. - 12 - - Pointer to data end Disk chunk, chunk offset. - 12 - - Pointer to data start Disk chunk, chunk offset. - 12 - - Pointer to data end Disk chunk, chunk offset. - 12 - - Pointer to data start Disk chunk, chunk offset. - 12 - - Pointer to data end Disk chunk, chunk offset. - 4 40 43 "dcTE" boundarg tag Tag - - - Variable: min 32 Data-chunks -(Minimum is 32 bytes, which cooresponds to the size required for a free-chunk) -bytes start end description range / format - 4 0 3 "DaTa" boundary tag Tag - 12 4 15 Pointer to End-of-Data-Tag - 16 16 27 The data - 4 28 31 "dEnD" boundarg tag Tag - -**/ -/*********************************************************************** - Includes -***********************************************************************/ -#ifndef MAKEDEPEND -#include -#include -#include -#include -#include -#include -#if defined(_WIN32) && !defined(__NUTC__) -#include -#include -#else -#include -#include -#endif -#endif - -#include "ADF.h" -#include "ADF_internals.h" - -/*********************************************************************** - Character string defining the data tags: -***********************************************************************/ -/* These were moved from ADF_internals.h since they are only used here - and leaving them here gives warning messages when the other .c files - are compiled. WRO 2005-Jan-11 */ -static char *file_header_tags[] = { - "AdF0", "AdF1", "AdF2", "AdF3", "AdF4", "AdF5" } ; -static char node_start_tag[] = "NoDe" ; -static char node_end_tag[] = "TaiL" ; -static char free_chunk_table_start_tag[] = "fCbt" ; -static char free_chunk_table_end_tag[] = "Fcte" ; - -static char free_chunk_start_tag[] = "FreE" ; -static char free_chunk_end_tag[] = "EndC" ; -static char sub_node_start_tag[] = "SNTb" ; -static char sub_node_end_tag[] = "snTE" ; -static char data_chunk_table_start_tag[] = "DCtb" ; -static char data_chunk_table_end_tag[] = "dcTE" ; -static char data_chunk_start_tag[] = "DaTa" ; -static char data_chunk_end_tag[] = "dEnD" ; - -/*********************************************************************** - Global variables: - file_in_use: Used to track the files currently in use. - 0 if file is NOT in use. - 1 if file IS in use. - first_file_in_system: If a file is opened which is a sub-tree - of a parent ADF structure, first_file_in_system is the index - of the top parent file. - ADF_FILE: The system-returned file descriptor of an opened file. - names_of_files: Names of opened files. - file_open_mode: The mode the file was opened in. - file_version_update: If library file version is greater than - file version, library file version (what-string) is temporarily - stored in this array to update to the file. The file only - needs its version updated once while open, so don't expect the - version to persist until file closing. Otherwise, the first - byte in the string is null ('\0'). -***********************************************************************/ -static unsigned char file_in_use[ MAXIMUM_FILES] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 - } ; - - /** We need to track the top file in a system so that when the - system is closed, all files associated with it can also be closed. - **/ -static int first_file_in_system[MAXIMUM_FILES] ; -static FILE *ADF_file[MAXIMUM_FILES] ; -static char names_of_files[MAXIMUM_FILES][ADF_FILENAME_LENGTH] ; -static char file_open_mode[MAXIMUM_FILES][10] ; -static char file_version_update[MAXIMUM_FILES][WHAT_STRING_SIZE+1]; - - /** Track the format of this machine as well as the format - of eack of the files. This is used for reading and - writing numeric data associated with the nodes, which may - include numeric-format translations. - **/ -static char ADF_file_format[MAXIMUM_FILES] ; -static char ADF_file_os_size[MAXIMUM_FILES] ; -static char ADF_this_machine_format = UNDEFINED_FORMAT_CHAR ; -static char ADF_this_machine_os_size = UNDEFINED_FORMAT_CHAR ; - -struct FILE_HEADER_CACHE { - struct FILE_HEADER header; - int initialized; - int fd; -}; - -struct FREE_CHUNK_TABLE_CACHE { - struct FREE_CHUNK_TABLE table; - int initialized; - int fd; -}; - - /** Cache the file headers so we don't keep writing them out. - This speeds up writes over NFS, particularly on Linux 2.4 **/ -static struct FILE_HEADER_CACHE *file_header_cache[MAXIMUM_FILES] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 - } ; - - /** Cache the free chunk table. */ -static struct FREE_CHUNK_TABLE_CACHE *free_chunk_table_cache[MAXIMUM_FILES] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 - } ; - - /** Cache the last node. This will likely reduce the number of - headers written when by ADFI_add_2_sub_node_table(), which - just updates the number of children. **/ -static char node_header_cache[MAXIMUM_FILES][NODE_HEADER_SIZE] ; -static struct DISK_POINTER cached_node_header_location[MAXIMUM_FILES] ; - - /** we need a block of "zz"-bytes for dead-space **/ -static char block_of_ZZ[ SMALLEST_CHUNK_SIZE ] ; -static int block_of_ZZ_initialized = FALSE ; - /** we need a block of "xx"-bytes for free-blocks **/ -static char block_of_XX[ DISK_BLOCK_SIZE ] ; -static int block_of_XX_initialized = FALSE ; - /** we need a block of null-bytes for disk conditioning **/ -static char block_of_00[ DISK_BLOCK_SIZE ] ; -static int block_of_00_initialized = FALSE ; - - /** read/write conversion buffer **/ -#define CONVERSION_BUFF_SIZE 100000 -static unsigned char from_to_data[ CONVERSION_BUFF_SIZE ] ; - - /** read/write buffering variables **/ -static char rd_block_buffer[DISK_BLOCK_SIZE] ; -static long last_rd_block = -1 ; -static long last_rd_file = -1 ; -static long num_in_rd_block = -1 ; -static char wr_block_buffer[DISK_BLOCK_SIZE] ; -static long last_wr_block = -2 ; -static long last_wr_file = -2 ; -static int flush_wr_block = -2 ; -static double last_link_ID = 0.0; -static double last_link_LID = 0.0; -enum { FLUSH, FLUSH_CLOSE }; - - /** Assumed machine variable sizes for the currently supported - machines. For ordering of data see the Figure_Machine_Format - function. Note that when openning a new file not in the machine - format these are the sizes used!! **/ -enum { TO_FILE_FORMAT, FROM_FILE_FORMAT } ; -#define NUMBER_KNOWN_MACHINES 5 -static size_t machine_sizes[NUMBER_KNOWN_MACHINES][16] = { - /* IEEE BIG 32 */ { 1, 1, 1, 2, 2, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4 }, - /* IEEE SML 32 */ { 1, 1, 1, 2, 2, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4 }, - /* IEEE BIG 64 */ { 1, 1, 1, 2, 2, 4, 4, 8, 8, 4, 8, 8, 8, 8, 8, 8 }, - /* IEEE SML 64 */ { 1, 1, 1, 2, 2, 4, 4, 8, 8, 4, 8, 8, 8, 8, 8, 8 }, - /* CRAY 64 */ { 1, 1, 1, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 } } ; - -/*********************************************************************** - pows: Powers of 16, from 16^0 to 16^7 - ASCII_Hex: Hex numbers from 0 to 15. -***********************************************************************/ -static const unsigned int pows[8] = { /** Powers of 16 **/ - 1, 16, 256, 4096, 65536, 1048576, 16777216, 268435456 } ; -static const char ASCII_Hex[16] = { - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' } ; - -/*********************************************************************** - Priority Stack Buffer is used to buffer some of the overhead of - reading small blocks of file control information like the node - header by saving the data into a memory buffer. The buffer has - a priority value associated with it and is used to determine - which entry to replace when the stack is full!! Each stack entry - could be as large as 274 bytes since the stack data could be for - a node where NODE_HEADER_SIZE = 246. -***********************************************************************/ -#define MAX_STACK 50 -static struct { - int file_index; - unsigned int file_block; - unsigned int block_offset; - int stack_type; - char *stack_data; - int priority_level; -} PRISTK[MAX_STACK] ; -static int STACK_INIT=-1; -/* Define stack types */ -enum { FILE_STK=1, NODE_STK, DISK_PTR_STK, FREE_CHUNK_STK, SUBNODE_STK }; -/* Define stack control modes */ -enum { INIT_STK, CLEAR_STK, CLEAR_STK_TYPE, DEL_STK_ENTRY, GET_STK, SET_STK }; -/*********************************************************************** - Defined macros -***********************************************************************/ -#define EVAL_2_BYTES( C0, C1 ) (((C0)<<8)+((C1))) -#define EVAL_4_BYTES( C0, C1, C2, C3 ) (((C0)<<24)+((C1)<<16)+((C2)<<8)+((C3))) -/* end of file ADFI_AAA_var.c */ - -#define DISK_CACHE_SIZE 50 -struct DISK_CACHE_NODE { - char data[DISK_BLOCK_SIZE]; - FILE *stream; - long block; - int dirty; - struct DISK_CACHE_NODE *next; -}; - -struct DISK_CACHE_NODE *disk_cache = NULL; -struct DISK_CACHE_NODE *disk_cache_end = NULL; - -int DC_flush(); - -void DC_add_block( int index, long block, int is_write, const char *data, - int *error_return ) -{ - int i = 0, this_fd = fileno(ADF_file[index]); - off_t loc; - struct DISK_CACHE_NODE *node = disk_cache, *prev = NULL; - - while (i++ < DISK_CACHE_SIZE && node && - (fileno(node->stream) != this_fd || node->block != block)) { - prev = node; - node = node->next; - } - - if (!node) { /* If no node, allocate one */ - node = (struct DISK_CACHE_NODE *)malloc(sizeof(struct DISK_CACHE_NODE)); - if (prev) - prev->next = node; - if (!disk_cache) - disk_cache = node; - node->next = NULL; - - /* If this buffer is past the current point, it might actually be - a new piece of the file, in which case we'd better write it out */ - loc = ftello(ADF_file[index]); - if (is_write && loc <= (off_t)block * (off_t)DISK_BLOCK_SIZE) { - if (loc != (off_t)block*(off_t)DISK_BLOCK_SIZE) - ADFI_fseek_file(index, block, 0, error_return); - if (*error_return == NO_ERROR) { - if (fwrite(data, 1, DISK_BLOCK_SIZE, - ADF_file[index]) < DISK_BLOCK_SIZE) - *error_return = FWRITE_ERROR; - } - is_write = 0; - } - } - else { - assert(prev || (!prev && node == disk_cache)); - assert(prev != node); - if (prev) - prev->next = node->next; - if (node != disk_cache) { - node->next = disk_cache; - disk_cache = node; - } - - if (i == DISK_CACHE_SIZE && node->dirty) - DC_flush(); - } - assert(node != node->next); - - node->stream = ADF_file[index]; - node->block = block; - node->dirty = is_write; - memcpy(node->data, data, DISK_BLOCK_SIZE); - -// if (is_write) -// DC_flush(); -} - -int DC_get_block( int index, long block, char *data ) -{ - int this_fd = fileno(ADF_file[index]); - struct DISK_CACHE_NODE *node = disk_cache; - - while (node && (fileno(node->stream) != this_fd || node->block != block)) - node = node->next; - - if (node) { - printf("\t\tDC_get_block: got block %ld!\n", block); - memcpy(data, node->data, DISK_BLOCK_SIZE); - } - return(node != NULL); -} - -int DC_sort_compare( const void *a, const void *b ) -{ - struct DISK_CACHE_NODE *this = *(struct DISK_CACHE_NODE **)a; - struct DISK_CACHE_NODE *that = *(struct DISK_CACHE_NODE **)b; - - if (this->block < that->block) - return(-1); - else if (this->block > that->block) - return(1); - return(0); -} - -int DC_flush() -{ - int i, n = 0, size, error = NO_ERROR; - struct DISK_CACHE_NODE *dirty_buffers[DISK_CACHE_SIZE], *node = disk_cache; - - /* Copy the dirty buffers into an array so that we can sort on - file position */ - while (node) { - if (node->dirty) - dirty_buffers[n++] = node; - node = node->next; - } - - qsort(dirty_buffers, n, sizeof(struct DISK_CACHE_NODE *), DC_sort_compare); - - printf("Flushing...\n\t"); - for (i = 0; i < n; ++i) { - printf("%d ", dirty_buffers[i]->block); - if (fseeko(dirty_buffers[i]->stream, - dirty_buffers[i]->block * DISK_BLOCK_SIZE, SEEK_SET) < 0) { - error = FSEEK_ERROR; - printf(" (fseek err at %d) ", dirty_buffers[i]->block); - } - else if ((size = fwrite(dirty_buffers[i]->data, 1, DISK_BLOCK_SIZE, - dirty_buffers[i]->stream)) < DISK_BLOCK_SIZE) { - printf(" (fwrite err at %d) ", dirty_buffers[i]->block); - error = FWRITE_ERROR; - } - else - dirty_buffers[i]->dirty = 0; - } - printf("\n"); - - return(error); -} - -void DC_clear( FILE *file ) -{ - int this_fd = fileno(file); - struct DISK_CACHE_NODE *prev, *node = disk_cache; - - while (node) { - prev = node; - if (fileno(node->stream) == this_fd) { - if (node == disk_cache) - { - disk_cache = node->next; - free(node); - node = disk_cache; - } - else - { - prev->next = node->next; - free(node); - node = prev->next; - } - } - else - node = node->next; - } -} - -/* file ADFI_ASCII_Hex_2_unsigned_int.c */ -/*********************************************************************** -ADFI ASCII Hex to unsigned int: - Convert a number of ASCII-HEX into an unsigned integer. - -input: const unsigned int minimum Expected minimum number. -input: const unsigned int maximum Expected maximum number. -input: const unsigned int string_length Length (bytes) of the input string. -input: const char string[] The input string. -output: unsigned int *number The resulting number. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -STRING_LENGTH_ZERO -STRING_LENGTH_TOO_BIG -STRING_NOT_A_HEX_STRING -NUMBER_LESS_THAN_MINIMUM -NUMBER_GREATER_THAN_MAXIMUM -***********************************************************************/ -void ADFI_ASCII_Hex_2_unsigned_int( - const unsigned int minimum, - const unsigned int maximum, - const unsigned int string_length, - const char string[], - unsigned int *number, - int *error_return ) -{ -unsigned int i, /** Index from 0 to string_length - 1 **/ - ir, /** Index from string_length - 1 to 0 **/ - j, /** Temoprary integer variable **/ - num ; /** Working value of ther number **/ - -if( string == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( string_length == 0 ) { - *error_return = STRING_LENGTH_ZERO ; - return ; - } /* end if */ - -if( number == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( string_length > 8 ) { - *error_return = STRING_LENGTH_TOO_BIG ; - return ; - } /* end if */ - -if( minimum > maximum ) { - *error_return = MINIMUM_GT_MAXIMUM ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Convert the ASCII-Hex string into decimal **/ -num = 0 ; -#if 0 -for( i=0, ir=string_length - 1; i= '0' && string[i] <= '9') - j = string[i] - 48; - else if (string[i] >= 'A' && string[i] <= 'F') - j = string[i] - 55; - else if (string[i] >= 'a' && string[i] <= 'f') - j = string[i] - 87; - else { - *error_return = STRING_NOT_A_HEX_STRING ; - return ; - } - num += (j << ir); - ir -= 4; -} -#endif - -if( num < minimum ) { - *error_return = NUMBER_LESS_THAN_MINIMUM ; - return ; - } /* end if */ - -if( num > maximum ) { - *error_return = NUMBER_GREATER_THAN_MAXIMUM ; - return ; - } /* end if */ - - /** Return the number **/ -*number = num ; -} /* end of ADFI_ASCII_Hex_2_unsigned_int */ -/* end of file ADFI_ASCII_Hex_2_unsigned_int.c */ -/* file ADFI_Abort.c */ -/*********************************************************************** -ADFI Abort: - Do any cleanup and then shut the application down. - -input: const int error_code Error which caused the Abort. -output: -none- Hey, we ain't coming back... -***********************************************************************/ -void ADFI_Abort( - const int error_code ) -{ -fprintf(stderr,"ADF Aborted: Exiting\n" ) ; -exit( error_code ) ; -} /* end of ADFI_Abort */ -/* end of file ADFI_Abort.c */ -/* file ADFI_ID_2_file_block_offset.c */ -/*********************************************************************** -ADFI ID to file block and offset: - - The ID is a combination of the file-index, the block within the - file, and an offset within the block. - - the file index is an unsigned 16-bit int. - block pointer is a 32-bit unsigned int. - block offset is a 16-bit unsigned int. - -input: const double ID Given ADF ID. -output: unsigned int *file_index File index from the ID. -output: unsigned long *file_block File block from the ID. -output: unsigned long *block_offset Block offset from the ID. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -FILE_INDEX_OUT_OF_RANGE -BLOCK_OFFSET_OUT_OF_RANGE -***********************************************************************/ -void ADFI_ID_2_file_block_offset( - const double ID, - unsigned int *file_index, - unsigned long *file_block, - unsigned long *block_offset, - int *error_return ) -{ -unsigned char * cc; - -if( (file_index == NULL) || (file_block == NULL) || (block_offset == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( ID == 0.0 ) { - *error_return = NODE_ID_ZERO ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; -cc = (unsigned char *) &ID; -#ifdef PRINT_STUFF -printf("In ADFI_ID_2_file_block_offset: ID=%lf\n",ID); -printf("cc[0-7] = %02X %02X %02X %02X %02X %02X %02X %02X \n", - cc[0], cc[1], cc[2], cc[3], - cc[4], cc[5], cc[6], cc[7] ) ; -#endif - /** Unmap the bytes from the character **/ -if ( ADF_this_machine_format == IEEE_BIG_FORMAT_CHAR ) { - *file_index = cc[1] + ((cc[0]<<8) & 0x003f) ; - *file_block = cc[2] + (cc[3]<<8) + - (cc[4]<<16) + (cc[5]<<24) ; - *block_offset = cc[6] + (cc[7]<<8) ; - } /* end if */ -else if ( ADF_this_machine_format == IEEE_LITTLE_FORMAT_CHAR ) { - *file_index = cc[6] + ((cc[7]<<8) & 0x003f) ; - *file_block = cc[2] + (cc[3]<<8) + - (cc[4]<<16) + (cc[5]<<24) ; - *block_offset = cc[0] + (cc[1]<<8) ; - } /* end else if */ -else { - *file_index = cc[0] + (cc[1]<<8) ; - *file_block = cc[2] + (cc[3]<<8) + - (cc[4]<<16) + (cc[5]<<24) ; - *block_offset = cc[6] + (cc[7]<<8) ; - } /* end else */ - -#ifdef PRINT_STUFF - printf("*file_index=%d, *file_block=%d, *block_offset=%d\n", - *file_index, *file_block, *block_offset); -#endif - -if( *file_index >= MAXIMUM_FILES ) { - *error_return = FILE_INDEX_OUT_OF_RANGE ; - return ; - } /* end if */ - -if( *block_offset >= DISK_BLOCK_SIZE ) { - *error_return = BLOCK_OFFSET_OUT_OF_RANGE ; - return ; - } /* end if */ -} /* end of ADFI_ID_2_file_block_offset */ -/* end of file ADFI_ID_2_file_block_offset.c */ -/* file ADFI_add_2_sub_node_table.c */ -/*********************************************************************** -ADFI add 2 sub node table: - Add a child to a parent's sub-node table. - -input: const int file_index Index of ADF file. -input: const struct DISK_POINTER *parent Location of the parent -input: const struct DISK_POINTER *child Location of the child. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -SUB_NODE_TABLE_ENTRIES_BAD -MEMORY_ALLOCATION_FAILED -***********************************************************************/ -void ADFI_add_2_sub_node_table( - const int file_index, - const struct DISK_POINTER *parent, - const struct DISK_POINTER *child, - const char *child_name, - int *error_return ) -{ -struct NODE_HEADER parent_node ; -struct SUB_NODE_TABLE_ENTRY *sub_node_table ; -struct DISK_POINTER tmp_disk_ptr ; -unsigned int old_num_entries ; -int i, wrote_sub_node_table = 0 ; - -tStart(&gADFI_add_2_sub_node_table_Timer); -if( (parent == NULL) || (child == NULL) ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_add_2_sub_node_table_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_add_2_sub_node_table_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Get node_header for the node (parent) **/ -ADFI_read_node_header( file_index, parent, &parent_node, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_add_2_sub_node_table_Timer); - return ; -} - - /** Check current length of sub-node_table, add space if needed **/ -tStart(&gADFI_add_2_sub_node_table_fmalloc_Timer); -if( parent_node.entries_for_sub_nodes <= parent_node.num_sub_nodes ) { - old_num_entries = parent_node.entries_for_sub_nodes ; - - /** Increase the table space (double it) **/ - if( parent_node.entries_for_sub_nodes == 0 ) - parent_node.entries_for_sub_nodes = LIST_CHUNK ; - else - parent_node.entries_for_sub_nodes = (unsigned int) ( - (float) parent_node.entries_for_sub_nodes * LIST_CHUNK_GROW_FACTOR ) ; - - if( parent_node.entries_for_sub_nodes <= parent_node.num_sub_nodes ) { - *error_return = SUB_NODE_TABLE_ENTRIES_BAD ; - tEnd(&gADFI_add_2_sub_node_table_Timer); - tEnd(&gADFI_add_2_sub_node_table_fmalloc_Timer); - return ; - } /* end if */ - - /** Allocate memory for the required table space in memory **/ - sub_node_table = (struct SUB_NODE_TABLE_ENTRY *) - malloc( parent_node.entries_for_sub_nodes * - sizeof( *sub_node_table ) ) ; - if( sub_node_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - tEnd(&gADFI_add_2_sub_node_table_Timer); - tEnd(&gADFI_add_2_sub_node_table_fmalloc_Timer); - return ; - } /* end if */ - - /** If sub-node table exists, get it **/ - if( old_num_entries > 0 ) { - ADFI_read_sub_node_table( file_index, &parent_node.sub_node_table, - sub_node_table, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_add_2_sub_node_table_Timer); - tEnd(&gADFI_add_2_sub_node_table_fmalloc_Timer); - return ; - } - } /* end if */ - - /** Blank out the new part of the sub-node_table **/ - for( i=parent_node.num_sub_nodes; i<(int) parent_node.entries_for_sub_nodes; - i++ ) { - strncpy( sub_node_table[i].child_name, - /* " ", ADF_NAME_LENGTH ) ; */ - "unused entry in sub-node-table ", ADF_NAME_LENGTH ) ; - sub_node_table[i].child_location.block = 0 ; - sub_node_table[i].child_location.offset = DISK_BLOCK_SIZE ; - } /* end for */ - - /** Allocate memory for the required table space on disk **/ - if( parent_node.num_sub_nodes > 0 ) { /* delete old table from file */ - ADFI_delete_sub_node_table( file_index, &parent_node.sub_node_table, - old_num_entries, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_add_2_sub_node_table_Timer); - tEnd(&gADFI_add_2_sub_node_table_fmalloc_Timer); - return ; - } - } /* end if */ - - ADFI_file_malloc( file_index, TAG_SIZE + DISK_POINTER_SIZE + TAG_SIZE + - parent_node.entries_for_sub_nodes * (ADF_NAME_LENGTH + DISK_POINTER_SIZE), - &tmp_disk_ptr, error_return ) ; - printf("\tfile malloc: (%d, %d)\n", tmp_disk_ptr.block, tmp_disk_ptr.offset); - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_add_2_sub_node_table_Timer); - tEnd(&gADFI_add_2_sub_node_table_fmalloc_Timer); - return ; - } - - parent_node.sub_node_table.block = tmp_disk_ptr.block ; - parent_node.sub_node_table.offset = tmp_disk_ptr.offset ; - - /** Write out modified sub_node_table **/ - ADFI_write_sub_node_table( file_index, &parent_node.sub_node_table, - parent_node.entries_for_sub_nodes, - (struct SUB_NODE_TABLE_ENTRY *)sub_node_table, error_return ) ; - printf("\twrite sub node table: (%d, %d)\n", - parent_node.sub_node_table.block, - parent_node.sub_node_table.offset); - free( sub_node_table ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_add_2_sub_node_table_Timer); - tEnd(&gADFI_add_2_sub_node_table_fmalloc_Timer); - return ; - } - wrote_sub_node_table = 1; - } /* end if */ -tEnd(&gADFI_add_2_sub_node_table_fmalloc_Timer); - -parent_node.num_sub_nodes++ ; -if (!wrote_sub_node_table) { - /** Write out modified parent node-header **/ - tStart(&gADFI_add_2_sub_node_table_update_parent_Timer); - printf("\twrite parent header: (%d, %d)\n", parent->block, parent->offset); - ADFI_write_node_header( file_index, parent, &parent_node, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_add_2_sub_node_table_update_parent_Timer); - tEnd(&gADFI_add_2_sub_node_table_Timer); - return ; - } - tEnd(&gADFI_add_2_sub_node_table_update_parent_Timer); -} - - /** Insert new entry in sub-node table **/ -tmp_disk_ptr.block = parent_node.sub_node_table.block ; -tmp_disk_ptr.offset = parent_node.sub_node_table.offset + - TAG_SIZE + DISK_POINTER_SIZE + - (parent_node.num_sub_nodes - 1) * (ADF_NAME_LENGTH + DISK_POINTER_SIZE); - -ADFI_adjust_disk_pointer( &tmp_disk_ptr, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_add_2_sub_node_table_Timer); - return ; -} - - /** Write the child's name **/ -tStart(&gADFI_add_2_sub_node_table_write_child_Timer); - printf("\twrite name: (%d, %d)\n", tmp_disk_ptr.block, tmp_disk_ptr.offset); -ADFI_write_file( file_index, tmp_disk_ptr.block, tmp_disk_ptr.offset, - ADF_NAME_LENGTH, child_name, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_add_2_sub_node_table_write_child_Timer); - tEnd(&gADFI_add_2_sub_node_table_Timer); - return ; -} -tEnd(&gADFI_add_2_sub_node_table_write_child_Timer); - - /** Write out new sub_node_table entry **/ -tmp_disk_ptr.offset += ADF_NAME_LENGTH ; -ADFI_adjust_disk_pointer( &tmp_disk_ptr, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_add_2_sub_node_table_Timer); - return ; -} - -ADFI_write_disk_pointer_2_disk( file_index, tmp_disk_ptr.block, - tmp_disk_ptr.offset, child, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_add_2_sub_node_table_Timer); - return ; -} - -if (wrote_sub_node_table) { - /** Write out modified parent node-header **/ - tStart(&gADFI_add_2_sub_node_table_update_parent_Timer); - printf("\twrite parent header: (%d, %d)\n", parent->block, parent->offset); - ADFI_write_node_header( file_index, parent, &parent_node, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_add_2_sub_node_table_update_parent_Timer); - tEnd(&gADFI_add_2_sub_node_table_Timer); - return ; - } - tEnd(&gADFI_add_2_sub_node_table_update_parent_Timer); -} - -tEnd(&gADFI_add_2_sub_node_table_Timer); - -} /* end of ADFI_add_2_sub_node_table */ -/* end of file ADFI_add_2_sub_node_table.c */ -/* file ADFI_adjust_disk_pointer.c */ -/*********************************************************************** -ADFI adjust disk pointer: - Adjust the disk pointer so that the offset is in a legal - range; from 0 and < DISK_BLOCK_SIZE. - -input: const struct DISK_POINTER *block_offset -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -BLOCK_OFFSET_OUT_OF_RANGE -***********************************************************************/ -void ADFI_adjust_disk_pointer( - struct DISK_POINTER *block_offset, - int *error_return ) -{ -unsigned long oblock ; -unsigned long nblock ; - -tStart(&gADFI_adjust_disk_pointer_Timer); -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_adjust_disk_pointer_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -if ( block_offset->offset < DISK_BLOCK_SIZE ) return ; - - /** Calculate the number of blocks in the current offset **/ -nblock = (unsigned long) (block_offset->offset / DISK_BLOCK_SIZE) ; - - /** Adjust block/offset checking for block roll-over **/ -oblock = block_offset->block ; -block_offset->block += nblock ; -block_offset->offset -= nblock * DISK_BLOCK_SIZE ; -if ( block_offset->block < oblock ) { - *error_return = BLOCK_OFFSET_OUT_OF_RANGE ; - return ; - } /* end if */ - -tEnd(&gADFI_adjust_disk_pointer_Timer); -} /* end of ADFI_adjust_disk_pointer */ -/* end of file ADFI_adjust_disk_pointer.c */ -/* file ADFI_big_endian_32_swap_64.c */ -/*********************************************************************** -ADFI big endian 32 swap 64: - -input: const char from_format Format to convert from. 'B','L','C','N' -input: const char from_os_size Format to convert from. 'B','L' -input: const char to_format Format to convert to. -input: const char to_os_size Format to convert to. 'B','L' -input: const char data_type[2] The type of data to convert. - MT I4 I8 U4 U8 R4 R8 X4 X8 C1 B1 -input: const unsigned long delta_from_bytes Number of from_bytes used. -input: const unsigned long delta_to_bytes Number of to_bytes used. -input: const char *from_data The data to convert from. -output: char *to_data The resulting data. -output: int *error_return Error return. - - Recognized data types: - Machine representations - Type Notation IEEE_BIG IEEE_LITTLE Cray - 32 64 32 64 - No data MT - Integer 32 I4 I4 I4 I4 I4 I8 - Integer 64 I8 -- I8 -- I8 I8 - Unsigned 32 U4 I4 I4 I4 I4 I8 - Unsigned 64 U8 -- I8 -- I8 I8 - Real 32 R4 R4 R4 R4 R4 R8 - Real 64 R8 R8 R8 R8 R8 R8 - Complex 64 X4 R4R4 R4R4 R4R4 R4R4 R8R8 - Complex 128 X8 R8R8 R8R8 R8R8 R8R8 R8R8 - Character (unsigned byte) C1 C1 C1 C1 C1 C1 - Byte (unsigned byte) B1 C1 C1 C1 C1 C1 - -Machine Numeric Formats: -***IEEE_BIG (SGI-Iris Assembly Language Programmer's Guide, pages 1-2, 6-3) -I4: Byte0 Byte1 Byte2 Byte3 - MSB---------------------LSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: sign-bit, 8-bit exponent, 23-bit mantissa - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -Machine Numeric Formats: -***IEEE_LITTLE ( The backwards Big Endian ) -I4: Byte0 Byte1 Byte2 Byte3 - LSB---------------------MSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: 23-bit mantissa, 8-bit exponent, sign-bit - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: 52-bit mantissa, 11-bit exponent, sign-bit - -Note: To convert between these two formats the order of the bytes is reversed -since by definition the Big endian starts at the LSB and goes to the MSB where -the little goes form the MSB to the LSB of the word. -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_big_endian_32_swap_64( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -if ( delta_to_bytes == delta_from_bytes ) { - memcpy( to_data, from_data, delta_from_bytes ) ; - } /* end if */ -else if ( delta_from_bytes < delta_to_bytes ) { - switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - case EVAL_2_BYTES( 'I', '8' ): - if( (from_data[0] & 0x80) == 0x80 ) { /* Negative number */ - to_data[0] = 0xff ; - to_data[1] = 0xff ; - to_data[2] = 0xff ; - to_data[3] = 0xff ; - } /* end if */ - else { - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - } /* end else */ - to_data[4] = from_data[0] ; - to_data[5] = from_data[1] ; - to_data[6] = from_data[2] ; - to_data[7] = from_data[3] ; - break ; - default: - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ - } /* end else if */ -else { - switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - case EVAL_2_BYTES( 'I', '8' ): - to_data[0] = from_data[4] ; - to_data[1] = from_data[5] ; - to_data[2] = from_data[6] ; - to_data[3] = from_data[7] ; - break ; - default: - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ - } /* end else */ - -} /* end of ADFI_big_endian_32_swap_64 */ -/* end of file ADFI_big_endian_32_swap_64.c */ -/* file ADFI_big_endian_to_cray.c */ -/*********************************************************************** -ADFI big endian to cray: - -input: const char from_format Format to convert from. 'B','L','C','N' -input: const char from_os_size Format to convert from. 'B','L' -input: const char to_format Format to convert to. -input: const char to_os_size Format to convert to. 'B','L' -input: const char data_type[2] The type of data to convert. - MT I4 I8 U4 U8 R4 R8 X4 X8 C1 B1 -input: const unsigned long delta_from_bytes Number of from_bytes used. -input: const unsigned long delta_to_bytes Number of to_bytes used. -input: const char *from_data The data to convert from. -output: char *to_data The resulting data. -output: int *error_return Error return. - - Recognized data types: - Machine representations - Type Notation IEEE_BIG IEEE_LITTLE Cray - 32 64 32 64 - No data MT - Integer 32 I4 I4 I4 I4 I4 I8 - Integer 64 I8 -- I8 -- I8 I8 - Unsigned 32 U4 I4 I4 I4 I4 I8 - Unsigned 64 U8 -- I8 -- I8 I8 - Real 32 R4 R4 R4 R4 R4 R8 - Real 64 R8 R8 R8 R8 R8 R8 - Complex 64 X4 R4R4 R4R4 R4R4 R4R4 R8R8 - Complex 128 X8 R8R8 R8R8 R8R8 R8R8 R8R8 - Character (unsigned byte) C1 C1 C1 C1 C1 C1 - Byte (unsigned byte) B1 C1 C1 C1 C1 C1 - -Machine Numeric Formats: -***IEEE_BIG (SGI-Iris Assembly Language Programmer's Guide, pages 1-2, 6-3) -I4: Byte0 Byte1 Byte2 Byte3 - MSB---------------------LSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: sign-bit, 8-bit exponent, 23-bit mantissa - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -***Cray (Cray CFT77 Reference Manual, pages G-1 G-2) -I8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - MSB-----------------------------------------------------LSB -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, exponent-sign, 14-bit exponent, 48-bit mantissa -Note: Exponent sign: 1 in this bits indicates a positive exponent sign, - thus bit 62 is the inverse of bit 61 (the sign in the exponent). - The exception to this is a zero, in which all 64 bits are zero! - The interpreation of the floating-point number is: - >>> .mantissia(fraction) X 2^exponent. <<< - The mantissia is left justified (the leftmost bit is a 1). - This MUST be done! - -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_big_endian_to_cray( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ -int i, exp ; - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - - case EVAL_2_BYTES( 'M', 'T' ): - *error_return = NO_DATA ; - return ; - - case EVAL_2_BYTES( 'C', '1' ): - case EVAL_2_BYTES( 'B', '1' ): - to_data[0] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'I', '4' ): - if( (from_data[0] & 0x80) == 0x80 ) { /* Negative number */ - to_data[0] = 0xff ; - to_data[1] = 0xff ; - to_data[2] = 0xff ; - to_data[3] = 0xff ; - } /* end if */ - else { - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - } /* end else */ - to_data[4] = from_data[0] ; - to_data[5] = from_data[1] ; - to_data[6] = from_data[2] ; - to_data[7] = from_data[3] ; - break ; - - case EVAL_2_BYTES( 'U', '4' ): - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - to_data[4] = from_data[0] ; - to_data[5] = from_data[1] ; - to_data[6] = from_data[2] ; - to_data[7] = from_data[3] ; - break ; - - case EVAL_2_BYTES( 'I', '8' ): - if( (from_data[0] & 0x80) == 0x80 ) { /* Negative number */ - to_data[0] = 0xff ; - to_data[1] = 0xff ; - to_data[2] = 0xff ; - to_data[3] = 0xff ; - } /* end if */ - else { - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - } /* end else */ - for( i=0; i<(int)delta_from_bytes; i++ ) - to_data[8-delta_from_bytes+i] = from_data[i] ; - break ; - - case EVAL_2_BYTES( 'U', '8' ): - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - for( i=0; i<(int)delta_from_bytes; i++ ) - to_data[8-delta_from_bytes+i] = from_data[i] ; - break ; - - case EVAL_2_BYTES( 'R', '4' ): - for( i=0; i<8; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[0] == 0x00) && (from_data[1] == 0x00) && - (from_data[2] == 0x00) && (from_data[3] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[0] = from_data[0] & 0x80 ; - - /** Convert the exponent **/ - /** 8 bits to 14 bits. Sign extent from 8 to 14 **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = (from_data[0] & 0x3f) << 1 ; - if( (from_data[1] & 0x80) == 0x80 ) - exp += 1 ; - if( (from_data[0] & 0x40) == 0x00 ) /* set sign */ - exp -= 128 ; - exp += 2 ; - - to_data[1] = exp & 0xff ; - if( exp < 0 ) - to_data[0] |= 0x3f ; /* exponent sign 0, sign extend exponent */ - else - to_data[0] |= 0x40 ; /* exponent sign 1 */ - - /** Convert the mantissia **/ - /** 23 bits to 48 bits. Left shift 25 bits, zero fill **/ - to_data[2] = from_data[1] | 0x80 ; - to_data[3] = from_data[2] ; - to_data[4] = from_data[3] ; - break ; - - case EVAL_2_BYTES( 'R', '8' ): - for( i=0; i<8; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[0] == 0x00) && (from_data[1] == 0x00) && - (from_data[2] == 0x00) && (from_data[3] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[0] = from_data[0] & 0x80 ; - - /** Convert the exponent **/ - /** 11 bits to 14 bits. Sign extent from 11 to 14 **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = ((from_data[0] & 0x3f) << 4) + ((from_data[1]>>4)&0x0f) ; - - if( (from_data[0] & 0x40) == 0x00 ) /* set sign */ - exp -= 1024 ; - exp += 2 ; - - to_data[1] = (unsigned int)(exp & 0xff) ; - to_data[0] |= ((exp>>8) & 0x03) ; - if( exp < 0 ) - to_data[0] |= 0x3c ; /* exponent sign 0, sign extend exponent */ - else - to_data[0] |= 0x40 ; /* exponent sign 1 */ - - /** Convert the mantissia **/ - /** 52 bits to 48 bits. Use 48, drop last 4 bits **/ - to_data[2] = 0x80 | ((from_data[1]<<3)&0x78) | - ((from_data[2]>>5)&0x07) ; - for( i=3; i<8; i++ ) - to_data[i] = ((from_data[i-1]<<3)&0xF8) | - ((from_data[i]>>5)&0x07) ; -#ifdef PRINT_STUFF -printf("from:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", from_data[i] ) ; -printf("to:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", to_data[i] ) ; -printf("\n" ) ; -#endif - break ; - - case EVAL_2_BYTES( 'X', '4' ): - ADFI_big_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_big_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, &from_data[4], &to_data[8], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - case EVAL_2_BYTES( 'X', '8' ): - ADFI_big_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_big_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, &from_data[8], &to_data[8], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - default: - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ -} /* end of ADFI_big_endian_to_cray */ -/* end of file ADFI_big_endian_to_cray.c */ -/* file ADFI_big_little_endian_swap.c */ -/*********************************************************************** -ADFI big little endian swap: - -input: const char from_format Format to convert from. 'B','L','C','N' -input: const char from_os_size Format to convert from. 'B','L' -input: const char to_format Format to convert to. -input: const char to_os_size Format to convert to. 'B','L' -input: const char data_type[2] The type of data to convert. - MT I4 I8 U4 U8 R4 R8 X4 X8 C1 B1 -input: const unsigned long delta_from_bytes Number of from_bytes used. -input: const unsigned long delta_to_bytes Number of to_bytes used. -input: const char *from_data The data to convert from. -output: char *to_data The resulting data. -output: int *error_return Error return. - - Recognized data types: - Machine representations - Type Notation IEEE_BIG IEEE_LITTLE Cray - 32 64 32 64 - No data MT - Integer 32 I4 I4 I4 I4 I4 I8 - Integer 64 I8 -- I8 -- I8 I8 - Unsigned 32 U4 I4 I4 I4 I4 I8 - Unsigned 64 U8 -- I8 -- I8 I8 - Real 32 R4 R4 R4 R4 R4 R8 - Real 64 R8 R8 R8 R8 R8 R8 - Complex 64 X4 R4R4 R4R4 R4R4 R4R4 R8R8 - Complex 128 X8 R8R8 R8R8 R8R8 R8R8 R8R8 - Character (unsigned byte) C1 C1 C1 C1 C1 C1 - Byte (unsigned byte) B1 C1 C1 C1 C1 C1 - -Machine Numeric Formats: -***IEEE_BIG (SGI-Iris Assembly Language Programmer's Guide, pages 1-2, 6-3) -I4: Byte0 Byte1 Byte2 Byte3 - MSB---------------------LSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: sign-bit, 8-bit exponent, 23-bit mantissa - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -Machine Numeric Formats: -***IEEE_LITTLE ( The backwards Big Endian ) -I4: Byte0 Byte1 Byte2 Byte3 - LSB---------------------MSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: 23-bit mantissa, 8-bit exponent, sign-bit - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: 52-bit mantissa, 11-bit exponent, sign-bit - -Note: To convert between these two formats the order of the bytes is reversed -since by definition the Big endian starts at the LSB and goes to the MSB where -the little goes form the MSB to the LSB of the word. -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_big_little_endian_swap( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ -int i ; - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -if ( from_os_size != to_os_size || delta_to_bytes != delta_from_bytes ) { - *error_return = DATA_TYPE_NOT_SUPPORTED ; - return ; -} /** end if **/ - -*error_return = NO_ERROR ; - -for ( i=0; i<(int)delta_from_bytes; i++ ) - to_data[i] = from_data[delta_from_bytes-1-i] ; - -} /* end of ADFI_big_little_endian_swap */ -/* end of file ADFI_big_little_endian_swap.c */ -/* file ADFI_blank_fill_string.c */ -/*********************************************************************** -ADFI blank fill string: - -input/output: char *str The string to fill with blanks. -input: const int length The total length of the string to fill. -***********************************************************************/ -void ADFI_blank_fill_string( - char *str, - const int length ) -{ -int i ; -for( i=strlen( str ); iblock, - &block_offset->offset, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - ADFI_read_node_header( *file_index, block_offset, node_header, - error_return ) ; - return ; -} - -Link_ID = ID ; -while( done == FALSE ) { - /** Get the file, block, and offset numbers from the ID **/ - ADFI_ID_2_file_block_offset( Link_ID, file_index, &block_offset->block, - &block_offset->offset, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Get node_header for the node **/ - ADFI_read_node_header( *file_index, block_offset, node_header, - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - if( (node_header->data_type[0] == 'L') && - (node_header->data_type[1] == 'K')) { - - /** node is a link get file and path data **/ - ADF_Get_Link_Path( Link_ID, link_file, link_path, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - if( link_file[0] != '\0' ) { /* A filename is specified, open it. **/ - - /** Link_ID = root-node of the new file. - note: the file could already be opened, and may be the - current file! **/ - - ADFI_get_file_index_from_name( link_file, &found, &link_file_index, - &Link_ID, error_return ) ; - if( ! found ) { /** Not found; try to open it **/ - if (access(link_file,2)) /* check for read-only mode */ - status = "READ_ONLY"; - else /* open in same mode as current file */ - status = (char *) file_open_mode[*file_index] ; - if ( ADFI_stridx_c(status, "READ_ONLY" ) != 0 ) status="OLD" ; - ADF_Database_Open( link_file, status, "", &Link_ID, - error_return ) ; - if( *error_return != NO_ERROR ) { - *error_return = LINKED_TO_FILE_NOT_THERE ; - return ; - } /* end if */ - } /* end else */ - } /* end if */ - else { /* filename NOT specified, file must be root of link */ - ADF_Get_Node_ID( Link_ID, "/", &temp_ID, error_return ) ; - if( *error_return != NO_ERROR ) { - *error_return = LINKED_TO_FILE_NOT_THERE ; - return ; - } /* end if */ - Link_ID = temp_ID ; - } /* end else */ - - /** Get the node ID of the link to node (may be other links) **/ - ADF_Get_Node_ID( Link_ID, link_path, &temp_ID, error_return ) ; - if( *error_return == CHILD_NOT_OF_GIVEN_PARENT ) - *error_return = LINK_TARGET_NOT_THERE ; /* A better error message */ - if( *error_return != NO_ERROR ) - return ; - - Link_ID = temp_ID ; - if( ++link_depth > ADF_MAXIMUM_LINK_DEPTH ) { - *error_return = LINKS_TOO_DEEP ; - return ; - } /* end if */ - } /* end if */ - else { /** node is NOT a link **/ - done = TRUE ; - } /* end else */ - } /* end while */ - -*LID = Link_ID ; -if (Link_ID != ID) { - last_link_ID = ID; - last_link_LID = Link_ID; -} - -} /* end of ADFI_chase_link */ -/* end of file ADFI_chase_link.c */ -/* file ADFI_check_4_child_name.c */ -/*********************************************************************** -ADFI check 4 child name: - -input: const int file_index Index of ADF file. -input: const struct DISK_POINTER *parent Location of the parent -input: const char *name The name of the new child. -output: int *found 0 if NOT found, else 1. -output: struct DISK_POINTER *sub_node_entry_location -output: struct SUB_NODE_TABLE_ENTRY *sub_node_entry -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -MEMORY_ALLOCATION_FAILED -***********************************************************************/ -void ADFI_check_4_child_name( - const int file_index, - const struct DISK_POINTER *parent, - const char *name, - int *found, - struct DISK_POINTER *sub_node_entry_location, - struct SUB_NODE_TABLE_ENTRY *sub_node_entry, - int *error_return ) -{ -struct NODE_HEADER parent_node ; -struct SUB_NODE_TABLE_ENTRY *sub_node_table ; -int i ; - -tStart(&gADFI_check_4_child_name_Timer); -if( (parent == NULL) || (found == NULL) || (sub_node_entry_location == NULL) || - (sub_node_entry == NULL ) ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_check_4_child_name_Timer); - return ; - } /* end if */ - -if( name == NULL ) { - *error_return = NULL_STRING_POINTER ; - tEnd(&gADFI_check_4_child_name_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_check_4_child_name_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; -*found = 0 ; /* default to NOT found */ - - /** Get node_header for the node **/ -ADFI_read_node_header( file_index, parent, &parent_node, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_check_4_child_name_Timer); - return ; -} - - /** Check for valid node name **/ - - /** If parent has no children, the new name MUST be NOT found **/ -if( parent_node.num_sub_nodes == 0 ) { - *found = 0 ; - tEnd(&gADFI_check_4_child_name_Timer); - return ; - } /* end if */ - - /** Allocate memory for the required table space in memory **/ -sub_node_table = (struct SUB_NODE_TABLE_ENTRY *) - malloc( parent_node.entries_for_sub_nodes * - sizeof( *sub_node_table ) ) ; -if( sub_node_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - tEnd(&gADFI_check_4_child_name_Timer); - return ; - } /* end if */ - -if( parent_node.entries_for_sub_nodes > 0 ) { - ADFI_read_sub_node_table( file_index, &parent_node.sub_node_table, - sub_node_table, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_check_4_child_name_Timer); - return ; - } - } /* end if */ - - /** Check all names for our new name **/ -for( i=0; i<(int)parent_node.num_sub_nodes; i++ ) { - ADFI_compare_node_names( sub_node_table[i].child_name, name, - found, error_return ) ; - if( *error_return != NO_ERROR ) - break ; - if( *found == 1 ) { /* name was found, save off addresses */ - sub_node_entry_location->block = parent_node.sub_node_table.block ; - sub_node_entry_location->offset = parent_node.sub_node_table.offset + - TAG_SIZE + DISK_POINTER_SIZE + - (ADF_NAME_LENGTH + DISK_POINTER_SIZE) * i ; - - ADFI_adjust_disk_pointer( sub_node_entry_location, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_check_4_child_name_Timer); - return ; - } - - /** Also save off the child's name **/ - strncpy( sub_node_entry->child_name, sub_node_table[i].child_name, - ADF_NAME_LENGTH ) ; - sub_node_entry->child_location.block = - sub_node_table[i].child_location.block ; - sub_node_entry->child_location.offset = - sub_node_table[i].child_location.offset ; - - /** Get out of the for loop **/ - break ; - } /* end if */ - } /* end for */ - -free( sub_node_table ) ; -tEnd(&gADFI_check_4_child_name_Timer); -} /* end of ADFI_check_4_child_name */ -/* end of file ADFI_check_4_child_name.c */ -/* file ADFI_check_string_length.c */ -/*********************************************************************** -ADFI check string length: - Check a character string for: - being a NULL pointer, - being too long, - being zero length. - -input: const char *str The input string. -input: const int max_length Maximum allowable length of the string. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -STRING_LENGTH_ZERO -STRING_LENGTH_TOO_BIG -***********************************************************************/ -void ADFI_check_string_length( - const char *str, - const int max_length, - int *error_return ) -{ -int str_length, i ; - -if( str == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -str_length = strlen( str ) ; -if( str_length == 0 ) { - *error_return = STRING_LENGTH_ZERO ; - return ; - } /* end if */ - -if( (int) strlen( str ) > max_length ) { - *error_return = STRING_LENGTH_TOO_BIG ; - return ; - } /* end if */ - - /** Check for blank string **/ -*error_return = STRING_LENGTH_ZERO ; -for( i=0; iinitialized = 0; - - /* Clear the disk cache. If there are multiple copies of this file, it - will clear their disk cache, too, but that's the price of - simple code... :) */ - DC_flush(); - DC_clear( ADF_file[ file_index ] ); -} - -void ADFI_close_file( - const int top_file_index, - int *error_return ) -{ -int index ; - -tStart(&gADFI_close_file_Timer); -if( file_in_use[ top_file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_close_file_Timer); - tPrintAll(); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -if( ADF_file[ top_file_index ] != 0 ) { - ADFI_flush_caches( top_file_index, error_return ); - - /* Close the file */ - ADFI_flush_buffers( top_file_index, FLUSH_CLOSE, error_return ); - if( fclose( ADF_file[ top_file_index ] ) != 0 ) - *error_return = FILE_CLOSE_ERROR ; - } /* end if */ - - /** Clear this file's entry **/ -ADFI_stack_control(top_file_index,0,0,CLEAR_STK,0,0,NULL); -file_in_use[ top_file_index ] = 0 ; -first_file_in_system[ top_file_index ] = -1 ; -ADF_file[ top_file_index ] = NULL ; -file_version_update[ top_file_index ][ 0 ] = '\0' ; - - /** If any other file uses this file as it's top-file, - then also close that file. **/ -for( index=0; index < MAXIMUM_FILES; index++ ) { - if( first_file_in_system[ index ] == top_file_index ) { - if( ADF_file[ index ] != 0 ) { - ADFI_flush_buffers( index, FLUSH_CLOSE, error_return ); - ADFI_flush_caches( index, error_return ); - if( fclose( ADF_file[ index ] ) != 0 ) - *error_return = FILE_CLOSE_ERROR ; - } /* end if */ - ADFI_stack_control(index,0,0,CLEAR_STK,0,0,NULL); - file_in_use[ index ] = 0 ; - first_file_in_system[ index ] = -1 ; - ADF_file[ index ] = NULL ; - file_version_update[ index ][ 0 ] = '\0' ; - } /* end if */ - } /* end for */ - -tEnd(&gADFI_close_file_Timer); -tPrintAll(); -} /* end of ADFI_close_file */ -/* end of file ADFI_close_file.c */ -/* file ADFI_compare_node_names.c */ -/*********************************************************************** -ADFI compare node names: - -input: const char *name Existing node name. -input: const char *new_name New node name. -output: int *names_match 0 if name do NOT match, else 1. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_compare_node_names( - const char *name, - const char *new_name, - int *names_match, - int *error_return ) -{ -int i, new_length ; - -if( (name == NULL) || (new_name == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( names_match == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; -*names_match = 0 ; /* Default to NO match */ - -new_length = strlen( new_name ) ; -for( i=0; i>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -Machine Numeric Formats: -***IEEE_LITTLE ( The backwards Big Endian ) -I4: Byte0 Byte1 Byte2 Byte3 - LSB---------------------MSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: 23-bit mantissa, 8-bit exponent, sign-bit - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: 52-bit mantissa, 11-bit exponent, sign-bit - -***Cray (Cray CFT77 Reference Manual, pages G-1 G-2) -I8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - MSB-----------------------------------------------------LSB -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, exponent-sign, 14-bit exponent, 48-bit mantissa -Note: Exponent sign: 1 in this bits indicates a positive exponent sign, - thus bit 62 is the inverse of bit 61 (the sign in the exponent). - The exception to this is a zero, in which all 64 bits are zero! - The interpreation of the floating-point number is: - >>> .mantissia(fraction) X 2^exponent. <<< - The mantissia is left justified (the leftmost bit is a 1). - This MUST be done! - -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_convert_number_format( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const int convert_dir, - const struct TOKENIZED_DATA_TYPE *tokenized_data_type, - const unsigned int length, - unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ -unsigned char temp_data[16] ; -char data_type[2] ; -int current_token ; -int array_size ; -int l, s ; -unsigned long delta_from_bytes, delta_to_bytes ; - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( length == 0 ) { - *error_return = NUMBER_LESS_THAN_MINIMUM ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -switch( EVAL_4_BYTES( from_format, to_format, from_os_size, to_os_size ) ) { - case EVAL_4_BYTES( 'B', 'B', 'B', 'B' ): - case EVAL_4_BYTES( 'C', 'C', 'B', 'B' ): - case EVAL_4_BYTES( 'L', 'L', 'B', 'B' ): - case EVAL_4_BYTES( 'B', 'B', 'L', 'L' ): - case EVAL_4_BYTES( 'C', 'C', 'L', 'L' ): - case EVAL_4_BYTES( 'L', 'L', 'L', 'L' ): - *error_return = CONVERSION_FORMATS_EQUAL ; - return ; - } /* end switch */ - -*error_return = NO_ERROR ; - - /** loop over each element **/ -for ( l=0; l<(int)length; l++ ) { - current_token = -1 ; - while( tokenized_data_type[ ++current_token ].type[0] != 0 ) { - data_type[0] = tokenized_data_type[ current_token ].type[0] ; - data_type[1] = tokenized_data_type[ current_token ].type[1] ; - array_size = tokenized_data_type[ current_token ].length ; - if ( convert_dir == FROM_FILE_FORMAT ) { - delta_from_bytes=tokenized_data_type[ current_token ].file_type_size ; - delta_to_bytes =tokenized_data_type[ current_token ].machine_type_size ; - } /** end if **/ - else { - delta_to_bytes =tokenized_data_type[ current_token ].file_type_size ; - delta_from_bytes=tokenized_data_type[ current_token ].machine_type_size ; - } /** end else **/ - - for ( s=0; s 12) ) { - *error_return = BAD_NUMBER_OF_DIMENSIONS ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Chek the inputs **/ -for( i=0; i=1 **/ - if( dims[i] < 1 ) { - *error_return = BAD_DIMENSION_VALUE ; - return ; - } /* end if */ - - /** Check starting values >=1 and <= dims **/ - if( (dim_start[i] < 1) || (dim_start[i] > (int) dims[i]) ) { - *error_return = START_OUT_OF_DEFINED_RANGE ; - return ; - } /* end if */ - - /** Check ending values >=1 and <= dims and >= dim_start **/ - if( (dim_end[i] < 1) || (dim_end[i] > (int) dims[i]) ) { - *error_return = END_OUT_OF_DEFINED_RANGE ; - return ; - } /* end if */ - if( dim_end[i] < dim_start[i] ) { - *error_return = MINIMUM_GT_MAXIMUM ; - return ; - } /* end if */ - - /** Check stride >= 1 **/ - if( dim_stride[i] < 1 ) { - *error_return = BAD_STRIDE_VALUE ; - return ; - } /* end if */ - } /* end for */ - -total = 1 ; -offset = 0 ; -accumlated_size = 1 ; -for( i=0; i>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -***Cray (Cray CFT77 Reference Manual, pages G-1 G-2) -I8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - MSB-----------------------------------------------------LSB -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, exponent-sign, 14-bit exponent, 48-bit mantissa -Note: Exponent sign: 1 in this bits indicates a positive exponent sign, - thus bit 62 is the inverse of bit 61 (the sign in the exponent). - The exception to this is a zero, in which all 64 bits are zero! - The interpreation of the floating-point number is: - >>> .mantissia(fraction) X 2^exponent. <<< - The mantissia is left justified (the leftmost bit is a 1). - This MUST be done! - -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_cray_to_big_endian( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ -int i, exp ; - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - case EVAL_2_BYTES( 'M', 'T' ): - *error_return = NO_DATA ; - return ; - - case EVAL_2_BYTES( 'C', '1' ): - case EVAL_2_BYTES( 'B', '1' ): - to_data[0] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'I', '4' ): - case EVAL_2_BYTES( 'U', '4' ): - to_data[0] = from_data[4] ; - to_data[1] = from_data[5] ; - to_data[2] = from_data[6] ; - to_data[3] = from_data[7] ; - break ; - - case EVAL_2_BYTES( 'I', '8' ): - case EVAL_2_BYTES( 'U', '8' ): - for( i=0; i<(int) delta_to_bytes; i++ ) - to_data[i] = from_data[8-delta_to_bytes+i] ; - break ; - - case EVAL_2_BYTES( 'R', '4' ): - for( i=0; i<4; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[0] == 0x00) && (from_data[1] == 0x00) && - (from_data[2] == 0x00) && (from_data[3] == 0x00) && - (from_data[4] == 0x00) && (from_data[5] == 0x00) && - (from_data[6] == 0x00) && (from_data[7] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[0] = from_data[0] & 0x80 ; - - /** Convert the exponent **/ - /** 14 bits to 8 bits. Sign extent from 8 to 14 **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = from_data[1] + ((from_data[0]&0x3f)<<8) ; - if( (from_data[0] & 0x40) == 0x00 ) /* set sign */ - exp -= 16384 ; - exp -= 2 ; - - if( exp >= 128 ) { - *error_return = NUMERIC_OVERFLOW ; - return ; - } /* end if */ - else if ( exp < -128 ) { - for( i=0; i<4; i++ ) to_data[i] = 0x00 ; /* underflow set to 0 */ - break; - } /* end else */ - - to_data[0] |= ((exp&0x7F) >> 1) ; - if( (exp & 0x01) == 0x01 ) /* LSBit of the exponent */ - to_data[1] |= 0x80 ; - - if( exp >= 0 ) /* Set exponent sign */ - to_data[0] |= 0x40 ; - - /** Convert the mantissia **/ - /** 48 bits to 23 bits, skip the first '1' (2.fract) **/ - to_data[1] |= (from_data[2] & 0x7f) ; - to_data[2] = from_data[3] ; - to_data[3] = from_data[4] ; - break ; - - case EVAL_2_BYTES( 'R', '8' ): - for( i=0; i<8; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[0] == 0x00) && (from_data[1] == 0x00) && - (from_data[2] == 0x00) && (from_data[3] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[0] = from_data[0] & 0x80 ; - - /** Convert the exponent **/ - /** 14 bits to 11 bits **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = from_data[1] + ((from_data[0]&0x3f)<<8) ; - /* set sign if exponent is non-zero */ - if( (exp != 0) && ((from_data[0] & 0x40) == 0x00) ) - exp -= 16384 ; - exp -= 2 ; - - if( exp >= 1024 ) { - *error_return = NUMERIC_OVERFLOW ; - return ; - } /* end if */ - else if ( exp < -1024 ) { - for( i=0; i<4; i++ ) to_data[i] = 0x00 ; /* underflow set to 0 */ - break; - } /* end else */ - - to_data[0] |= ((exp & 0x03F0) >> 4) ; - to_data[1] |= ((exp & 0x000F) << 4) ; - - if( exp >= 0 ) /* Set exponent sign */ - to_data[0] |= 0x40 ; - - /** Convert the mantissia **/ - /** 48 bits to 52 bits, skip the first '1' (2.fract) **/ - to_data[1] |= ((from_data[2] & 0x78) >> 3) ; - for( i=2; i<7; i++ ) - to_data[i] = ((from_data[i] & 0x07) << 5) | - ((from_data[i+1] & 0xf8) >> 3) ; - to_data[7] = ((from_data[7] & 0x07) << 5) ; - -#ifdef PRINT_STUFF -printf("from:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", from_data[i] ) ; -printf("to:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", to_data[i] ) ; -printf("\n" ) ; -#endif - break ; - - case EVAL_2_BYTES( 'X', '4' ): - ADFI_cray_to_big_endian( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_cray_to_big_endian( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, &from_data[8], &to_data[4], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - case EVAL_2_BYTES( 'X', '8' ): - ADFI_cray_to_big_endian( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_cray_to_big_endian( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, &from_data[8], &to_data[8], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - default: - *error_return = INVALID_DATA_TYPE ; - return ; - - } /* end switch */ -} /* end of ADFI_cray_to_big_endian */ -/* end of file ADFI_cray_to_big_endian.c */ -/* file ADFI_cray_to_little_endian.c */ -/*********************************************************************** -ADFI cray to little endian: - -input: const char from_format Format to convert from. 'B','L','C','N' -input: const char from_os_size Format to convert from. 'B','L' -input: const char to_format Format to convert to. -input: const char to_os_size Format to convert to. 'B','L' -input: const char data_type[2] The type of data to convert. - MT I4 I8 U4 U8 R4 R8 X4 X8 C1 B1 -input: const unsigned long delta_from_bytes Number of from_bytes used. -input: const unsigned long delta_to_bytes Number of to_bytes used. -input: const char *from_data The data to convert from. -output: char *to_data The resulting data. -output: int *error_return Error return. - - Recognized data types: - Machine representations - Type Notation IEEE_BIG IEEE_L Cray - No data MT - Integer 32 I4 I4 I4 I4 I4 I8 - Integer 64 I8 -- I8 -- I8 I8 - Unsigned 32 U4 I4 I4 I4 I4 I8 - Unsigned 64 U8 -- I8 -- I8 I8 - Real 32 R4 R4 R4 R4 R4 R8 - Real 64 R8 R8 R8 R8 R8 R8 - Complex 64 X4 R4R4 R4R4 R4R4 R4R4 R8R8 - Complex 128 X8 R8R8 R8R8 R8R8 R8R8 R8R8 - Character (unsigned byte) C1 C1 C1 C1 C1 C1 - Byte (unsigned byte) B1 C1 C1 C1 C1 C1 - -Machine Numeric Formats: -***IEEE_BIG (SGI-Iris Assembly Language Programmer's Guide, pages 1-2, 6-3) -I4: Byte0 Byte1 Byte2 Byte3 - MSB---------------------LSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: sign-bit, 8-bit exponent, 23-bit mantissa - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -***Cray (Cray CFT77 Reference Manual, pages G-1 G-2) -I8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - MSB-----------------------------------------------------LSB -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, exponent-sign, 14-bit exponent, 48-bit mantissa -Note: Exponent sign: 1 in this bits indicates a positive exponent sign, - thus bit 62 is the inverse of bit 61 (the sign in the exponent). - The exception to this is a zero, in which all 64 bits are zero! - The interpreation of the floating-point number is: - >>> .mantissia(fraction) X 2^exponent. <<< - The mantissia is left justified (the leftmost bit is a 1). - This MUST be done! - -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_cray_to_little_endian( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ -int i, exp ; - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - case EVAL_2_BYTES( 'M', 'T' ): - *error_return = NO_DATA ; - return ; - - case EVAL_2_BYTES( 'C', '1' ): - case EVAL_2_BYTES( 'B', '1' ): - to_data[0] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'I', '4' ): - case EVAL_2_BYTES( 'U', '4' ): - to_data[3] = from_data[4] ; - to_data[2] = from_data[5] ; - to_data[1] = from_data[6] ; - to_data[0] = from_data[7] ; - break ; - - case EVAL_2_BYTES( 'I', '8' ): - case EVAL_2_BYTES( 'U', '8' ): - for( i=0; i<(int) delta_to_bytes; i++ ) - to_data[delta_to_bytes-1-i] = from_data[8-delta_to_bytes+i] ; - break ; - - case EVAL_2_BYTES( 'R', '4' ): - for( i=0; i<4; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[0] == 0x00) && (from_data[1] == 0x00) && - (from_data[2] == 0x00) && (from_data[3] == 0x00) && - (from_data[4] == 0x00) && (from_data[5] == 0x00) && - (from_data[6] == 0x00) && (from_data[7] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[3] = from_data[0] & 0x80 ; - - /** Convert the exponent **/ - /** 14 bits to 8 bits. Sign extent from 8 to 14 **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = from_data[1] + ((from_data[0]&0x3f)<<8) ; - if( (from_data[0] & 0x40) == 0x00 ) /* set sign */ - exp -= 16384 ; - exp -= 2 ; - - if( exp >= 128 ) { - *error_return = NUMERIC_OVERFLOW ; - return ; - } /* end if */ - else if ( exp < -128 ) { - for( i=0; i<4; i++ ) to_data[i] = 0x00 ; /* underflow set to 0 */ - break; - } /* end else */ - - to_data[3] |= ((exp&0x7F) >> 1) ; - if( (exp & 0x01) == 0x01 ) /* LSBit of the exponent */ - to_data[2] |= 0x80 ; - - if( exp >= 0 ) /* Set exponent sign */ - to_data[3] |= 0x40 ; - - /** Convert the mantissia **/ - /** 48 bits to 23 bits, skip the first '1' (2.fract) **/ - to_data[2] |= (from_data[2] & 0x7f) ; - to_data[1] = from_data[3] ; - to_data[0] = from_data[4] ; - break ; - - case EVAL_2_BYTES( 'R', '8' ): - for( i=0; i<8; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[0] == 0x00) && (from_data[1] == 0x00) && - (from_data[2] == 0x00) && (from_data[3] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[7] = from_data[0] & 0x80 ; - - /** Convert the exponent **/ - /** 14 bits to 11 bits **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = from_data[1] + ((from_data[0]&0x3f)<<8) ; - /* set sign if exponent is non-zero */ - if( (exp != 0) && ((from_data[0] & 0x40) == 0x00) ) - exp -= 16384 ; - exp -= 2 ; - - if( exp >= 1024 ) { - *error_return = NUMERIC_OVERFLOW ; - return ; - } /* end if */ - else if ( exp < -1024 ) { - for( i=0; i<4; i++ ) to_data[i] = 0x00 ; /* underflow set to 0 */ - break; - } /* end else */ - - to_data[7] |= ((exp & 0x03F0) >> 4) ; - to_data[6] |= ((exp & 0x000F) << 4) ; - - if( exp >= 0 ) /* Set exponent sign */ - to_data[7] |= 0x40 ; - - /** Convert the mantissia **/ - /** 48 bits to 52 bits, skip the first '1' (2.fract) **/ - to_data[6] |= ((from_data[2] & 0x78) >> 3) ; - for( i=2; i<7; i++ ) - to_data[7-i] = ((from_data[i] & 0x07) << 5) | - ((from_data[i+1] & 0xf8) >> 3) ; - to_data[0] = ((from_data[7] & 0x07) << 5) ; - -#ifdef PRINT_STUFF -printf("from:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", from_data[i] ) ; -printf("to:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", to_data[i] ) ; -printf("\n" ) ; -#endif - break ; - - case EVAL_2_BYTES( 'X', '4' ): - ADFI_cray_to_little_endian( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_cray_to_little_endian( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, &from_data[8], &to_data[4], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - case EVAL_2_BYTES( 'X', '8' ): - ADFI_cray_to_little_endian( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_cray_to_little_endian( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, &from_data[8], &to_data[8], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - default: - *error_return = INVALID_DATA_TYPE ; - return ; - - } /* end switch */ -} /* end of ADFI_cray_to_little_endian */ -/* end of file ADFI_cray_to_little_endian.c */ -/* file ADFI_delete_data.c */ -/*********************************************************************** -ADFI delete data: - -Deletes all data from the file for a node. - -input: const int file_index The file index. -input: const struct NODE_HEADER Node header information. -output: int *error_return Error return. -***********************************************************************/ -void ADFI_delete_data( - const int file_index, - const struct NODE_HEADER *node_header, - int *error_return ) -{ -struct DATA_CHUNK_TABLE_ENTRY *data_chunk_table ; -int i ; - -*error_return = NO_ERROR ; - -tStart(&gADFI_delete_data_Timer); -if( node_header == NULL ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_delete_data_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_delete_data_Timer); - return ; - } /* end if */ - -switch( node_header->number_of_data_chunks ) { -case 0 : /** No data to free, do nothing **/ - tEnd(&gADFI_delete_data_Timer); - return ; - -case 1 : /** A single data-chunk to free, so free it **/ - ADFI_file_free( file_index, &node_header->data_chunks, 0, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_delete_data_Timer); - return ; - } - break ; - -default : /** Multiple data-chunks to free. Free them, - and also the data_chunk table **/ - /** Allocate memory for the required table space in memory **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( node_header->number_of_data_chunks * sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - tEnd(&gADFI_delete_data_Timer); - return ; - } /* end if */ - - /** Read in the table **/ - ADFI_read_data_chunk_table( file_index, &node_header->data_chunks, - data_chunk_table, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_delete_data_Timer); - return ; - } - - /** Free each entry in the table **/ - for( i=0; i<(int)node_header->number_of_data_chunks; i++ ) { - ADFI_file_free( file_index, &data_chunk_table[i].start, - 0, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_delete_data_Timer); - return ; - } - } /* end for */ - free( data_chunk_table ) ; - ADFI_file_free( file_index, &node_header->data_chunks, 0, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_delete_data_Timer); - return ; - } - break ; - }/* end switch */ - -/** Clear all disk entries off the priority stack for file **/ -ADFI_stack_control(file_index, 0, 0, CLEAR_STK_TYPE, DISK_PTR_STK, - 0, NULL ) ; - -tEnd(&gADFI_delete_data_Timer); -} /* end of ADFI_delete_data */ -/* end of file ADFI_delete_data.c */ -/* file ADFI_delete_from_sub_node_table.c */ -/*********************************************************************** -ADFI delete from sub node table: - Delete a child from a parent's sub-node table. - -input: const int file_index Index of ADF file. -input: const struct DISK_POINTER *parent Location of the parent -input: const struct DISK_POINTER *child Location of the child. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_delete_from_sub_node_table( - const int file_index, - const struct DISK_POINTER *parent, - const struct DISK_POINTER *child, - int *error_return ) -{ - -int i, found ; -struct NODE_HEADER parent_node ; -struct SUB_NODE_TABLE_ENTRY *sub_node_table ; - -tStart(&gADFI_delete_from_sub_node_table_Timer); -if( (parent == NULL) || (child == NULL) ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_delete_from_sub_node_table_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_delete_from_sub_node_table_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_read_node_header( file_index, parent, &parent_node, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_delete_from_sub_node_table_Timer); - return ; - } - -sub_node_table = (struct SUB_NODE_TABLE_ENTRY *) - malloc( parent_node.entries_for_sub_nodes * - sizeof( struct SUB_NODE_TABLE_ENTRY ) ) ; -if( sub_node_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - tEnd(&gADFI_delete_from_sub_node_table_Timer); - return ; - } /* end if */ - -ADFI_read_sub_node_table( file_index, &parent_node.sub_node_table, - sub_node_table, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_delete_from_sub_node_table_Timer); - return ; - } - - /** Find the child in the parent's sub-node table **/ -for( i=0, found = -1 ; i<(int)parent_node.num_sub_nodes ; i++ ) { - if( child->block == sub_node_table[i].child_location.block && - child->offset == sub_node_table[i].child_location.offset ) { - found = i ; - break ; - } /* end if */ -} /* end for */ - -if( found == -1 ) { - *error_return = SUB_NODE_TABLE_ENTRIES_BAD ; - tEnd(&gADFI_delete_from_sub_node_table_Timer); - return ; -} - - /** Move the rest of the table up to fill the hole **/ -for( i=found ; i<(int) (parent_node.num_sub_nodes-1) ; i++ ) { - sub_node_table[i].child_location.block = - sub_node_table[i+1].child_location.block ; - sub_node_table[i].child_location.offset = - sub_node_table[i+1].child_location.offset ; - strncpy ( sub_node_table[i].child_name, sub_node_table[i+1].child_name, - ADF_NAME_LENGTH ) ; - } /* end for */ - -i = parent_node.num_sub_nodes - 1 ; -sub_node_table[i].child_location.block = 0 ; -sub_node_table[i].child_location.offset = 0 ; -strncpy ( sub_node_table[i].child_name, - "unused entry in sub-node-table ", ADF_NAME_LENGTH ) ; - - /** Re-write the parent's sub-node table **/ - -ADFI_write_sub_node_table( file_index, &parent_node.sub_node_table, - parent_node.entries_for_sub_nodes, - sub_node_table, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_delete_from_sub_node_table_Timer); - return ; - } - - /** Update the sub-node count and write the parent's node-header **/ -parent_node.num_sub_nodes -= 1; -ADFI_write_node_header( file_index, parent, &parent_node, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_delete_from_sub_node_table_Timer); - return ; - } - -/** Clear all subnode/disk entries off the priority stack for file **/ -ADFI_stack_control(file_index, 0, 0, CLEAR_STK_TYPE, SUBNODE_STK, - 0, NULL ) ; -ADFI_stack_control(file_index, 0, 0, CLEAR_STK_TYPE, DISK_PTR_STK, - 0, NULL ) ; - -free(sub_node_table); -tEnd(&gADFI_delete_from_sub_node_table_Timer); -} /* end of ADFI_delete_from_sub_node_table */ -/* end of file ADFI_delete_from_sub_node_table.c */ -/* file ADFI_delete_sub_node_table.c */ -/*********************************************************************** -ADFI delete sub node table: - Deletes a sub-node table from the file. - -input: const int file_index Index of ADF file. -input: const struct DISK_POINTER *block_offset The block & offset of - the sub node table. -input: const unsigned int size_sub_node_table Current size of the sub - node table (usually node_header.entries_for_sub_nodes). - If zero, then no action performed. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -FREE_OF_ROOT_NODE -ADF_DISK_TAG_ERROR -FREE_OF_FREE_CHUNK_TABLE -***********************************************************************/ -void ADFI_delete_sub_node_table( - const int file_index, - const struct DISK_POINTER *block_offset, - const unsigned int size_sub_node_table, - int *error_return ) -{ -unsigned int num_bytes ; - -tStart(&gADFI_delete_sub_node_table_Timer); - -*error_return = NO_ERROR ; - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_delete_sub_node_table_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_delete_sub_node_table_Timer); - return ; - } /* end if */ - -if( size_sub_node_table == 0 ) { - tEnd(&gADFI_delete_sub_node_table_Timer); - return ; /* assume nothing to delete */ - } - -/* calculate size */ -num_bytes = TAG_SIZE + TAG_SIZE + DISK_POINTER_SIZE + - size_sub_node_table * (ADF_NAME_LENGTH + DISK_POINTER_SIZE); - -ADFI_file_free( file_index, block_offset, num_bytes, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_delete_sub_node_table_Timer); - return ; - } - -/** Clear all subnode/disk entries off the priority stack for file **/ -ADFI_stack_control(file_index, 0, 0, CLEAR_STK_TYPE, SUBNODE_STK, - 0, NULL ) ; -ADFI_stack_control(file_index, 0, 0, CLEAR_STK_TYPE, DISK_PTR_STK, - 0, NULL ) ; - -tEnd(&gADFI_delete_sub_node_table_Timer); -} /* end of ADFI_delete_sub_node_table */ -/* end of file ADFI_delete_sub_node_table.c */ -/* file ADFI_disk_pointer_2_ASCII_Hex.c */ -/*********************************************************************** -ADFI disk pointer to ASCII Hex: - Convert a disk pointer into an ASCII-Hex representation (for disk). - -input: const struct DISK_POINTER *block_offset Disk-pointer struct. -output: char block[8] ASCII block number. -output: char offset[4] ASCII offset number. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -***********************************************************************/ -void ADFI_disk_pointer_2_ASCII_Hex( - const struct DISK_POINTER *block_offset, - char block[8], - char offset[4], - int *error_return ) -{ - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (block == NULL) || (offset == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Convert into ASCII-Hex form **/ -ADFI_unsigned_int_2_ASCII_Hex( block_offset->block, 0, MAXIMUM_32_BITS, - 8, block, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_unsigned_int_2_ASCII_Hex( block_offset->offset, 0, DISK_BLOCK_SIZE, - 4, offset, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -} /* end of ADFI_disk_pointer_2_ASCII_Hex */ -/* end of file ADFI_disk_pointer_2_ASCII_Hex.c */ -/* file ADFI_disk_pointer_from_ASCII_Hex.c */ -/*********************************************************************** -ADFI disk pointer from ASCII Hex: - Convert an ASCII-Hex representation into a disk-pointer (for memory). - -input: const char block[8] ASCII block number. -input: const char offset[4] ASCII offset number. -output: struct DISK_POINTER *block_offset Disk-pointer struct. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -***********************************************************************/ -void ADFI_disk_pointer_from_ASCII_Hex( - const char block[8], - const char offset[4], - struct DISK_POINTER *block_offset, - int *error_return ) -{ -unsigned int tmp ; - -if( (block == NULL) || (offset == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Convert into numeric form **/ -ADFI_ASCII_Hex_2_unsigned_int( 0, MAXIMUM_32_BITS, 8, block, - &tmp, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -block_offset->block = tmp ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, DISK_BLOCK_SIZE, 4, offset, - &tmp, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -block_offset->offset = tmp ; -} /* end of ADFI_disk_pointer_from_ASCII_Hex */ -/* end of file ADFI_disk_pointer_from_ASCII_Hex.c */ -/* file ADFI_evaluate_datatype.c */ -/*********************************************************************** -ADFI evaluate datatype: - -input: const int file_index The file index (0 to MAXIMUM_FILES). -input: const char *data_type. Data-type string. -output: int *file_bytes. Number of bytes used by the data type. -output: int *machine_ bytes. Number of bytes used by the data type. -output: struct TOKENIZED_DATA_TYPE *tokenized_data_type Array. -output: char *file_format The format of this file. -output: char *machine_format The format of this machine. -output: int error_return. Error return. - - Recognized data types: - Type Notation - No data MT - Integer 32 I4 - Integer 64 I8 - Unsigned 32 U4 - Unsigned 64 U8 - Real 32 R4 - Real 64 R8 - Complex 64 X4 - Complex 128 X8 - Character (unsigned byte) C1 - Link (same as C1) LK - Byte (unsigned byte) B1 - A structure is represented as the string "I4,I4,R8". - An array of 25 integers is "I4[25]". - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -DATA_TYPE_TOO_LONG -INVALID_DATA_TYPE -***********************************************************************/ -void ADFI_evaluate_datatype( - const int file_index, - const char data_type[], - int *file_bytes, - int *machine_bytes, - struct TOKENIZED_DATA_TYPE *tokenized_data_type, - char *file_format, - char *machine_format, - int *error_return ) -{ -int str_position = 0 ; -int current_token = 0 ; -int i, str_len, size_file, size_machine ; -char data_type_string[ADF_DATA_TYPE_LENGTH + 1 ] ; -struct FILE_HEADER file_header ; - -tStart(&gADFI_evaluate_datatype_Timer); -if( (file_format == NULL) || (machine_format == NULL) ) { - *error_return = NULL_STRING_POINTER ; - tEnd(&gADFI_evaluate_datatype_Timer); - return ; - } /* end if */ - -if( (file_bytes == NULL) || (machine_bytes == NULL) ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_evaluate_datatype_Timer); - return ; - } /* end if */ - -*file_bytes = 0 ; -*machine_bytes = 0 ; -*error_return = NO_ERROR ; - - /** Return the file & machine's format info **/ -if( file_index >= MAXIMUM_FILES ) { - *error_return = FILE_INDEX_OUT_OF_RANGE ; - tEnd(&gADFI_evaluate_datatype_Timer); - return ; - } /* end if */ -*file_format = ADF_file_format[file_index] ; -*machine_format = ADF_this_machine_format ; - - /** Convert blank-filled datatype into C string **/ -ADFI_string_2_C_string( data_type, ADF_DATA_TYPE_LENGTH, data_type_string, - error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_evaluate_datatype_Timer); - return ; - } - - /** Upper_CASE the data-type string **/ -str_len = strlen( data_type_string ) ; -if ( str_len == 0 ) { - *error_return = STRING_LENGTH_ZERO ; - tEnd(&gADFI_evaluate_datatype_Timer); - return ; -} /** end if **/ -for( i=0; i= '0') && - (data_type_string[ str_position ] <= '9') ) { - array_size = array_size * 10 + - (data_type_string[ str_position ] - '0') ; - str_position += 1 ; - } /* end while */ - if( data_type_string[ str_position ] != ']' ) { - *error_return = INVALID_DATA_TYPE ; - tEnd(&gADFI_evaluate_datatype_Timer); - return ; - } /* end if */ - str_position += 1 ; - /** Check for comma between types **/ - if( data_type_string[ str_position ] == ',' ) { - str_position += 1 ; - } /* end if */ - *file_bytes = *file_bytes + size_file * array_size ; - *machine_bytes = *machine_bytes + size_machine * array_size ; - tokenized_data_type[ current_token++ ].length = array_size ; - } - break ; - - case ',' : - str_position += 1 ; - *file_bytes = *file_bytes + size_file ; - *machine_bytes = *machine_bytes + size_machine ; - break ; - - default : /** Error condition **/ - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ - } /* end while */ -tokenized_data_type[ current_token ].type[0] = 0x00 ; -tokenized_data_type[ current_token ].type[1] = 0x00 ; -tokenized_data_type[ current_token ].file_type_size = *file_bytes; -tokenized_data_type[ current_token ].machine_type_size = *machine_bytes ; -tEnd(&gADFI_evaluate_datatype_Timer); -} /* end of ADFI_evaluate_datatype */ -/* end of file ADFI_evaluate_datatype.c */ -/* file ADFI_fflush_file.c */ -/*********************************************************************** -ADFI fflush file: - To flush the file output stream. - -input: const unsigned int file_index File to use. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -ADF_FILE_NOT_OPENED -FFLUSH_ERROR -***********************************************************************/ -void ADFI_fflush_file( - const unsigned int file_index, - int *error_return ) -{ - - -int iret ; - -tStart(&gADFI_fflush_file_Timer); -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_fflush_file_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -iret = fflush( ADF_file[ file_index ] ) ; -if( iret != 0 ) { - *error_return = FFLUSH_ERROR ; - tEnd(&gADFI_fflush_file_Timer); - return ; - } - -tEnd(&gADFI_fflush_file_Timer); -} /* end of ADFI_fflush_file */ -/* end of file ADFI_fflush_file.c */ -/* file ADFI_figure_machine_format.c */ -/* file ADFI_figure_machine_format.c */ -/*********************************************************************** -ADFI figure machine format: - Determine if the host computer is IEEE_BIG, IEEE_LITTLE, - CRAY, or NATIVE. Once this machines format if determined, - look at the requested format. If NATIVE, use this machines - format, otherwise use the requested format. - -input: const char *format IEEE_BIG, IEEE_LITTLE, CRAY, or NATIVE. -output: const char *machine_format 'B', 'L', 'C', 'N' -output: const char *format_to_use 'B', 'L', 'C', 'N' -output: const char *os_to_use 'B', 'L' -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -***********************************************************************/ - -static unsigned char bits[NUMBER_KNOWN_MACHINES][8][8] = { - /* IEEE BIG 32 */ - /* u.i = 123456789: */ { { 0x07, 0x5B, 0xCD, 0x15, 0x00, 0x00, 0x00, 0x00 }, - /* u.i = -123456789: */ { 0xF8, 0xA4, 0x32, 0xEB, 0x00, 0x00, 0x00, 0x00 }, - /* u.l = 1234567890L: */ { 0x49, 0x96, 0x02, 0xD2, 0x00, 0x00, 0x00, 0x00 }, - /* u.l = -1234567890L: */ { 0xB6, 0x69, 0xFD, 0x2E, 0x00, 0x00, 0x00, 0x00 }, - /* u.f = 12345.6789: */ { 0x46, 0x40, 0xE6, 0xB7, 0x00, 0x00, 0x00, 0x00 }, - /* u.f = -12345.6789: */ { 0xC6, 0x40, 0xE6, 0xB7, 0x00, 0x00, 0x00, 0x00 }, - /* u.d = 12345.6789: */ { 0x40, 0xC8, 0x1C, 0xD6, 0xE6, 0x31, 0xF8, 0xA1 }, - /* u.d = -12345.6789: */ { 0xC0, 0xC8, 0x1C, 0xD6, 0xE6, 0x31, 0xF8, 0xA1 } }, - - /* IEEE LITTLE 32 */ - /* u.i = 123456789: */ { { 0x15, 0xCD, 0x5B, 0x07, 0x00, 0x00, 0x00, 0x00 }, - /* u.i = -123456789: */ { 0xEB, 0x32, 0xA4, 0xF8, 0x00, 0x00, 0x00, 0x00 }, - /* u.l = 1234567890L: */ { 0xD2, 0x02, 0x96, 0x49, 0x00, 0x00, 0x00, 0x00 }, - /* u.l = -1234567890L: */ { 0x2E, 0xFD, 0x69, 0xB6, 0x00, 0x00, 0x00, 0x00 }, - /* u.f = 12345.6789: */ { 0xB7, 0xE6, 0x40, 0x46, 0x00, 0x00, 0x00, 0x00 }, - /* u.f = -12345.6789: */ { 0xB7, 0xE6, 0x40, 0xC6, 0x00, 0x00, 0x00, 0x00 }, - /* u.d = 12345.6789: */ { 0xA1, 0xF8, 0x31, 0xE6, 0xD6, 0x1C, 0xC8, 0x40 }, - /* u.d = -12345.6789: */ { 0xA1, 0xF8, 0x31, 0xE6, 0xD6, 0x1C, 0xC8, 0xC0 } }, - - /* IEEE BIG 64 */ - /* u.i = 123456789: */ { { 0x07, 0x5B, 0xCD, 0x15, 0x00, 0x00, 0x00, 0x00 }, - /* u.i = -123456789: */ { 0xF8, 0xA4, 0x32, 0xEB, 0x00, 0x00, 0x00, 0x00 }, - /* u.l = 1234567890L: */ { 0x00, 0x00, 0x00, 0x00, 0x49, 0x96, 0x02, 0xD2 }, - /* u.l = -1234567890L: */ { 0xFF, 0xFF, 0xFF, 0xFF, 0xB6, 0x69, 0xFD, 0x2E }, - /* u.f = 12345.6789: */ { 0x46, 0x40, 0xE6, 0xB7, 0x00, 0x00, 0x00, 0x00 }, - /* u.f = -12345.6789: */ { 0xC6, 0x40, 0xE6, 0xB7, 0x00, 0x00, 0x00, 0x00 }, - /* u.d = 12345.6789: */ { 0x40, 0xC8, 0x1C, 0xD6, 0xE6, 0x31, 0xF8, 0xA1 }, - /* u.d = -12345.6789: */ { 0xC0, 0xC8, 0x1C, 0xD6, 0xE6, 0x31, 0xF8, 0xA1 } }, - - /* IEEE LITTLE 64 */ - /* u.i = 123456789: */ { { 0x15, 0xCD, 0x5B, 0x07, 0x00, 0x00, 0x00, 0x00 }, - /* u.i = -123456789: */ { 0xEB, 0x32, 0xA4, 0xF8, 0x00, 0x00, 0x00, 0x00 }, - /* u.l = 1234567890L: */ { 0xD2, 0x02, 0x96, 0x49, 0x00, 0x00, 0x00, 0x00 }, - /* u.l = -1234567890L: */ { 0x2E, 0xFD, 0x69, 0xB6, 0xFF, 0xFF, 0xFF, 0xFF }, - /* u.f = 12345.6789: */ { 0xB7, 0xE6, 0x40, 0x46, 0x00, 0x00, 0x00, 0x00 }, - /* u.f = -12345.6789: */ { 0xB7, 0xE6, 0x40, 0xC6, 0x00, 0x00, 0x00, 0x00 }, - /* u.d = 12345.6789: */ { 0xA1, 0xF8, 0x31, 0xE6, 0xD6, 0x1C, 0xC8, 0x40 }, - /* u.d = -12345.6789: */ { 0xA1, 0xF8, 0x31, 0xE6, 0xD6, 0x1C, 0xC8, 0xC0 } }, - - /* CRAY */ - /* u.i = 123456789: */ { { 0x00, 0x00, 0x00, 0x00, 0x07, 0x5B, 0xCD, 0x15 }, - /* u.i = -123456789: */ { 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xA4, 0x32, 0xEB }, - /* u.l = 1234567890L: */ { 0x00, 0x00, 0x00, 0x00, 0x49, 0x96, 0x02, 0xD2 }, - /* u.l = -1234567890L: */ { 0xFF, 0xFF, 0xFF, 0xFF, 0xB6, 0x69, 0xFD, 0x2E }, - /* u.f = 12345.6789: */ { 0x40, 0x0E, 0xC0, 0xE6, 0xB7, 0x31, 0x8F, 0xC5 }, - /* u.f = -12345.6789: */ { 0xC0, 0x0E, 0xC0, 0xE6, 0xB7, 0x31, 0x8F, 0xC5 }, - /* u.d = 12345.6789: */ { 0x40, 0x0E, 0xC0, 0xE6, 0xB7, 0x31, 0x8F, 0xC5 }, - /* u.d = -12345.6789: */ { 0xC0, 0x0E, 0xC0, 0xE6, 0xB7, 0x31, 0x8F, 0xC5 } } - } ; - -void ADFI_figure_machine_format( - const char *format, - char *machine_format, - char *format_to_use, - char *os_to_use, - int *error_return ) -{ -char requested_format, requested_os, machine_os_size = 0; -union { int i; long l; float f; double d; unsigned char bytes[8]; } u ; -int i, k, OK ; - -if( (machine_format == NULL) || (format_to_use == NULL) || - (os_to_use == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check requested format **/ -if( format == NULL ) { - requested_format = NATIVE_FORMAT_CHAR ; - requested_os = OS_32_BIT ; - } /* end if */ -else if( (format[0] == '\0') || (format[0] == ' ') ) { - requested_format = NATIVE_FORMAT_CHAR ; - requested_os = OS_32_BIT ; - } /* end else if */ -else if( ADFI_stridx_c( IEEE_BIG_32_FORMAT_STRING, format ) == 0 ) { - requested_format = IEEE_BIG_FORMAT_CHAR ; - requested_os = OS_32_BIT ; - } /* end else if */ -else if( ADFI_stridx_c( IEEE_LITTLE_32_FORMAT_STRING, format ) == 0 ) { - requested_format = IEEE_LITTLE_FORMAT_CHAR ; - requested_os = OS_32_BIT ; - } /* end else if */ -else if( ADFI_stridx_c( IEEE_BIG_64_FORMAT_STRING, format ) == 0 ) { - requested_format = IEEE_BIG_FORMAT_CHAR ; - requested_os = OS_64_BIT ; - } /* end else if */ -else if( ADFI_stridx_c( IEEE_LITTLE_64_FORMAT_STRING, format ) == 0 ) { - requested_format = IEEE_LITTLE_FORMAT_CHAR ; - requested_os = OS_64_BIT ; - } /* end else if */ -else if( ADFI_stridx_c( CRAY_FORMAT_STRING, format ) == 0 ) { - requested_format = CRAY_FORMAT_CHAR ; - requested_os = OS_64_BIT ; - } /* end else if */ -else if( ADFI_stridx_c( NATIVE_FORMAT_STRING, format ) == 0 ) { - requested_format = NATIVE_FORMAT_CHAR ; - requested_os = OS_32_BIT ; - } /* end else if */ -else { - *error_return = ADF_FILE_FORMAT_NOT_RECOGNIZED ; - return ; - } /* end else */ - - /***** Determine this machine's numeric format *****/ - /** Check for numeric bit patterns **/ -#define ZERO_UNION() \ - for( k=0; k<8; k++ ) \ - u.bytes[k] = '\0' ; -#define CHECK_UNION(B) \ - if( (u.bytes[0] != B[0]) || (u.bytes[1] != B[1]) || \ - (u.bytes[2] != B[2]) || (u.bytes[3] != B[3]) || \ - (u.bytes[4] != B[4]) || (u.bytes[5] != B[5]) || \ - (u.bytes[6] != B[6]) || (u.bytes[7] != B[7]) ) continue ; - -OK = FALSE ; -*machine_format = NATIVE_FORMAT_CHAR ; -for( i=0; i= 8 ) machine_os_size = OS_64_BIT ; - else machine_os_size = OS_32_BIT ; - } /* end if */ - -if( ADF_this_machine_format == UNDEFINED_FORMAT_CHAR ) { - ADF_this_machine_format = *machine_format ; - ADF_this_machine_os_size = machine_os_size ; - } /* end if */ - -if( requested_format == NATIVE_FORMAT_CHAR ) { - *format_to_use = *machine_format ; - *os_to_use = machine_os_size ; - } /* end if */ -else { - *format_to_use = requested_format ; - *os_to_use = requested_os ; - } /* end if */ - -if( *machine_format == NATIVE_FORMAT_CHAR ) - *error_return = MACHINE_FORMAT_NOT_RECOGNIZED ; - -} /* end of ADFI_figure_machine_format */ -/* end of file ADFI_figure_machine_format.c */ -/* end of file ADFI_figure_machine_format.c */ -/* file ADFI_file_and_machine_compare.c */ -/*********************************************************************** -ADFI file and machine compare: - Compares file and machine formats. - -input: const int file_index The file index (0 to MAXIMUM_FILES). -output: int *compare 1 = formats compare, 0 = do not -output: int *error_return Error return - - Possible errors: -FILE_INDEX_OUT_OF_RANGE -***********************************************************************/ -void ADFI_file_and_machine_compare( - const int file_index, - const struct TOKENIZED_DATA_TYPE *tokenized_data_type, - int *compare, - int *error_return ) -{ - int machine_size, file_size, token ; - *compare = 0 ; - *error_return = NO_ERROR ; - - tStart(&gADFI_file_and_machine_compare_Timer); - if( file_index < 0 || file_index >= MAXIMUM_FILES ) { - *error_return = FILE_INDEX_OUT_OF_RANGE ; - tEnd(&gADFI_file_and_machine_compare_Timer); - return ; - } - - if( ADF_this_machine_format == NATIVE_FORMAT_CHAR || - ADF_file_format[file_index] == NATIVE_FORMAT_CHAR ) { - struct FILE_HEADER file_header ; - /** Get file_header for the file variable sizes **/ - ADFI_read_file_header( file_index, &file_header, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_and_machine_compare_Timer); - return ; - } - /** Make sure the sizes are the same or we are cooked!! **/ - if ( ADF_file_format[file_index] != NATIVE_FORMAT_CHAR || - file_header.sizeof_char != sizeof( char ) || - file_header.sizeof_short != sizeof( short ) || - file_header.sizeof_int != sizeof( int ) || - file_header.sizeof_long != sizeof( long ) || - file_header.sizeof_float != sizeof( float ) || - file_header.sizeof_double != sizeof( double ) || - file_header.sizeof_char_p != sizeof( char * ) || - file_header.sizeof_short_p != sizeof( short * ) || - file_header.sizeof_int_p != sizeof( int * ) || - file_header.sizeof_long_p != sizeof( long * ) || - file_header.sizeof_float_p != sizeof( float * ) || - file_header.sizeof_double_p != sizeof( double * ) ) { - *error_return = MACHINE_FILE_INCOMPATABLE ; - tEnd(&gADFI_file_and_machine_compare_Timer); - return ; - } /** end if **/ - } /** end if **/ - - if( ADF_file_format[file_index] == ADF_this_machine_format && - ADF_file_os_size[file_index] == ADF_this_machine_os_size ) { - *compare = 1 ; - } else if( ADF_file_format[file_index] == ADF_this_machine_format ) { - /** If the file and machine binary type are the same and only the - sizes may be different (like long is 32 or 64), then if all the - sizes are the same then no converion is necessary and ws can avoid - the conversion overhead and just do direct read/writes. **/ - if ( tokenized_data_type == NULL ) return ; - token = -1 ; - *compare = 1 ; - do { - token++ ; - machine_size = tokenized_data_type[ token ].machine_type_size ; - file_size = tokenized_data_type[ token ].file_type_size ; - if ( machine_size != file_size ) { - *compare = 0 ; - break ; - } - } while( tokenized_data_type[ token ].type[0] != 0 ) ; - } -tEnd(&gADFI_file_and_machine_compare_Timer); -} /* end of ADFI_file_and_machine_compare */ -/* end of file ADFI_file_and_machine_compare.c */ -/* file ADFI_file_block_offset_2_ID.c */ -/*********************************************************************** -ADFI file block and offset to ID: - Convert an ADF file, block, and offset to an ADF ID. - -input: const int file_index The file index (0 to MAXIMUM_FILES). -input: const unsigned long file_block The block within the file. -input: const unsigned long block_offset The offset within the block. -output: double *ID The resulting ADF ID. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -FILE_INDEX_OUT_OF_RANGE -BLOCK_OFFSET_OUT_OF_RANGE -***********************************************************************/ -void ADFI_file_block_offset_2_ID( - const int file_index, - const unsigned long file_block, - const unsigned long block_offset, - double *ID, - int *error_return ) -{ -double dd; -unsigned char * cc; - -if( ID == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; -if( file_index >= MAXIMUM_FILES ) { - *error_return = FILE_INDEX_OUT_OF_RANGE ; - return ; - } /* end if */ - -if( block_offset >= DISK_BLOCK_SIZE ) { - *error_return = BLOCK_OFFSET_OUT_OF_RANGE ; - return ; - } /* end if */ - - /** Map the bytes into the character variable **/ - /* Note that there were problems with some machines flushing small numbers - to zero causing problems with the encoding of ID (which is not in - its self a true number). The IEEE standard says that this is not - allowed and so should not be a problem except that you get a major - performance hit on the machine if you have it enforce the IEEE - standard. Thus I force the sign bit on the exponent to always be positive - so that the ID is a number greater than |1|. Previously on the - IEEE big endian the numbers would look like 3.132313E-311. The - new encoding changes the max number of open files to 16K from 64K */ - -cc = (unsigned char *) ⅆ -if ( ADF_this_machine_format == IEEE_BIG_FORMAT_CHAR ) { - cc[1] = (unsigned char) (file_index & 0x00ff) ; - cc[0] = (unsigned char) (64 + (( file_index >> 8) & 0x003f)) ; - - cc[2] = (unsigned char) (file_block & 0x000000ff) ; - cc[3] = (unsigned char) ((file_block >> 8) & 0x000000ff) ; - cc[4] = (unsigned char) ((file_block >> 16) & 0x000000ff) ; - cc[5] = (unsigned char) ((file_block >> 24) & 0x000000ff) ; - - cc[6] = (unsigned char) (block_offset & 0x00ff) ; - cc[7] = (unsigned char) ((block_offset >> 8) & 0x00ff) ; - } /* end if */ -else if ( ADF_this_machine_format == IEEE_LITTLE_FORMAT_CHAR ) { - cc[6] = (unsigned char) (file_index & 0x00ff) ; - cc[7] = (unsigned char) (64 + (( file_index >> 8) & 0x003f)) ; - - cc[2] = (unsigned char) (file_block & 0x000000ff) ; - cc[3] = (unsigned char) ((file_block >> 8) & 0x000000ff) ; - cc[4] = (unsigned char) ((file_block >> 16) & 0x000000ff) ; - cc[5] = (unsigned char) ((file_block >> 24) & 0x000000ff) ; - - cc[0] = (unsigned char) (block_offset & 0x00ff) ; - cc[1] = (unsigned char) ((block_offset >> 8) & 0x00ff) ; - } /* end else if */ -else { - cc[0] = (unsigned char) (file_index & 0x00ff) ; - cc[1] = (unsigned char) ((file_index >> 8) & 0x00ff) ; - - cc[2] = (unsigned char) (file_block & 0x000000ff) ; - cc[3] = (unsigned char) ((file_block >> 8) & 0x000000ff) ; - cc[4] = (unsigned char) ((file_block >> 16) & 0x000000ff) ; - cc[5] = (unsigned char) ((file_block >> 24) & 0x000000ff) ; - - cc[6] = (unsigned char) (block_offset & 0x00ff) ; - cc[7] = (unsigned char) ((block_offset >> 8) & 0x00ff) ; - } /* end else */ - -*ID = dd; -#ifdef PRINT_STUFF -printf("cc[0-7] = %02X %02X %02X %02X %02X %02X %02X %02X \n", - cc[0], cc[1], cc[2], cc[3], - cc[4], cc[5], cc[6], cc[7] ) ; -printf("In ADFI_file_block_offset_2_ID: ID=%lf\n",*ID); -#endif - -} /* end of ADFI_file_block_offset_2_ID */ -/* end of file ADFI_file_block_offset_2_ID.c */ -/* file ADFI_file_free.c */ -/*********************************************************************** -ADFI file free: - To free-up a chunk of file space. - -input: const int file_index The file index (0 to MAXIMUM_FILES). -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const long number_of_bytes Number of bytes to free. If 0, - then look at type of chunk to get size. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -FREE_OF_ROOT_NODE -ADF_DISK_TAG_ERROR -FREE_OF_FREE_CHUNK_TABLE -***********************************************************************/ -void ADFI_file_free( - const int file_index, - const struct DISK_POINTER *block_offset, - const long in_number_of_bytes, - int *error_return ) -{ -char tag[TAG_SIZE + 1] ; -struct DISK_POINTER end_of_chunk_tag ; -struct DISK_POINTER tmp_blk_ofst ; -struct FREE_CHUNK_TABLE free_chunk_table ; -struct FREE_CHUNK free_chunk ; -int i ; -long number_of_bytes = in_number_of_bytes ; - -tStart(&gADFI_file_free_Timer); -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_file_free_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_file_free_Timer); - return ; - } /* end if */ - -if( number_of_bytes == 0 ) { - - /** Check the disk tag to see what kind of disk chunk we have. - We need this to determine the length of the chunk. **/ - ADFI_read_file( file_index, block_offset->block, block_offset->offset, - TAG_SIZE, tag, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_free_Timer); - return ; - } - - tag[TAG_SIZE] = '\0' ; /* Null terminate the string */ - - end_of_chunk_tag.block = 0 ; - end_of_chunk_tag.offset = 0 ; - if( ADFI_stridx_c( tag, node_start_tag ) == 0 ) { /** This is a node **/ - if( (block_offset->block == ROOT_NODE_BLOCK) && - (block_offset->offset == ROOT_NODE_OFFSET) ) { - *error_return = FREE_OF_ROOT_NODE ; - tEnd(&gADFI_file_free_Timer); - return ; - } /* end if */ - end_of_chunk_tag.block = block_offset->block ; - end_of_chunk_tag.offset = block_offset->offset + NODE_HEADER_SIZE - - TAG_SIZE ; - if ( end_of_chunk_tag.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_free_Timer); - return ; - } - } - - /** Check disk boundary-tag **/ - ADFI_read_file( file_index, end_of_chunk_tag.block, - end_of_chunk_tag.offset, TAG_SIZE, tag, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_free_Timer); - return ; - } - if( ADFI_stridx_c( tag, node_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - tEnd(&gADFI_file_free_Timer); - return ; - } /* end if */ - } /* end if */ - else if( ADFI_stridx_c( tag, free_chunk_table_start_tag ) == 0 ) { - /** Trying to free the free-chunk-table. This is BAD. **/ - *error_return = FREE_OF_FREE_CHUNK_TABLE ; - tEnd(&gADFI_file_free_Timer); - return ; - } /* end else if */ - else if( ADFI_stridx_c( tag, free_chunk_start_tag ) == 0 ) { - - /** Set a temporary block/offset to read disk pointer **/ - tmp_blk_ofst.block = block_offset->block ; - tmp_blk_ofst.offset = block_offset->offset + TAG_SIZE ; - if ( tmp_blk_ofst.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &tmp_blk_ofst, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_free_Timer); - return ; - } - } - /** Get the end_of_chunk-tag block/offset from disk **/ - ADFI_read_disk_pointer_from_disk( file_index, tmp_blk_ofst.block, - tmp_blk_ofst.offset, &end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_free_Timer); - return ; - } - - /** Check disk boundary-tag **/ - ADFI_read_file( file_index, end_of_chunk_tag.block, - end_of_chunk_tag.offset, TAG_SIZE, tag, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_free_Timer); - return ; - } - if( ADFI_stridx_c( tag, free_chunk_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - tEnd(&gADFI_file_free_Timer); - return ; - } /* end if */ - } /* end else if */ - else if( ADFI_stridx_c( tag, sub_node_start_tag ) == 0 ) { - - /** Set a temporary block/offset to read disk pointer **/ - tmp_blk_ofst.block = block_offset->block ; - tmp_blk_ofst.offset = block_offset->offset + TAG_SIZE ; - if ( tmp_blk_ofst.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &tmp_blk_ofst, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_free_Timer); - return ; - } - } - - /** Get the end_of_chunk-tag block/offset from disk **/ - ADFI_read_disk_pointer_from_disk( file_index, tmp_blk_ofst.block, - tmp_blk_ofst.offset, &end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_free_Timer); - return ; - } - - /** Check disk boundary-tag **/ - ADFI_read_file( file_index, end_of_chunk_tag.block, - end_of_chunk_tag.offset, TAG_SIZE, tag, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_free_Timer); - return ; - } - if( ADFI_stridx_c( tag, sub_node_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - tEnd(&gADFI_file_free_Timer); - return ; - } /* end if */ - } /* end else if */ - else if( ADFI_stridx_c( tag, data_chunk_table_start_tag ) == 0 ) { - - /** Set a temporary block/offset to read disk pointer **/ - tmp_blk_ofst.block = block_offset->block ; - tmp_blk_ofst.offset = block_offset->offset + TAG_SIZE ; - if ( tmp_blk_ofst.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &tmp_blk_ofst, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_free_Timer); - return ; - } - } - - /** Get the end_of_chunk-tag block/offset from disk **/ - ADFI_read_disk_pointer_from_disk( file_index, tmp_blk_ofst.block, - tmp_blk_ofst.offset, &end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_free_Timer); - return ; - } - - /** Check disk boundary-tag **/ - ADFI_read_file( file_index, end_of_chunk_tag.block, - end_of_chunk_tag.offset, TAG_SIZE, tag, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_free_Timer); - return ; - } - if( ADFI_stridx_c( tag, data_chunk_table_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - tEnd(&gADFI_file_free_Timer); - return ; - } /* end if */ - } /* end else if */ - else if( ADFI_stridx_c( tag, data_chunk_start_tag ) == 0 ) { - - /** Set a temporary block/offset to read disk pointer **/ - tmp_blk_ofst.block = block_offset->block ; - tmp_blk_ofst.offset = block_offset->offset + TAG_SIZE ; - if ( tmp_blk_ofst.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &tmp_blk_ofst, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_free_Timer); - return ; - } - } - - /** Get the end_of_chunk-tag block/offset from disk **/ - ADFI_read_disk_pointer_from_disk( file_index, tmp_blk_ofst.block, - tmp_blk_ofst.offset, &end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_free_Timer); - return ; - } - - /** Check disk boundary-tag **/ - ADFI_read_file( file_index, end_of_chunk_tag.block, - end_of_chunk_tag.offset, TAG_SIZE, tag, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_free_Timer); - return ; - } - if( ADFI_stridx_c( tag, data_chunk_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - tEnd(&gADFI_file_free_Timer); - return ; - } /* end if */ - } /* end else if */ - else { - *error_return = ADF_DISK_TAG_ERROR ; - tEnd(&gADFI_file_free_Timer); - return ; - } /* end else */ - number_of_bytes = (end_of_chunk_tag.block - block_offset->block) * - DISK_BLOCK_SIZE + (end_of_chunk_tag.offset - block_offset->offset + - TAG_SIZE) ; - } /* end if */ -else { /** Use the number of bytes passed in **/ - end_of_chunk_tag.block = block_offset->block ; - end_of_chunk_tag.offset = block_offset->offset + number_of_bytes - TAG_SIZE ; - ADFI_adjust_disk_pointer( &end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - -tStart(&gADFI_file_free_free_Timer); -if( number_of_bytes <= SMALLEST_CHUNK_SIZE ) { /** Too small, z-gas **/ - /** Initialize the block of 'Z's **/ - if( block_of_ZZ_initialized == FALSE ) { - for( i=0; iblock, block_offset->offset); - ADFI_write_file( file_index, block_offset->block, block_offset->offset, - number_of_bytes, block_of_ZZ, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_free_free_Timer); - tEnd(&gADFI_file_free_Timer); - return ; - } - } /* end if */ -else { /** Add this chunk to the free table **/ - /** Get the free-chunk-table **/ - ADFI_read_free_chunk_table( file_index, &free_chunk_table, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_free_free_Timer); - tEnd(&gADFI_file_free_Timer); - return ; - } - - if( block_offset->block == end_of_chunk_tag.block ) { /* small or medium */ - if( (end_of_chunk_tag.offset + TAG_SIZE - block_offset->offset) <= - SMALL_CHUNK_MAXIMUM ) { /** SMALL chunk **/ - free_chunk.end_of_chunk_tag.block = end_of_chunk_tag.block ; - free_chunk.end_of_chunk_tag.offset = end_of_chunk_tag.offset ; - free_chunk.next_chunk.block = free_chunk_table.small_first_block.block; - free_chunk.next_chunk.offset = - free_chunk_table.small_first_block.offset ; - - free_chunk_table.small_first_block.block = block_offset->block ; - free_chunk_table.small_first_block.offset = block_offset->offset ; - - /** If linked-list was empty, also point to this as the last. **/ - if( free_chunk.next_chunk.offset == BLANK_BLOCK_OFFSET ) { - free_chunk_table.small_last_block.block = block_offset->block ; - free_chunk_table.small_last_block.offset = block_offset->offset ; - } /* end if */ - } /* end if */ - else { /** MEDIUM chunk **/ - free_chunk.end_of_chunk_tag.block = end_of_chunk_tag.block ; - free_chunk.end_of_chunk_tag.offset = end_of_chunk_tag.offset ; - free_chunk.next_chunk.block = - free_chunk_table.medium_first_block.block ; - free_chunk.next_chunk.offset = - free_chunk_table.medium_first_block.offset; - - free_chunk_table.medium_first_block.block = block_offset->block ; - free_chunk_table.medium_first_block.offset = block_offset->offset ; - - /** If linked-list was empty, also point to this as the last. **/ - if( free_chunk.next_chunk.offset == BLANK_BLOCK_OFFSET ) { - free_chunk_table.medium_last_block.block = block_offset->block ; - free_chunk_table.medium_last_block.offset = block_offset->offset ; - } /* end if */ - } /* end else */ - } /* end if */ - else { /** LARGE chunk **/ - free_chunk.end_of_chunk_tag.block = end_of_chunk_tag.block ; - free_chunk.end_of_chunk_tag.offset = end_of_chunk_tag.offset ; - free_chunk.next_chunk.block = free_chunk_table.large_first_block.block; - free_chunk.next_chunk.offset = - free_chunk_table.large_first_block.offset ; - - free_chunk_table.large_first_block.block = block_offset->block ; - free_chunk_table.large_first_block.offset = block_offset->offset ; - - /** If linked-list was empty, also point to this as the last. **/ - if( free_chunk.next_chunk.offset == BLANK_BLOCK_OFFSET ) { - free_chunk_table.large_last_block.block = block_offset->block ; - free_chunk_table.large_last_block.offset = block_offset->offset ; - } /* end if */ - } /* end else */ - - /** Put the free-chunk tags in place **/ - strncpy( free_chunk.start_tag, free_chunk_start_tag, TAG_SIZE ) ; - strncpy( free_chunk.end_tag, free_chunk_end_tag, TAG_SIZE ) ; - - /** Write out the free chunk **/ - ADFI_write_free_chunk( file_index, block_offset, &free_chunk, error_return ); - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_free_free_Timer); - tEnd(&gADFI_file_free_Timer); - return ; - } - /** Update the free-chunk-table **/ - ADFI_write_free_chunk_table( file_index, &free_chunk_table, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_free_free_Timer); - tEnd(&gADFI_file_free_Timer); - return ; - } - } /* end else */ - - /** Delete the block/offset off the stack **/ - ADFI_stack_control(file_index, block_offset->block, block_offset->offset, - DEL_STK_ENTRY, 0, 0, NULL ) ; - -tEnd(&gADFI_file_free_free_Timer); -tEnd(&gADFI_file_free_Timer); -} /* end of ADFI_file_free */ -/* end of file ADFI_file_free.c */ -/* file ADFI_file_malloc.c */ -/*********************************************************************** -ADFI file malloc: - To allocate a chunk of disk space. - -input: const int file_index The file index (0 to MAXIMUM_FILES). -input: size_bytes The size in bytes to allocate. -output: const struct DISK_POINTER *block_offset Block & offset in the file. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_file_malloc_core( - const int file_index, - const long size_bytes, - struct DISK_POINTER *block_offset, - int do_writes, - int *error_return ) -{ -struct FILE_HEADER file_header ; -struct FREE_CHUNK_TABLE free_chunk_table ; -struct DISK_POINTER disk_pointer, previous_disk_pointer ; -struct DISK_POINTER *first_free_block, *last_free_block ; -struct FREE_CHUNK free_chunk, previous_free_chunk ; -int i ; -int memory_found = FALSE ; -unsigned long size ; - -tStart(&gADFI_file_malloc_Timer); -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_file_malloc_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_file_malloc_Timer); - return ; - } /* end if */ - - /** Get the free-chunk_table **/ -ADFI_read_free_chunk_table( file_index, &free_chunk_table, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_malloc_Timer); - return ; - } - - /** Look for the needed space in the 3 free lists. - Note that all file control headers are smaller than - the SMALLEST_CHUNK_SIZE and so will be fit later into - a block at the end of the file. This greatly improves - node creation efficiency. **/ -for( i=0; i<3; i++ ) { - if( memory_found == TRUE || size_bytes <= SMALLEST_CHUNK_SIZE ) - break ; - ADFI_set_blank_disk_pointer( &previous_disk_pointer ) ; - switch( i ) { - case 0: /** SMALL CHUNKS **/ - if( size_bytes > SMALL_CHUNK_MAXIMUM ) - continue ; /** Next in the for loop **/ - first_free_block = &free_chunk_table.small_first_block ; - last_free_block = &free_chunk_table.small_last_block ; - break ; - case 1: /** MEDIUM CHUNKS **/ - if( size_bytes > MEDIUM_CHUNK_MAXIMUM ) - continue ; /** Next in the for loop **/ - first_free_block = &free_chunk_table.medium_first_block ; - last_free_block = &free_chunk_table.medium_last_block ; - break ; - case 2: /** LARGE CHUNKS **/ - first_free_block = &free_chunk_table.large_first_block ; - last_free_block = &free_chunk_table.large_last_block ; - break ; - } /* end switch */ - - disk_pointer = *first_free_block ; - while( (memory_found != TRUE) && - ((disk_pointer.block != BLANK_FILE_BLOCK) || - (disk_pointer.offset != BLANK_BLOCK_OFFSET)) ) { - ADFI_read_free_chunk( file_index, &disk_pointer, &free_chunk, - error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_malloc_Timer); - return ; - } - size = (free_chunk.end_of_chunk_tag.block - disk_pointer.block) * - DISK_BLOCK_SIZE + - (free_chunk.end_of_chunk_tag.offset - disk_pointer.offset) + - TAG_SIZE ; - if( (long int) size >= size_bytes ) { - *block_offset = disk_pointer ; - if( (previous_disk_pointer.block != BLANK_FILE_BLOCK) || - (previous_disk_pointer.offset != BLANK_BLOCK_OFFSET) ) { - - /** Link previous free-chunk to the next free-chunk, - removing this free-chunk from the list - **/ - ADFI_read_free_chunk( file_index, &previous_disk_pointer, - &previous_free_chunk, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_malloc_Timer); - return ; - } - previous_free_chunk.next_chunk = free_chunk.next_chunk ; - printf("\twrite free chunk: (%d, %d)\n", previous_disk_pointer.block, previous_disk_pointer.offset); - if (do_writes) - ADFI_write_free_chunk( file_index, &previous_disk_pointer, - &previous_free_chunk, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_malloc_Timer); - return ; - } - } /* end if */ - else { - - /** Free-chunk was the first one, change entry in the free-chunk-header **/ - *first_free_block = free_chunk.next_chunk ; - if (do_writes) - ADFI_write_free_chunk_table( file_index, &free_chunk_table, - error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_malloc_Timer); - return ; - } - } /* end else */ - - if((last_free_block->block == disk_pointer.block) && - (last_free_block->offset == disk_pointer.offset)){ - if( (previous_disk_pointer.block != BLANK_FILE_BLOCK) || - (previous_disk_pointer.offset != BLANK_BLOCK_OFFSET) ) { - *last_free_block = previous_disk_pointer ; - } /* end if */ - else { - ADFI_set_blank_disk_pointer( last_free_block ) ; - } /* end else */ - if (do_writes) - ADFI_write_free_chunk_table( file_index, &free_chunk_table, - error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_malloc_Timer); - return ; - } - } /* end if */ - - size -= size_bytes ; - if ( size > 0 ) { - disk_pointer.offset += size_bytes ; - ADFI_adjust_disk_pointer( &disk_pointer, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_malloc_Timer); - return ; - } - if (do_writes) - ADFI_file_free( file_index, &disk_pointer, size, error_return ); - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_malloc_Timer); - return ; - } - } - memory_found = TRUE ; - } /* end if */ - else { - previous_disk_pointer = disk_pointer ; - disk_pointer = free_chunk.next_chunk ; - } /* end else */ - } /* end while */ - } /* end if */ - - /** The end-of_file pointer points to the last byte USED, - NOT the next byte TO USE. - **/ -if( memory_found != TRUE ) { /* Append memory at end of file **/ - ADFI_read_file_header( file_index, &file_header, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_malloc_Timer); - return ; - } - /** If the end-of_file is NOT at a block boundary, then - see if the new allocated chunk will span a block boundary. - If it will, then start at the new block if it will fit within - the block. This helps efficiency to have file control headers - located within a block boundry. - **/ - if( file_header.end_of_file.offset != DISK_BLOCK_SIZE - 1 ) { - if( (file_header.end_of_file.offset+size_bytes) >= DISK_BLOCK_SIZE && - size_bytes <= DISK_BLOCK_SIZE ) { - /** Free rest of block, allocate from next block **/ - file_header.end_of_file.offset++ ; - if (do_writes) - ADFI_file_free( file_index, &file_header.end_of_file, - DISK_BLOCK_SIZE - file_header.end_of_file.offset, - error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_malloc_Timer); - return ; - } - block_offset->block = file_header.end_of_file.block + 1 ; - block_offset->offset = 0 ; - file_header.end_of_file.block++ ; - file_header.end_of_file.offset = size_bytes - 1 ; - ADFI_adjust_disk_pointer( &file_header.end_of_file, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_malloc_Timer); - return ; - } - - } /* end if */ - else { /** Use the remaining block **/ - block_offset->block = file_header.end_of_file.block ; - block_offset->offset = file_header.end_of_file.offset + 1 ; - file_header.end_of_file.offset += size_bytes ; - ADFI_adjust_disk_pointer( &file_header.end_of_file, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_malloc_Timer); - return ; - } - } /* end else */ - } /* end if */ - else { /* already pointing to start of block **/ - block_offset->block = file_header.end_of_file.block + 1 ; - block_offset->offset = 0 ; - file_header.end_of_file.block++ ; - file_header.end_of_file.offset = size_bytes - 1 ; - ADFI_adjust_disk_pointer( &file_header.end_of_file, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_malloc_Timer); - return ; - } - } /* end else */ - - - /** Write out the modified file header **/ - if (do_writes) - ADFI_write_file_header( file_index, &file_header, 1, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_file_malloc_Timer); - return ; - } - } /* end if */ - -tEnd(&gADFI_file_malloc_Timer); -} /* end of ADFI_file_malloc */ - -void ADFI_file_malloc( - const int file_index, - const long size_bytes, - struct DISK_POINTER *block_offset, - int *error_return ) -{ - ADFI_file_malloc_core(file_index, size_bytes, block_offset, 1, - error_return); -} - -void ADFI_file_malloc_preview( - const int file_index, - const long size_bytes, - struct DISK_POINTER *block_offset, - int *error_return ) -{ - ADFI_file_malloc_core(file_index, size_bytes, block_offset, 0, - error_return); -} - -/* end of file ADFI_file_malloc.c */ -/* file ADFI_fill_initial_file_header.c */ -/*********************************************************************** -ADFI fill initial file header: - To determine the file header information... - -input: const char format 'B', 'L', 'C', 'N' -input: const char os_size 'B', 'L' -input: const char *what_string UNIX "what" identifier. -output: struct FILE_HEADER *file_header The resulting file header information. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -ADF_FILE_FORMAT_NOT_RECOGNIZED -***********************************************************************/ -void ADFI_fill_initial_file_header( - const char format, - const char os_size, - const char *what_string, - struct FILE_HEADER *file_header, - int *error_return ) -{ -int i ; - -if( what_string == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_header == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (format != IEEE_BIG_FORMAT_CHAR) && (format != IEEE_LITTLE_FORMAT_CHAR) && - (format != CRAY_FORMAT_CHAR) && (format != NATIVE_FORMAT_CHAR) ) { - *error_return = ADF_FILE_FORMAT_NOT_RECOGNIZED ; - return ; - } /* end if */ - - /** Put the boundary tags in first. If we then overwrite them, we'll know **/ -strncpy( file_header->tag0, file_header_tags[0], TAG_SIZE ) ; -strncpy( file_header->tag1, file_header_tags[1], TAG_SIZE ) ; -strncpy( file_header->tag2, file_header_tags[2], TAG_SIZE ) ; -strncpy( file_header->tag3, file_header_tags[3], TAG_SIZE ) ; -strncpy( file_header->tag4, file_header_tags[4], TAG_SIZE ) ; -strncpy( file_header->tag5, file_header_tags[5], TAG_SIZE ) ; - - /** The UNIX "what" string" - blank terminated **/ -strncpy( file_header->what, what_string, WHAT_STRING_SIZE ) ; -if ( strlen(what_string) < WHAT_STRING_SIZE ) -{ - ADFI_blank_fill_string ( file_header->what, WHAT_STRING_SIZE ) ; -} - - /** File creation date/time - blank terminated **/ -ADFI_get_current_date( file_header->creation_date ) ; - - /** File modification date/time - same as creation time **/ -strncpy( file_header->modification_date, file_header->creation_date, - DATE_TIME_SIZE ) ; - -file_header->numeric_format = format ; -file_header->os_size = os_size ; - - /** Set sizeof() information for file data **/ -if( (format==ADF_this_machine_format && os_size==ADF_this_machine_os_size) || - format==NATIVE_FORMAT_CHAR ) -{ - file_header->sizeof_char = sizeof( char ) ; - file_header->sizeof_short = sizeof( short ) ; - file_header->sizeof_int = sizeof( int ) ; - file_header->sizeof_long = sizeof( long ) ; - file_header->sizeof_float = sizeof( float ) ; - file_header->sizeof_double = sizeof( double ) ; - file_header->sizeof_char_p = sizeof( char * ) ; - file_header->sizeof_short_p = sizeof( short * ) ; - file_header->sizeof_int_p = sizeof( int * ) ; - file_header->sizeof_long_p = sizeof( long * ) ; - file_header->sizeof_float_p = sizeof( float * ) ; - file_header->sizeof_double_p = sizeof( double * ) ; -} /** end if **/ -else -{ - switch( EVAL_2_BYTES( format, os_size ) ) { - case EVAL_2_BYTES( 'B', 'L' ): - i = IEEE_BIG_32_FORMAT - 1 ; - break ; - case EVAL_2_BYTES( 'L', 'L' ): - i = IEEE_LITTLE_32_FORMAT - 1 ; - break ; - case EVAL_2_BYTES( 'B', 'B' ): - i = IEEE_BIG_64_FORMAT - 1 ; - break ; - case EVAL_2_BYTES( 'L', 'B' ): - i = IEEE_LITTLE_64_FORMAT - 1 ; - break ; - case EVAL_2_BYTES( 'C', 'B' ): - i = CRAY_FORMAT - 1 ; - break ; - default: - *error_return = MACHINE_FORMAT_NOT_RECOGNIZED ; - return ; - } /* end switch */ - - file_header->sizeof_char = machine_sizes[i][ 0] ; - file_header->sizeof_short = machine_sizes[i][ 3] ; - file_header->sizeof_int = machine_sizes[i][ 5] ; - file_header->sizeof_long = machine_sizes[i][ 7] ; - file_header->sizeof_float = machine_sizes[i][ 9] ; - file_header->sizeof_double = machine_sizes[i][10] ; - file_header->sizeof_char_p = machine_sizes[i][11] ; - file_header->sizeof_short_p = machine_sizes[i][12] ; - file_header->sizeof_int_p = machine_sizes[i][12] ; - file_header->sizeof_long_p = machine_sizes[i][13] ; - file_header->sizeof_float_p = machine_sizes[i][14] ; - file_header->sizeof_double_p = machine_sizes[i][15] ; -} /** end else **/ - - /** Set root node table pointers **/ -file_header->root_node.block = ROOT_NODE_BLOCK ; -file_header->root_node.offset = ROOT_NODE_OFFSET ; -file_header->end_of_file.block = ROOT_NODE_BLOCK ; -file_header->end_of_file.offset = ROOT_NODE_OFFSET + NODE_HEADER_SIZE - 1 ; -file_header->free_chunks.block = FREE_CHUNKS_BLOCK ; -file_header->free_chunks.offset = FREE_CHUNKS_OFFSET ; -ADFI_set_blank_disk_pointer( &file_header->extra ) ; - -} /* end of ADFI_fill_initial_file_header */ -/* end of file ADFI_fill_initial_file_header.c */ -/* file ADFI_fill_initial_free_chunk_table.c */ -/*********************************************************************** -ADFI fill initial free chunk header: - To fill out a new free chunk header. - -output: struct FREE_CHUNK_TABLE *free_chunk_table Resulting header info. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -***********************************************************************/ -void ADFI_fill_initial_free_chunk_table( - struct FREE_CHUNK_TABLE *free_chunk_table, - int *error_return ) -{ - -if( free_chunk_table == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -strncpy( free_chunk_table->start_tag, free_chunk_table_start_tag, TAG_SIZE ) ; -strncpy( free_chunk_table->end_tag, free_chunk_table_end_tag, TAG_SIZE ) ; - - /** Small: First and Last Blocks **/ -ADFI_set_blank_disk_pointer( &free_chunk_table->small_first_block ) ; -ADFI_set_blank_disk_pointer( &free_chunk_table->small_last_block ) ; - - /** Medium: First and Last Blocks **/ -ADFI_set_blank_disk_pointer( &free_chunk_table->medium_first_block ) ; -ADFI_set_blank_disk_pointer( &free_chunk_table->medium_last_block ) ; - - /** large: First and Last Blocks **/ -ADFI_set_blank_disk_pointer( &free_chunk_table->large_first_block ) ; -ADFI_set_blank_disk_pointer( &free_chunk_table->large_last_block ) ; -} /* end of ADFI_fill_initial_free_chunk_table */ -/* end of file ADFI_fill_initial_free_chunk_table.c */ -/* file ADFI_fill_initial_node_header.c */ -/*********************************************************************** -ADFI fill initial node header: - To fill out a new node header. - -output: struct NODE_HEADER *node_header The resulting node header information. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -***********************************************************************/ -void ADFI_fill_initial_node_header( - struct NODE_HEADER *node_header, - int *error_return ) -{ -int i ; - -if( node_header == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -strncpy( node_header->node_start_tag, node_start_tag, TAG_SIZE ) ; -strncpy( node_header->node_end_tag, node_end_tag, TAG_SIZE ) ; - - /** Blank out the name **/ -for( i=0; iname[i] = ' ' ; - - /** Blank out the label **/ -for( i=0; ilabel[i] = ' ' ; - - /** Set number of sub nodes to zero **/ -node_header->num_sub_nodes = 0 ; -node_header->entries_for_sub_nodes = 0 ; -ADFI_set_blank_disk_pointer( &node_header->sub_node_table ) ; - - /** Blank out the Data-Type, then set to eMpTy. **/ -for( i=2; idata_type[i] = ' ' ; -node_header->data_type[0] = 'M' ; -node_header->data_type[1] = 'T' ; - - - /** Zero out number of dimensions & Set dimension values to zero **/ -node_header->number_of_dimensions = 0 ; -for( i=0; idimension_values[i] = 0 ; - - /** Set number of data chunks to zero, zero out data chunk pointer **/ -node_header->number_of_data_chunks = 0 ; -ADFI_set_blank_disk_pointer( &node_header->data_chunks ) ; -} /* end of ADFI_fill_initial_node_header */ -/* end of file ADFI_fill_initial_node_header.c */ -/* file ADFI_flush_buffers.c */ -/*********************************************************************** -ADFI Flush buffers: - -input: const unsigned int file_index The file index. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -ADF_FILE_NOT_OPENED -FWRITE_ERROR -***********************************************************************/ -void ADFI_flush_buffers( - const unsigned int file_index, - int flush_mode, - int *error_return ) -{ -char data; - -tStart(&gADFI_flush_buffers_Timer); -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_flush_buffers_Timer); - return ; -} /* end if */ - -*error_return = NO_ERROR ; - -if ( (long int) file_index == last_wr_file ) { - /** Flush any active write buffer, file block is set to a nonsense - value so that the buffer flags are not reset **/ - ADFI_write_file ( file_index, MAXIMUM_32_BITS, 0, 0, &data, error_return ) ; - /** Reset control flags **/ - if ( flush_mode == FLUSH_CLOSE ) - last_wr_block = last_wr_file = flush_wr_block = -2 ; -} - -if ( (long int) file_index == last_rd_file && flush_mode == FLUSH_CLOSE ) { - /** Reset control flags **/ - last_rd_block = last_rd_file = num_in_rd_block = -1 ; -} - -tEnd(&gADFI_flush_buffers_Timer); -} /* end of ADFI_flush_buffers */ -/* end of file ADFI_flush_buffers.c */ -/* file ADFI_fseek_file.c */ -/*********************************************************************** -ADFI_fseek_file: - To position the current position for fread() or fwrite(). - Need to allow for files larger than what a long int can - represent (the offset for fseek). - -input: const unsigned int file_index File to use. -input: const unsigned long file_block Block within the file. -input: const unsigned long block_offset Offset within the block. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -ADF_FILE_NOT_OPENED -FSEEK_ERROR -***********************************************************************/ -void ADFI_fseek_file( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - int *error_return ) -{ -off_t offset ; -int iret ; - -tStart(&gADFI_fseek_file_Timer); -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_fseek_file_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -offset = file_block * DISK_BLOCK_SIZE + block_offset ; -if (offset != ftello( ADF_file[ file_index ] )) { - iret = fseeko( ADF_file[ file_index ], offset, SEEK_SET ) ; - printf("fseek(file, %d, SEEK_SET)\n", file_block); -} -else -//{ -// printf("Skipping fseek!\n"); - iret = 0; -//} -if( iret != 0 ) { - *error_return = FSEEK_ERROR ; - tEnd(&gADFI_fseek_file_Timer); - return ; - } /* end if */ -tEnd(&gADFI_fseek_file_Timer); -} /* end of ADFI_fseek_file */ -/* end of file ADFI_fseek_file.c */ -/* file ADFI_get_current_date.c */ -/*********************************************************************** -ADFI get current date: - Returns the current date and time in a blank-filled character array. - -output: char date[] Current date/time in an array blank-filled - to DATE_TIME_SIZE. Array must be allocated - to at least DATE_TIME_SIZE. No null added. - -***********************************************************************/ -void ADFI_get_current_date( - char date[] ) -{ -time_t ct ; -int i_len ; -char *current_time_p ; - - - /** get the current time **/ -ct = time( (time_t *)NULL ) ; -current_time_p = ctime( &ct ) ; - - /** remove '\n' from ctime format **/ -i_len = strcspn ( current_time_p, "\n" ) ; -strcpy( date, current_time_p ) ; -date[i_len] = '\0' ; - - /** blank fill **/ -ADFI_blank_fill_string ( date, DATE_TIME_SIZE ) ; - -} /* end of ADFI_get_current_date */ -/* end of file ADFI_get_current_date.c */ -/* file ADFI_get_direct_children_ids.c */ -/*********************************************************************** -ADFI get direct children ids: - -Get Children ids of a Node. Return the ids of children nodes directly -associated with a parent node (no links are followed). The ids of the -children are NOT guaranteed to be returned in any particular order. -If it is desired to follow potential links for the node ID, then -call ADFI_chase_link() and pass the resultant link ID to this function. -NOTE: link nodes do not have direct children. - - -ADFI_get_direct_children_ids( ID, num_ids, ids, error_return ) -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *node_block_offset Block & offset in file. -output: int *num_ids The number of ids returned. -output: double **ids An allocated array of ids (free this space). -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -MEMORY_ALLOCATION_FAILED -FILE_INDEX_OUT_OF_RANGE -BLOCK_OFFSET_OUT_OF_RANGE -ADF_FILE_NOT_OPENED -ADF_DISK_TAG_ERROR -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_get_direct_children_ids( - const unsigned int file_index, - const struct DISK_POINTER *node_block_offset, - int *num_ids, - double **ids, - int *error_return ) -{ -int i ; -struct DISK_POINTER sub_node_block_offset ; -struct NODE_HEADER node ; -struct SUB_NODE_TABLE_ENTRY sub_node_table_entry ; - -*error_return = NO_ERROR ; - -tStart(&gADFI_get_direct_children_ids_Timer); -if( num_ids == NULL || ids == NULL ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_get_direct_children_ids_Timer); - return ; - } /* end if */ - -*num_ids = 0 ; -*ids = NULL ; - -ADFI_read_node_header( file_index, node_block_offset, &node, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_get_direct_children_ids_Timer); - return ; - } - - /** Check for zero children, return if 0 **/ -if( node.num_sub_nodes == 0 ) { - tEnd(&gADFI_get_direct_children_ids_Timer); - return ; - } /* end if */ - -*ids = (double *) malloc ( node.num_sub_nodes * sizeof(double) ) ; -if( *ids == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - tEnd(&gADFI_get_direct_children_ids_Timer); - return ; - } /* end if */ - - /** point to the first child **/ -sub_node_block_offset.block = node.sub_node_table.block ; -sub_node_block_offset.offset = node.sub_node_table.offset + - (TAG_SIZE + DISK_POINTER_SIZE ) ; - - /** Return the ids for all the children **/ -*num_ids = node.num_sub_nodes ; -for( i=0; i< *num_ids; i++ ) { - ADFI_adjust_disk_pointer( &sub_node_block_offset, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_get_direct_children_ids_Timer); - return ; - } - - /** Read one sub-node table entry **/ - ADFI_read_sub_node_table_entry( file_index, &sub_node_block_offset, - &sub_node_table_entry, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_get_direct_children_ids_Timer); - return ; - } - - /** Get the ID from the sub-node table **/ - ADFI_file_block_offset_2_ID( file_index, - sub_node_table_entry.child_location.block, - sub_node_table_entry.child_location.offset, &(*ids)[i], - error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_get_direct_children_ids_Timer); - return ; - } - - /** Increment the disk-pointer **/ - sub_node_block_offset.offset += (ADF_NAME_LENGTH + DISK_POINTER_SIZE) ; - } /* end for */ -tEnd(&gADFI_get_direct_children_ids_Timer); -} -/* end of file ADFI_get_direct_children_ids.c */ -/* file ADFI_get_file_index_from_name.c */ -/*********************************************************************** -ADFI get file index from name: - -Searches file list for given name. Returns file index and Root ID -if name is found in list. - -input: const char *file_name Name of file -output: int *found 1 = name found, 0 = not found -output: unsigned int *file_index File-index -output: double *ID ID of files root node -output: int *error_return Error return -***********************************************************************/ -void ADFI_get_file_index_from_name( - const char *file_name, - int *found, - unsigned int *file_index, - double *ID, - int *error_return ) -{ -double root_ID ; -int i ; - - -*error_return = NO_ERROR ; -*found = 0; - -if( (file_index == NULL) || (ID == NULL) || (found == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_name == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -for( i=0; i 12) ) { - *error_return = BAD_NUMBER_OF_DIMENSIONS ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -offset = 0 ; -accumlated_size = 1 ; -for( i=0; (unsigned)i>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -Machine Numeric Formats: -***IEEE_LITTLE ( The backwards Big Endian ) -I4: Byte0 Byte1 Byte2 Byte3 - LSB---------------------MSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: 23-bit mantissa, 8-bit exponent, sign-bit - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: 52-bit mantissa, 11-bit exponent, sign-bit - -Note: To convert between these two formats the order of the bytes is reversed -since by definition the Big endian starts at the LSB and goes to the MSB where -the little goes form the MSB to the LSB of the word. -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_little_endian_32_swap_64( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -if ( delta_to_bytes == delta_from_bytes ) { - memcpy( to_data, from_data, delta_from_bytes ) ; - } /* end if */ -else if ( delta_from_bytes < delta_to_bytes ) { - switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - case EVAL_2_BYTES( 'I', '8' ): - if( (from_data[3] & 0x80) == 0x80 ) { /* Negative number */ - to_data[7] = 0xff ; - to_data[6] = 0xff ; - to_data[5] = 0xff ; - to_data[4] = 0xff ; - } /* end if */ - else { - to_data[7] = 0x00 ; - to_data[6] = 0x00 ; - to_data[5] = 0x00 ; - to_data[4] = 0x00 ; - } /* end else */ - to_data[3] = from_data[3] ; - to_data[2] = from_data[2] ; - to_data[1] = from_data[1] ; - to_data[0] = from_data[0] ; - break ; - default: - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ - } /* end else if */ -else { - switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - case EVAL_2_BYTES( 'I', '8' ): - to_data[3] = from_data[3] ; - to_data[2] = from_data[2] ; - to_data[1] = from_data[1] ; - to_data[0] = from_data[0] ; - break ; - default: - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ - } /* end else */ - -} /* end of ADFI_little_endian_32_swap_64 */ -/* end of file ADFI_little_endian_32_swap_64.c */ -/* file ADFI_little_endian_to_cray.c */ -/*********************************************************************** -ADFI little endian to cray: - -input: const char from_format Format to convert from. 'B','L','C','N' -input: const char from_os_size Format to convert from. 'B','L' -input: const char to_format Format to convert to. -input: const char to_os_size Format to convert to. 'B','L' -input: const char data_type[2] The type of data to convert. - MT I4 I8 U4 U8 R4 R8 X4 X8 C1 B1 -input: const unsigned long delta_from_bytes Number of from_bytes used. -input: const unsigned long delta_to_bytes Number of to_bytes used. -input: const char *from_data The data to convert from. -output: char *to_data The resulting data. -output: int *error_return Error return. - - Recognized data types: - Machine representations - Type Notation IEEE_BIG IEEE_LITTLE Cray - 32 64 32 64 - No data MT - Integer 32 I4 I4 I4 I4 I4 I8 - Integer 64 I8 -- I8 -- I8 I8 - Unsigned 32 U4 I4 I4 I4 I4 I8 - Unsigned 64 U8 -- I8 -- I8 I8 - Real 32 R4 R4 R4 R4 R4 R8 - Real 64 R8 R8 R8 R8 R8 R8 - Complex 64 X4 R4R4 R4R4 R4R4 R4R4 R8R8 - Complex 128 X8 R8R8 R8R8 R8R8 R8R8 R8R8 - Character (unsigned byte) C1 C1 C1 C1 C1 C1 - Byte (unsigned byte) B1 C1 C1 C1 C1 C1 - -Machine Numeric Formats: -***IEEE_BIG (SGI-Iris Assembly Language Programmer's Guide, pages 1-2, 6-3) -I4: Byte0 Byte1 Byte2 Byte3 - MSB---------------------LSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: sign-bit, 8-bit exponent, 23-bit mantissa - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -***Cray (Cray CFT77 Reference Manual, pages G-1 G-2) -I8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - MSB-----------------------------------------------------LSB -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, exponent-sign, 14-bit exponent, 48-bit mantissa -Note: Exponent sign: 1 in this bits indicates a positive exponent sign, - thus bit 62 is the inverse of bit 61 (the sign in the exponent). - The exception to this is a zero, in which all 64 bits are zero! - The interpreation of the floating-point number is: - >>> .mantissia(fraction) X 2^exponent. <<< - The mantissia is left justified (the leftmost bit is a 1). - This MUST be done! - -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_little_endian_to_cray( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ -int i, exp ; - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - - case EVAL_2_BYTES( 'M', 'T' ): - *error_return = NO_DATA ; - return ; - - case EVAL_2_BYTES( 'C', '1' ): - case EVAL_2_BYTES( 'B', '1' ): - to_data[0] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'I', '4' ): - if( (from_data[3] & 0x80) == 0x80 ) { /* Negative number */ - to_data[0] = 0xff ; - to_data[1] = 0xff ; - to_data[2] = 0xff ; - to_data[3] = 0xff ; - } /* end if */ - else { - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - } /* end else */ - to_data[4] = from_data[3] ; - to_data[5] = from_data[2] ; - to_data[6] = from_data[1] ; - to_data[7] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'U', '4' ): - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - to_data[4] = from_data[3] ; - to_data[5] = from_data[2] ; - to_data[6] = from_data[1] ; - to_data[7] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'I', '8' ): - if( (from_data[3] & 0x80) == 0x80 ) { /* Negative number */ - to_data[0] = 0xff ; - to_data[1] = 0xff ; - to_data[2] = 0xff ; - to_data[3] = 0xff ; - } /* end if */ - else { - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - } /* end else */ - for( i=0; i<(int)delta_from_bytes; i++ ) - to_data[8-delta_from_bytes+i] = from_data[delta_from_bytes-1-i] ; - break ; - - case EVAL_2_BYTES( 'U', '8' ): - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - for( i=0; i<(int)delta_from_bytes; i++ ) - to_data[8-delta_from_bytes+i] = from_data[delta_from_bytes-1-i] ; - break ; - - case EVAL_2_BYTES( 'R', '4' ): - for( i=0; i<8; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[3] == 0x00) && (from_data[2] == 0x00) && - (from_data[1] == 0x00) && (from_data[0] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[0] = from_data[3] & 0x80 ; - - /** Convert the exponent **/ - /** 8 bits to 14 bits. Sign extent from 8 to 14 **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = (from_data[3] & 0x3f) << 1 ; - if( (from_data[2] & 0x80) == 0x80 ) - exp += 1 ; - if( (from_data[3] & 0x40) == 0x00 ) /* set sign */ - exp -= 128 ; - exp += 2 ; - - to_data[1] = exp & 0xff ; - if( exp < 0 ) - to_data[0] |= 0x3f ; /* exponent sign 0, sign extend exponent */ - else - to_data[0] |= 0x40 ; /* exponent sign 1 */ - - /** Convert the mantissia **/ - /** 23 bits to 48 bits. Left shift 25 bits, zero fill **/ - to_data[2] = from_data[2] | 0x80 ; - to_data[3] = from_data[1] ; - to_data[4] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'R', '8' ): - for( i=0; i<8; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[7] == 0x00) && (from_data[6] == 0x00) && - (from_data[5] == 0x00) && (from_data[4] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[0] = from_data[7] & 0x80 ; - - /** Convert the exponent **/ - /** 11 bits to 14 bits. Sign extent from 11 to 14 **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = ((from_data[7] & 0x3f) << 4) + ((from_data[6]>>4)&0x0f) ; - - if( (from_data[7] & 0x40) == 0x00 ) /* set sign */ - exp -= 1024 ; - exp += 2 ; - - to_data[1] = (unsigned int)(exp & 0xff) ; - to_data[0] |= ((exp>>8) & 0x03) ; - if( exp < 0 ) - to_data[0] |= 0x3c ; /* exponent sign 0, sign extend exponent */ - else - to_data[0] |= 0x40 ; /* exponent sign 1 */ - - /** Convert the mantissia **/ - /** 52 bits to 48 bits. Use 48, drop last 4 bits **/ - to_data[2] = 0x80 | ((from_data[6]<<3)&0x78) | - ((from_data[5]>>5)&0x07) ; - for( i=3; i<8; i++ ) - to_data[i] = ((from_data[7-i+1]<<3)&0xF8) | - ((from_data[7-i]>>5)&0x07) ; -#ifdef PRINT_STUFF -printf("from:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", from_data[i] ) ; -printf("to:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", to_data[i] ) ; -printf("\n" ) ; -#endif - break ; - - case EVAL_2_BYTES( 'X', '4' ): - ADFI_little_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_little_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, &from_data[4], &to_data[8], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - case EVAL_2_BYTES( 'X', '8' ): - ADFI_little_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_little_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, &from_data[8], &to_data[8], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - default: - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ -} /* end of ADFI_little_endian_to_cray */ -/* end of file ADFI_little_endian_to_cray.c */ -/* file ADFI_open_file.c */ -/*********************************************************************** -ADFI open file: - - Track the files used by index. - Also track which files are within a given system so a close for - the system can close all related files. - -input: const char *file The filename to open. -input: const char *status The status in which to open the file. - Allowable values are: - READ_ONLY - File must exist. Writing NOT allowed. - OLD - File must exist. Reading and writing allowed. - NEW - File must not exist. - SCRATCH - New file. Filename is ignored. - UNKNOWN - OLD if file exists, else NEW is used. -input: const int top_file_index -1 if this is the top file. -output: unsigned int *file_index Returned index of the file. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -TOO_MANY_ADF_FILES_OPENED -ADF_FILE_STATUS_NOT_RECOGNIZED -FILE_OPEN_ERROR -***********************************************************************/ -void ADFI_open_file( - const char *file, - const char *status, - const int top_file_index, - unsigned int *file_index, - int *error_return ) -{ -int index ; -FILE *f_ret ; -static int createdTimers = 0; - -if (!createdTimers) -{ - tCreateAll(); - createdTimers = 1; -} -tStart(&gADFI_open_file_Timer); -if( (status == NULL) || - ((file == NULL) && (ADFI_stridx_c( status, "SCRATCH" ) != 0) ) ) { - *error_return = NULL_STRING_POINTER ; - tEnd(&gADFI_open_file_Timer); - return ; - } /* end if */ - -if( file_index == NULL ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_open_file_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -/* Initialize the priority satck if it has not been done */ -if (STACK_INIT==-1) ADFI_stack_control(0,0,0,INIT_STK,0,0,NULL); - -for( index=0; index= MAXIMUM_FILES ) { - *error_return = TOO_MANY_ADF_FILES_OPENED ; - tEnd(&gADFI_open_file_Timer); - return ; - } /* end if */ - -ADF_file_format[index] = UNDEFINED_FORMAT ; -ADF_file_os_size[index] = UNDEFINED_FORMAT ; - -/*** - READ_ONLY - File must exist. Writing NOT allowed. - OLD - File must exist. Reading and writing allowed. - NEW - File must not exist. - SCRATCH - New file. Filename is ignored. - UNKNOWN - OLD if file exists, else NEW is used. -***/ -#if defined(_WIN32) && !defined(__WIN32_BINARY__) - _fmode = O_BINARY ; -#endif -if( ADFI_stridx_c( status, "READ_ONLY" ) == 0 ) { -#if defined(_WIN32) && defined(__WIN32_BINARY__) - f_ret = fopen( file, "rb" ) ; /** Open for reading **/ -#else - f_ret = fopen( file, "r" ) ; /** Open for reading **/ -#endif - } /* end if */ -else if( ADFI_stridx_c( status, "OLD" ) == 0 ) { -#if defined(_WIN32) && defined(__WIN32_BINARY__) - f_ret = fopen( file, "rb+" ) ; /** Open for both reading & writing **/ -#else - f_ret = fopen( file, "r+" ) ; /** Open for both reading & writing **/ -#endif - } /* end else if */ -else if( ADFI_stridx_c( status, "NEW" ) == 0 ) { -#if defined(_WIN32) && defined(__WIN32_BINARY__) - f_ret = fopen( file, "wb+" ) ; /** open new file, or truncate old file */ -#else - f_ret = fopen( file, "w+" ) ; /** open new file, or truncate old file */ -#endif - } /* end else if */ -else if( ADFI_stridx_c( status, "SCRATCH" ) == 0 ) { - f_ret = tmpfile(); - } /* end else if */ -else if( ADFI_stridx_c( status, "UNKNOWN" ) == 0 ) { -#if defined(_WIN32) && defined(__WIN32_BINARY__) - f_ret = fopen( file, "ab+" ) ; /** open new, or use existing file **/ -#else - f_ret = fopen( file, "a+" ) ; /** open new, or use existing file **/ -#endif - } /* end else if */ -else { - *error_return = ADF_FILE_STATUS_NOT_RECOGNIZED ; - goto Error_Exit ; - } /* end else */ - -if( f_ret == NULL ) { - *error_return = FILE_OPEN_ERROR ; - goto Error_Exit ; - } /* end if */ - -file_in_use[ index ] = 1 ; -first_file_in_system[ index ] = top_file_index ; -ADF_file[ index ] = f_ret ; -file_version_update[ index ][ 0 ] = '\0' ; -*file_index = index ; -sprintf( file_open_mode[index], "%s", status ) ; -if( ADFI_stridx_c( status, "SCRATCH" ) == 0 ) { - names_of_files[index][0] = '\0' ; - } /* end if */ -else { - sprintf( names_of_files[index], "%s", file ) ; - } /* end else */ - -/* Initialize the file header cache (in case we write anything) */ -int this_fd = fileno(f_ret); -int i; -for (i = 0; i < MAXIMUM_FILES; ++i) { - if ( file_header_cache[index] && file_header_cache[index]->fd == this_fd ) - break; -} -if (i >= MAXIMUM_FILES) { /* Didn't find anything; need a new cache */ - file_header_cache[index] = (struct FILE_HEADER_CACHE *)malloc(sizeof(struct FILE_HEADER_CACHE)); - file_header_cache[index]->fd = this_fd; - file_header_cache[index]->initialized = 0; -} -else { - file_header_cache[ index ] = file_header_cache[ i ]; -} - -/* Initialize the node header cache (in case we write anything) */ -//ADFI_disk_pointer_from_ASCII_Hex("00000000", "00000000", -// &cached_node_header_location[ index ], -// error_return); - -tEnd(&gADFI_open_file_Timer); -return ; - -Error_Exit: - /** Clear this file's entry **/ -if( ADF_file[ index ] != 0 ) { - if( fclose( ADF_file[ index ] ) != 0 ) - *error_return = FILE_CLOSE_ERROR ; - } /* end if */ -file_in_use[ index ] = 0 ; -first_file_in_system[ index ] = -1 ; -ADF_file[ index ] = NULL ; -file_version_update[ index ][ 0 ] = '\0' ; -tEnd(&gADFI_open_file_Timer); - -} /* end of ADFI_open_file */ -/* end of file ADFI_open_file.c */ -/* file ADFI_read_chunk_length.c */ -/*********************************************************************** -ADFI read chunk length: - Read the header of the chunk. If it is a variable sized - chunk, then the first 2 things in is are: - Tag, and pointer to end_of_chunk-tag - If NOT variable, then determine what type of chunk it is - and return a pointer to the end_of_chunk-tag: - - If the incomming pointers are 0 0, then we are looking - at the file header. - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -output: char tag[TAG_SIZE] The tag from the chunk. -output: struct DISK_POINTER *end_of_chunk_tag End of chunk. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ - -void ADFI_read_chunk_length( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - char tag[TAG_SIZE+1], - struct DISK_POINTER *end_of_chunk_tag, - int *error_return ) -{ -char info[ TAG_SIZE + DISK_POINTER_SIZE ] ; -struct DISK_POINTER current_block_offset ; -unsigned long count ; - -tStart(&gADFI_read_chunk_length_Timer); -if( (block_offset == NULL) || (end_of_chunk_tag == NULL) ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_read_chunk_length_Timer); - return ; - } /* end if */ - -if( tag == NULL ) { - *error_return = NULL_STRING_POINTER ; - tEnd(&gADFI_read_chunk_length_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_read_chunk_length_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -end_of_chunk_tag->block = 0 ; -end_of_chunk_tag->offset = 0 ; - - /** File Header **/ -if( (block_offset->block == 0) && (block_offset->offset == 0) ) { - - /** point to end-tag **/ - end_of_chunk_tag->offset = FILE_HEADER_SIZE - TAG_SIZE ; - tag[0] = file_header_tags[0][0] ; - tag[1] = file_header_tags[0][1] ; - tag[2] = file_header_tags[0][2] ; - tag[3] = file_header_tags[0][3] ; - } /* end if */ - - /** Free-Chunk Table **/ -else if( (block_offset->block == 0) && - (block_offset->offset == FREE_CHUNKS_OFFSET) ) { - - /** point to end-tag **/ - end_of_chunk_tag->offset = - (FREE_CHUNKS_OFFSET + FREE_CHUNK_TABLE_SIZE) - TAG_SIZE ; - tag[0] = free_chunk_table_start_tag[0] ; - tag[1] = free_chunk_table_start_tag[1] ; - tag[2] = free_chunk_table_start_tag[2] ; - tag[3] = free_chunk_table_start_tag[3] ; - } /* end if */ -else { - - /** Check for 'z's in the file. This is free-data, too small - to include tags and pointers - **/ - count = 0 ; - ADFI_read_file( file_index, block_offset->block, block_offset->offset, - 1, info, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_chunk_length_Timer); - return ; - } - if( info[0] == 'z' ) { - current_block_offset.block = block_offset->block ; - current_block_offset.offset = block_offset->offset ; - while( info[0] == 'z' ) { - count++ ; - current_block_offset.offset++ ; - ADFI_adjust_disk_pointer( ¤t_block_offset, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_chunk_length_Timer); - return ; - } - - info[0] = '\0' ; - ADFI_read_file( file_index, current_block_offset.block, - current_block_offset.offset, 1, info, error_return ) ; - if( (*error_return == FSEEK_ERROR) || (*error_return == FREAD_ERROR)){ - break ; - } /* end if */ - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_chunk_length_Timer); - return ; - } - } /* end while */ - end_of_chunk_tag->block = block_offset->block ; - end_of_chunk_tag->offset = block_offset->offset + count - TAG_SIZE ; - ADFI_adjust_disk_pointer( end_of_chunk_tag, error_return ) ; - tag[0] = tag[1] = tag[2] = tag[3] = 'z' ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_chunk_length_Timer); - return ; - } - } /* end if */ - else { - /** Read TAG and disk_pointer **/ - ADFI_read_file( file_index, block_offset->block, block_offset->offset, - TAG_SIZE + DISK_POINTER_SIZE, info, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_chunk_length_Timer); - return ; - } - - /* Copy the tag **/ - tag[0] = info[0] ; - tag[1] = info[1] ; - tag[2] = info[2] ; - tag[3] = info[3] ; - tag[4] = '\0' ; - - /** Check for known tags **/ - if( ADFI_stridx_c( tag, node_start_tag ) == 0 ) { /** Node **/ - end_of_chunk_tag->block = block_offset->block ; - end_of_chunk_tag->offset = block_offset->offset + - NODE_HEADER_SIZE - TAG_SIZE ; - ADFI_adjust_disk_pointer( end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_chunk_length_Timer); - return ; - } - } /* end if */ - else { - - /** Convert pointers into numeric form **/ - ADFI_disk_pointer_from_ASCII_Hex( &info[TAG_SIZE], - &info[DISK_POINTER_SIZE], end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_chunk_length_Timer); - return ; - } - } /* end else */ - } /* end else */ - } /* end else */ - -tEnd(&gADFI_read_chunk_length_Timer); -} /* end of ADFI_read_chunk_length */ -/* end of file ADFI_read_chunk_length.c */ -/* file ADFI_read_data_chunk.c */ -/*********************************************************************** -ADFI read data chunk: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const char *data_type The defined datatype. -input: const int data_size Size of data entity in bytes. -input: const long chunk_bytes Number of bytes in data chunk. -input: const long start_offset Starting offset into the data chunk -input: const long total_bytes Number of bytes to read in data chunk. -output: char *data Pointer to the resulting data. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_DISK_TAG_ERROR -REQUESTED_DATA_TOO_LONG -***********************************************************************/ -void ADFI_read_data_chunk( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct TOKENIZED_DATA_TYPE *tokenized_data_type, - const int data_size, - const long chunk_bytes, - const long start_offset, - const long total_bytes, - char *data, - int *error_return ) -{ -int format_compare ; -char tag[TAG_SIZE + 1] ; -struct DISK_POINTER data_start, end_of_chunk_tag ; -long chunk_total_bytes ; - -tStart(&gADFI_read_data_chunk_Timer); -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_read_data_chunk_Timer); - return ; - } /* end if */ - -if( (tokenized_data_type == NULL) || (data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - tEnd(&gADFI_read_data_chunk_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_read_data_chunk_Timer); - return ; - } /* end if */ - -if( total_bytes+start_offset > chunk_bytes ) { - *error_return = REQUESTED_DATA_TOO_LONG ; - tEnd(&gADFI_read_data_chunk_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Get tag and chunk length **/ -ADFI_read_chunk_length( file_index, block_offset, tag, &end_of_chunk_tag, - error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_data_chunk_Timer); - return ; - } -tag[TAG_SIZE] = '\0' ; - - /** Check start-of-chunk tag **/ -if( ADFI_stridx_c( tag, data_chunk_start_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - tEnd(&gADFI_read_data_chunk_Timer); - return ; - } /* end if */ - - /** Check end-of-chunk tag **/ -ADFI_read_file( file_index, end_of_chunk_tag.block, end_of_chunk_tag.offset, - TAG_SIZE, tag, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_data_chunk_Timer); - return ; - } -tag[TAG_SIZE] = '\0' ; - -if( ADFI_stridx_c( tag, data_chunk_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - tEnd(&gADFI_read_data_chunk_Timer); - return ; - } /* end if */ - - /** Point to the start of the data **/ -data_start.block = block_offset->block ; -data_start.offset = block_offset->offset + start_offset + - DISK_POINTER_SIZE + TAG_SIZE ; -ADFI_adjust_disk_pointer( &data_start, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_data_chunk_Timer); - return ; - } - - /** calculate the total number of data bytes **/ -chunk_total_bytes = end_of_chunk_tag.offset - data_start.offset + start_offset - + (end_of_chunk_tag.block - data_start.block) * DISK_BLOCK_SIZE ; -if( chunk_bytes > chunk_total_bytes ) { - *error_return = REQUESTED_DATA_TOO_LONG ; - tEnd(&gADFI_read_data_chunk_Timer); - return ; - } /* end if */ -else { - if( chunk_bytes < chunk_total_bytes ) - *error_return = REQUESTED_DATA_TOO_LONG ; - - /** check for need of data translation **/ - ADFI_file_and_machine_compare( file_index, tokenized_data_type, - &format_compare, error_return ); - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_data_chunk_Timer); - return ; - } - if( format_compare == 1 ) { - /** Read the data off of disk **/ - ADFI_read_file( file_index, data_start.block, data_start.offset, - total_bytes, data, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_data_chunk_Timer); - return ; - } - } /* end if */ - else { - ADFI_read_data_translated( file_index, data_start.block, - data_start.offset, tokenized_data_type, data_size, - total_bytes, data, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_data_chunk_Timer); - return ; - } - } /* end else */ - } /* end else */ - -tEnd(&gADFI_read_data_chunk_Timer); -} /* end of ADFI_read_data_chunk */ -/* end of file ADFI_read_data_chunk.c */ -/* file ADFI_read_data_chunk_table.c */ -/*********************************************************************** -ADFI read data chunk table: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -output: struct DATA_CHUNK_TABLE_ENTRY data_chunk_table[] Array of DC entries. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_read_data_chunk_table( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct DATA_CHUNK_TABLE_ENTRY data_chunk_table[], - int *error_return ) -{ -char tag[ TAG_SIZE + 1 ] ; -struct DISK_POINTER end_of_chunk_tag, tmp_block_offset ; -unsigned int i, number_of_bytes_to_read ; - -tStart(&gADFI_read_data_chunk_table_Timer); -if( (block_offset == NULL) || (data_chunk_table == NULL) ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_read_data_chunk_table_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_read_data_chunk_table_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - /** Get the tag and the length **/ -ADFI_read_chunk_length( file_index, block_offset, tag, - &end_of_chunk_tag, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_data_chunk_table_Timer); - return ; - } -tag[TAG_SIZE] = '\0' ; - - /** Compare the start tag **/ -if( ADFI_stridx_c( tag, data_chunk_table_start_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - tEnd(&gADFI_read_data_chunk_table_Timer); - return ; - } /* end if */ - -number_of_bytes_to_read = - (end_of_chunk_tag.block - block_offset->block) * DISK_BLOCK_SIZE + - (end_of_chunk_tag.offset - block_offset->offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - - /** Read the data from disk **/ -tmp_block_offset.block = block_offset->block ; -tmp_block_offset.offset = block_offset->offset + TAG_SIZE ; - -for( i=0; i number_of_data_elements ) { - chunk_size -= ( number_of_elements_read - number_of_data_elements ) ; - delta_from_bytes = chunk_size * data_size ; - delta_to_bytes = chunk_size * machine_size ; - } - ADFI_read_file( file_index, disk_pointer.block, disk_pointer.offset, - delta_from_bytes, (char *)from_data, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_data_translated_Timer); - return ; - } - ADFI_convert_number_format( - ADF_file_format[file_index], /* from format */ - ADF_file_os_size[file_index], /* from os size */ - ADF_this_machine_format, /* to format */ - ADF_this_machine_os_size, /* to os size */ - FROM_FILE_FORMAT, - tokenized_data_type, chunk_size, from_data, - to_data, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_data_translated_Timer); - return ; - } - to_data += delta_to_bytes ; - disk_pointer.offset += delta_from_bytes ; - if ( disk_pointer.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &disk_pointer, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_data_translated_Timer); - return ; - } - } /* end if */ - } /* end while */ - -tEnd(&gADFI_read_data_translated_Timer); -} /* end of ADFI_read_data_translated */ -/* end of file ADFI_read_data_translated.c */ -/* file ADFI_read_disk_block.c */ -/*********************************************************************** -ADFI read disk block: - - Possible errors: -NO_ERROR -***********************************************************************/ -void ADFI_read_disk_block() -{ -fprintf(stderr,"Subroutine ADFI_read_disk_block is not yet implemented...\n" ) ; -} /* end of ADFI_read_disk_block */ -/* end of file ADFI_read_disk_block.c */ -/* file ADFI_read_disk_pointer_from_disk.c */ -/*********************************************************************** -ADFI read disk pointer from disk: - Given a pointer to a disk pointer, read it from disk and convert - it into numeric form. - -input: const unsigned int file_index File to read from. -input: const unsigned long file_block Block within the file. -input: const unsigned long block_offset Offset within the block. -output: struct DISK_POINTER *block_and_offset Resulting disk pointer. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_read_disk_pointer_from_disk( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - struct DISK_POINTER *block_and_offset, - int *error_return ) -{ -char disk_block_offset[DISK_POINTER_SIZE] ; - -tStart(&gADFI_read_disk_pointer_from_disk_Timer); -if( block_and_offset == NULL ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_read_disk_pointer_from_disk_Timer); - return ; - } /* end if */ - -if( block_offset > DISK_BLOCK_SIZE ) { - *error_return = BLOCK_OFFSET_OUT_OF_RANGE ; - tEnd(&gADFI_read_disk_pointer_from_disk_Timer); - return ; - } /* end if */ - - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_read_disk_pointer_from_disk_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check the stack for block/offset **/ -#if 0 -if ( ADFI_stack_control(file_index, file_block, block_offset, - GET_STK, DISK_PTR_STK, - DISK_POINTER_SIZE, disk_block_offset ) != NO_ERROR ) { -#endif - - /** Get the block/offset from disk **/ - ADFI_read_file( file_index, file_block, block_offset, - DISK_POINTER_SIZE, disk_block_offset, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_disk_pointer_from_disk_Timer); - return ; - } - - /** Set the block/offset onto the stack **/ -#if 0 - ADFI_stack_control(file_index, file_block, block_offset, - SET_STK, DISK_PTR_STK, - DISK_POINTER_SIZE, disk_block_offset ); -} /* end if */ -#endif - - /** Convert into numeric form **/ -ADFI_disk_pointer_from_ASCII_Hex( &disk_block_offset[0], &disk_block_offset[8], - block_and_offset, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_disk_pointer_from_disk_Timer); - return ; -} - -tEnd(&gADFI_read_disk_pointer_from_disk_Timer); -} /* end of ADFI_read_disk_pointer_from_disk */ -/* end of file ADFI_read_disk_pointer_from_disk.c */ -/* file ADFI_read_file.c */ -/*********************************************************************** -ADFI read file: - Read a number of bytes from an open ADF file from a given - file, block, and offset. Buffering is done in an attempt to - improve performance of repeatedly reading small pieces of - contiguous data. Note: read buffering also affects the - write function, i.e, all writes must reset the read buffer. - -input: const unsigned int file_index File to read from. -input: const unsigned long file_block Block within the file. -input: const unsigned long block_offset Offset within the block. -input: const unsigned int data_length Length of the data to read. -input: char *data Address of the data. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -FREAD_ERROR -***********************************************************************/ -void ADFI_read_file( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - const unsigned int data_length, - char *data, - int *error_return ) -{ -int iret ; - -tStart(&gADFI_read_file_Timer); -if( data == NULL ) { - *error_return = NULL_STRING_POINTER ; - tEnd(&gADFI_read_file_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_read_file_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** No need to buffer large pieces of data or to take special - measures to cross block boundaries **/ - -if( data_length + block_offset > DISK_BLOCK_SIZE ) { - - /** Position the file **/ - ADFI_fseek_file( file_index, file_block, block_offset, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_file_Timer); - return ; - } /* end if */ - - /** Read the data from disk **/ - iret = fread( data, 1, data_length, ADF_file[ file_index ] ) ; - if( iret != (int)data_length ) { - *error_return = FREAD_ERROR ; - tEnd(&gADFI_read_file_Timer); - return ; - } /* end if */ - - tEnd(&gADFI_read_file_Timer); - return; -} /* end if */ - - /** For smaller pieces of data, read a block at a time. This will improve - performance if neighboring data is requested a small piece at a time - (strided reads, file overhead). - - Some assumptions apply to the block size. With some experimenting, - 1K blocks do not offer much improvement. 4K blocks (4096 bytes) - do improve performance remarkably. This is due to the fact that the - file structure is based of 4K blocks with offsets. - **/ - -if( num_in_rd_block < DISK_BLOCK_SIZE || /*- buffer is not full -*/ - (long int) file_block != last_rd_block || /*- a different block -*/ - (long int) file_index != last_rd_file ) { /*- entirely different file -*/ - - /** buffer is not current, re-read **/ - - if ( (long int) file_block == last_wr_block && (long int) file_index == last_wr_file ) { - - /* Copy data from write buffer */ - memcpy( rd_block_buffer, wr_block_buffer, DISK_BLOCK_SIZE ); - iret = DISK_BLOCK_SIZE; - } - else { - - if ( !DC_get_block( file_index, file_block, rd_block_buffer ) ) { - - /** Position the file **/ - ADFI_fseek_file( file_index, file_block, 0, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_file_Timer); - return ; - } /* end if */ - - /** Read the data from disk **/ - iret = fread( rd_block_buffer, 1, DISK_BLOCK_SIZE, ADF_file[ file_index ] ) ; - if( iret == EOF || iret == 0 ) { - *error_return = FREAD_ERROR ; - tEnd(&gADFI_read_file_Timer); - return ; - } /* end if */ - DC_add_block(file_index, file_block, 0, rd_block_buffer, error_return); - } - - } /* end if */ - - /** Remember buffer information **/ - last_rd_block = file_block ; - last_rd_file = file_index ; - num_in_rd_block = iret ; - -} /* end if */ - - /*read from buffer*/ -memcpy( data, &rd_block_buffer[block_offset], data_length ); - -tEnd(&gADFI_read_file_Timer); -} /* end of ADFI_read_file */ -/* end of file ADFI_read_file.c */ -/* file ADFI_read_file_header.c */ -/*********************************************************************** -ADFI read file header: - -input: const unsigned int file_index The file index. -output: struct FILE_HEADER *file_header Pointer to a file-header struct. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_read_file_header( - const unsigned int file_index, - struct FILE_HEADER *file_header, - int *error_return ) -{ -char disk_header[ FILE_HEADER_SIZE ] ; - -tStart(&gADFI_read_file_header_Timer); -if( file_header == NULL ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_read_file_header_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_read_file_header_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -if ( file_header_cache[ file_index ] && - file_header_cache[ file_index ]->initialized ) { - *file_header = file_header_cache[ file_index ]->header; - return; - } - /** Check the stack for header **/ -if ( ADFI_stack_control(file_index, 0, 0, GET_STK, FILE_STK, - FILE_HEADER_SIZE, disk_header ) != NO_ERROR ) { - - /** Read in the header into memory **/ - ADFI_read_file( file_index, 0, 0, FILE_HEADER_SIZE, disk_header, - error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_file_header_Timer); - return ; - } - - /** Check memory tags for proper data **/ - if( strncmp( &disk_header[32], file_header_tags[0], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_read_file_header_Timer); - return ; - } /* end if */ - - if( strncmp( &disk_header[64], file_header_tags[1], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_read_file_header_Timer); - return ; - } /* end if */ - - if( strncmp( &disk_header[96], file_header_tags[2], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_read_file_header_Timer); - return ; - } /* end if */ - - if( strncmp( &disk_header[102], file_header_tags[3], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_read_file_header_Timer); - return ; - } /* end if */ - - if( strncmp( &disk_header[130], file_header_tags[4], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_read_file_header_Timer); - return ; - } /* end if */ - - if( strncmp( &disk_header[182], file_header_tags[5], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_read_file_header_Timer); - return ; - } /* end if */ - - /** Set the header onto the stack **/ - ADFI_stack_control(file_index, 0, 0, SET_STK, FILE_STK, - FILE_HEADER_SIZE, disk_header ); -} /* end if */ - -/** OK the memory tags look good, let's convert disk-formatted header - into memory **/ -strncpy( (char *)file_header->what, &disk_header[ 0], 32 ) ; -strncpy( (char *)file_header->tag0, &disk_header[ 32], TAG_SIZE ) ; -strncpy( (char *)file_header->creation_date, &disk_header[ 36], DATE_TIME_SIZE); -strncpy( (char *)file_header->tag1, &disk_header[ 64], TAG_SIZE ) ; -strncpy( (char *)file_header->modification_date, &disk_header[ 68], - DATE_TIME_SIZE ) ; -strncpy( (char *)file_header->tag2, &disk_header[ 96], TAG_SIZE ) ; -file_header->numeric_format = disk_header[100] ; -file_header->os_size = disk_header[101] ; -strncpy( (char *)file_header->tag3, &disk_header[102], TAG_SIZE ) ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[106], - &file_header->sizeof_char, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_file_header_Timer); - return ; - } - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[108], - &file_header->sizeof_short, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_file_header_Timer); - return ; - } - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[110], - &file_header->sizeof_int, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_file_header_Timer); - return ; - } - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[112], - &file_header->sizeof_long, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_file_header_Timer); - return ; - } - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[114], - &file_header->sizeof_float, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_file_header_Timer); - return ; - } - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[116], - &file_header->sizeof_double, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_file_header_Timer); - return ; - } - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[118], - &file_header->sizeof_char_p, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_file_header_Timer); - return ; - } - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[120], - &file_header->sizeof_short_p, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_file_header_Timer); - return ; - } - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[122], - &file_header->sizeof_int_p, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_file_header_Timer); - return ; - } - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[124], - &file_header->sizeof_long_p, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_file_header_Timer); - return ; - } - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[126], - &file_header->sizeof_float_p, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_file_header_Timer); - return ; - } - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[128], - &file_header->sizeof_double_p, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_file_header_Timer); - return ; - } - -strncpy( file_header->tag4, &disk_header[130], TAG_SIZE ) ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_header[134], &disk_header[142], - &file_header->root_node, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_file_header_Timer); - return ; - } - -ADFI_disk_pointer_from_ASCII_Hex( &disk_header[146], &disk_header[154], - &file_header->end_of_file, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_file_header_Timer); - return ; - } - -ADFI_disk_pointer_from_ASCII_Hex( &disk_header[158], &disk_header[166], - &file_header->free_chunks, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_file_header_Timer); - return ; - } - -ADFI_disk_pointer_from_ASCII_Hex( &disk_header[170], &disk_header[178], - &file_header->extra, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_file_header_Timer); - return ; - } - -strncpy( file_header->tag5, &disk_header[182], TAG_SIZE ) ; - - - /** Check memory tags for proper data **/ -if( strncmp( file_header->tag0, file_header_tags[0], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_read_file_header_Timer); - return ; - } /* end if */ - -if( strncmp( file_header->tag1, file_header_tags[1], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_read_file_header_Timer); - return ; - } /* end if */ - -if( strncmp( file_header->tag2, file_header_tags[2], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_read_file_header_Timer); - return ; - } /* end if */ - -if( strncmp( file_header->tag3, file_header_tags[3], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_read_file_header_Timer); - return ; - } /* end if */ - -if( strncmp( file_header->tag4, file_header_tags[4], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_read_file_header_Timer); - return ; - } /* end if */ - -if( strncmp( file_header->tag5, file_header_tags[5], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_read_file_header_Timer); - return ; - } /* end if */ - -tEnd(&gADFI_read_file_header_Timer); -} /* end of ADFI_read_file_header */ -/* end of file ADFI_read_file_header.c */ -/* file ADFI_read_free_chunk.c */ -/*********************************************************************** -ADFI read free chunk: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -output: struct DISK_POINTER *end_of_chunk_tag End of free chunk tag. -output: struct DISK_POINTER *next_chunk Next free chunk in list. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_DISK_TAG_ERROR -***********************************************************************/ -void ADFI_read_free_chunk( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct FREE_CHUNK *free_chunk, - int *error_return ) -{ -char tag[TAG_SIZE + 1] ; -struct DISK_POINTER chunk_block_offset ; - -tStart(&gADFI_read_free_chunk_Timer); -if( (block_offset == NULL) || (free_chunk == NULL) ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_read_free_chunk_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_read_free_chunk_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Get the tag and the length **/ -ADFI_read_chunk_length( file_index, block_offset, tag, - &(free_chunk->end_of_chunk_tag), error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_free_chunk_Timer); - return ; - } -tag[TAG_SIZE] = '\0' ; - - /** Compare the start tag **/ -if( ADFI_stridx_c( tag, free_chunk_start_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - tEnd(&gADFI_read_free_chunk_Timer); - return ; - } /* end if */ - - /** Set block offset to the start of the chunk **/ - -chunk_block_offset = *block_offset ; -chunk_block_offset.offset += TAG_SIZE + DISK_POINTER_SIZE ; -ADFI_adjust_disk_pointer( &chunk_block_offset, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_free_chunk_Timer); - return ; - } - - /** Read the data from disk **/ - -ADFI_read_disk_pointer_from_disk( file_index, chunk_block_offset.block, - chunk_block_offset.offset, &(free_chunk->next_chunk), error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_free_chunk_Timer); - return ; - } - -ADFI_read_file( file_index, free_chunk->end_of_chunk_tag.block, - free_chunk->end_of_chunk_tag.offset, TAG_SIZE, tag, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_free_chunk_Timer); - return ; - } - - /** Compare the end tag **/ -if( ADFI_stridx_c( tag, free_chunk_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - tEnd(&gADFI_read_free_chunk_Timer); - return ; - } /* end if */ - -strncpy( free_chunk->start_tag, free_chunk_start_tag, 4 ) ; -strncpy( free_chunk->end_tag, free_chunk_end_tag, 4 ) ; -tEnd(&gADFI_read_free_chunk_Timer); -} /* end of ADFI_read_free_chunk */ -/* end of file ADFI_read_free_chunk.c */ -/* file ADFI_read_free_chunk_table.c */ -/*********************************************************************** -ADFI read free chunk table: - -input: const unsigned int file_index The file index. -output: struct FREE_CHUNK_TABLE *free_chunk_table Pointer to table. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_DISK_TAG_ERROR -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_read_free_chunk_table( - const unsigned int file_index, - struct FREE_CHUNK_TABLE *free_chunk_table, - int *error_return ) -{ -char disk_free_chunk_data[ FREE_CHUNK_TABLE_SIZE ] ; - -tStart(&gADFI_read_free_chunk_table_Timer); -if( free_chunk_table == NULL ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_read_free_chunk_table_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_read_free_chunk_table_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check the stack for free chunk **/ -if ( ADFI_stack_control(file_index, FREE_CHUNKS_BLOCK, FREE_CHUNKS_OFFSET, - GET_STK, FREE_CHUNK_STK, FREE_CHUNK_TABLE_SIZE, - disk_free_chunk_data ) != NO_ERROR ) { - - /** Read the free-chunk table off of disk **/ - ADFI_read_file( file_index, FREE_CHUNKS_BLOCK, FREE_CHUNKS_OFFSET, - FREE_CHUNK_TABLE_SIZE, disk_free_chunk_data, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_free_chunk_table_Timer); - return ; - } - - /** Check disk tags **/ - if( ADFI_stridx_c( &disk_free_chunk_data[0], free_chunk_table_start_tag ) != - 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - tEnd(&gADFI_read_free_chunk_table_Timer); - return ; - } /* end of */ - - if( ADFI_stridx_c( &disk_free_chunk_data[FREE_CHUNK_TABLE_SIZE - TAG_SIZE], - free_chunk_table_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - tEnd(&gADFI_read_free_chunk_table_Timer); - return ; - } /* end of */ - - /** Set the free chunk onto the stack **/ - ADFI_stack_control(file_index, FREE_CHUNKS_BLOCK, FREE_CHUNKS_OFFSET, - SET_STK, FREE_CHUNK_STK, FREE_CHUNK_TABLE_SIZE, - disk_free_chunk_data ); -} /* end if */ - - /** Convert into memory **/ -strncpy( (char *)free_chunk_table->start_tag, &disk_free_chunk_data[ 0], - TAG_SIZE ) ; -strncpy( (char *)free_chunk_table->end_tag, - &disk_free_chunk_data[ FREE_CHUNK_TABLE_SIZE - TAG_SIZE ], TAG_SIZE ) ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_free_chunk_data[ TAG_SIZE], - &disk_free_chunk_data[DISK_POINTER_SIZE], - &free_chunk_table->small_first_block, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_free_chunk_table_Timer); - return ; - } - -ADFI_disk_pointer_from_ASCII_Hex( &disk_free_chunk_data[16], - &disk_free_chunk_data[24], &free_chunk_table->small_last_block, - error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_free_chunk_table_Timer); - return ; - } - -ADFI_disk_pointer_from_ASCII_Hex( &disk_free_chunk_data[28], - &disk_free_chunk_data[36], &free_chunk_table->medium_first_block, - error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_free_chunk_table_Timer); - return ; - } - -ADFI_disk_pointer_from_ASCII_Hex( &disk_free_chunk_data[40], - &disk_free_chunk_data[48], &free_chunk_table->medium_last_block, - error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_free_chunk_table_Timer); - return ; - } - -ADFI_disk_pointer_from_ASCII_Hex( &disk_free_chunk_data[52], - &disk_free_chunk_data[60], &free_chunk_table->large_first_block, - error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_free_chunk_table_Timer); - return ; - } - -ADFI_disk_pointer_from_ASCII_Hex( &disk_free_chunk_data[64], - &disk_free_chunk_data[72], &free_chunk_table->large_last_block, - error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_free_chunk_table_Timer); - return ; - } - - /** Check memory tags **/ -if( ADFI_stridx_c( free_chunk_table->start_tag, free_chunk_table_start_tag ) - != 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_read_free_chunk_table_Timer); - return ; - } /* end of */ - -if( ADFI_stridx_c( free_chunk_table->end_tag, free_chunk_table_end_tag ) - != 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_read_free_chunk_table_Timer); - return ; - } /* end of */ - -tEnd(&gADFI_read_free_chunk_table_Timer); -} /* end of ADFI_read_free_chunk_table */ -/* end of file ADFI_read_free_chunk_table.c */ -/* file ADFI_read_node_header.c */ -/*********************************************************************** -ADFI read node header: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -output: struct NODE_HEADER *node_header Pointer to node header. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_DISK_TAG_ERROR -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_read_node_header( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct NODE_HEADER *node_header, - int *error_return ) -{ -char disk_node_data[ NODE_HEADER_SIZE ] ; -int i ; - -tStart(&gADFI_read_node_header_Timer); -if( (block_offset == NULL) || (node_header == NULL) ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_read_node_header_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_read_node_header_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; -/* -if (cached_node_header_location[file_index].block == block_offset->block && - cached_node_header_location[file_index].offset == block_offset->offset) { - memcpy(disk_node_data, node_header_cache[ file_index ], NODE_HEADER_SIZE); -} - /** Check the stack for header **/ -if ( ADFI_stack_control(file_index, block_offset->block, -// else if ( ADFI_stack_control(file_index, block_offset->block, - block_offset->offset, - GET_STK, NODE_STK, NODE_HEADER_SIZE, - disk_node_data ) != NO_ERROR ) { - - /** Get the node header from disk **/ - ADFI_read_file( file_index, block_offset->block, block_offset->offset, - NODE_HEADER_SIZE, disk_node_data, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_node_header_Timer); - return ; - } - - /** Check disk tags **/ - if( ADFI_stridx_c( &disk_node_data[0], node_start_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - tEnd(&gADFI_read_node_header_Timer); - return ; - } /* end of */ - - if( ADFI_stridx_c( &disk_node_data[ NODE_HEADER_SIZE - TAG_SIZE ], - node_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - tEnd(&gADFI_read_node_header_Timer); - return ; - } /* end if */ - - /** Set the header onto the stack **/ - ADFI_stack_control(file_index, block_offset->block, block_offset->offset, - SET_STK, NODE_STK, NODE_HEADER_SIZE, disk_node_data ); -} /* end if */ - - /** Convert into memory **/ -strncpy( (char *)node_header->node_start_tag, &disk_node_data[ 0], TAG_SIZE ) ; -strncpy( (char *)node_header->node_end_tag, - &disk_node_data[ NODE_HEADER_SIZE - TAG_SIZE], TAG_SIZE ) ; - -strncpy( (char *)node_header->name, &disk_node_data[ TAG_SIZE], - ADF_NAME_LENGTH ) ; -strncpy( (char *)node_header->label, &disk_node_data[ 36], ADF_LABEL_LENGTH ) ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, MAXIMUM_32_BITS, 8, &disk_node_data[ 68], - &node_header->num_sub_nodes, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_node_header_Timer); - return ; - } - -ADFI_ASCII_Hex_2_unsigned_int( 0, MAXIMUM_32_BITS, 8, &disk_node_data[ 76], - &node_header->entries_for_sub_nodes, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_node_header_Timer); - return ; - } - -ADFI_disk_pointer_from_ASCII_Hex( &disk_node_data[84], &disk_node_data[92], - &node_header->sub_node_table, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_node_header_Timer); - return ; - } - -strncpy( (char *)node_header->data_type, &disk_node_data[ 96], - ADF_DATA_TYPE_LENGTH ) ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 12, 2, &disk_node_data[128], - &node_header->number_of_dimensions, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_node_header_Timer); - return ; - } - -for( i=0; idimension_values[i], - error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_node_header_Timer); - return ; - } - } /* end for */ - -ADFI_ASCII_Hex_2_unsigned_int( 0, 65535, 4, &disk_node_data[226], - &node_header->number_of_data_chunks, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_node_header_Timer); - return ; - } - -ADFI_disk_pointer_from_ASCII_Hex( &disk_node_data[230], &disk_node_data[238], - &node_header->data_chunks, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_node_header_Timer); - return ; - } - - /** Check memory tags **/ -if( ADFI_stridx_c( node_header->node_start_tag, node_start_tag ) != 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_read_node_header_Timer); - return ; - } /* end of */ - -if( ADFI_stridx_c( node_header->node_end_tag, node_end_tag ) != 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_read_node_header_Timer); - return ; - } /* end of */ - -tEnd(&gADFI_read_node_header_Timer); -} /* end of ADFI_read_node_header */ -/* end of file ADFI_read_node_header.c */ -/* file ADFI_read_sub_node_table.c */ -/*********************************************************************** -ADFI read sub node table: - - At this point, reading of the ENTIRE table is required. - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -output: struct SUB_NODE_TABLE_ENTRY sub_node_table[] Array of SN entries. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_read_sub_node_table( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct SUB_NODE_TABLE_ENTRY sub_node_table[], - int *error_return ) -{ -char tag[TAG_SIZE + 1] ; -struct DISK_POINTER end_of_chunk_tag, current_child ; -unsigned int number_of_children, i ; - -tStart(&gADFI_read_sub_node_table_Timer); -if( (block_offset == NULL) || (sub_node_table == NULL) ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_read_sub_node_table_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_read_sub_node_table_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Get tag and length **/ -ADFI_read_chunk_length( file_index, block_offset, tag, - &end_of_chunk_tag, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_sub_node_table_Timer); - return ; - } -tag[TAG_SIZE] = '\0' ; - - /** calculate the number of chuldren in the sub-node table **/ -number_of_children = ( - (end_of_chunk_tag.block - block_offset->block) * DISK_BLOCK_SIZE + - (end_of_chunk_tag.offset - block_offset->offset) ) / - (DISK_POINTER_SIZE + ADF_NAME_LENGTH) ; - -current_child.block = block_offset->block ; -current_child.offset = block_offset->offset + TAG_SIZE + DISK_POINTER_SIZE ; -ADFI_adjust_disk_pointer( ¤t_child, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_sub_node_table_Timer); - return ; - } - - /** Read and convert the variable-length table into memory **/ -for( i=0; iblock, block_offset->offset, - GET_STK, SUBNODE_STK, ADF_NAME_LENGTH + DISK_POINTER_SIZE, - sub_node_entry_disk_data ) != NO_ERROR ) { - - /** Read the entry from disk **/ - ADFI_read_file( file_index, block_offset->block, block_offset->offset, - ADF_NAME_LENGTH + DISK_POINTER_SIZE, sub_node_entry_disk_data, - error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_sub_node_table_entry_Timer); - return ; - } - - /** Set the subnode onto the stack **/ - ADFI_stack_control(file_index, block_offset->block, block_offset->offset, - SET_STK, SUBNODE_STK, ADF_NAME_LENGTH + DISK_POINTER_SIZE, - sub_node_entry_disk_data ); -} /* end if */ - - /** Copy the name **/ -strncpy( sub_node_table_entry->child_name, &sub_node_entry_disk_data[0], - ADF_NAME_LENGTH ) ; - - /** Convert the disk-pointer **/ -ADFI_disk_pointer_from_ASCII_Hex( &sub_node_entry_disk_data[ ADF_NAME_LENGTH ], - &sub_node_entry_disk_data[ ADF_NAME_LENGTH + 8 ], - &sub_node_table_entry->child_location, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_read_sub_node_table_entry_Timer); - return ; - } -tEnd(&gADFI_read_sub_node_table_entry_Timer); -} /* end of ADFI_read_sub_node_table_entry */ -/* end of file ADFI_read_sub_node_table_entry.c */ -/* file ADFI_remember_file_format.c */ -/********************************************************************** -ADFI remember file format: - Track the file format used: - -input: const int file_index Index for the file. -input: const char numeric_format Format for the file. -input: const char os_size operating system size for the file. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -FILE_INDEX_OUT_OF_RANGE -**********************************************************************/ -void ADFI_remember_file_format( - const int file_index, - const char numeric_format, - const char os_size, - int *error_return ) -{ -if( (file_index < 0) || (file_index > MAXIMUM_FILES) ) { - *error_return = FILE_INDEX_OUT_OF_RANGE ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; -ADF_file_format[file_index] = numeric_format ; -ADF_file_os_size[file_index] = os_size ; -} -/* end of file ADFI_remember_file_format.c */ -/* file ADFI_remember_version_update.c */ -/*********************************************************************** -ADFI remember version update: - Stores the what-string (which contains the file version number) so - that it can be written after the first successful update. After the - file has been updated once, the remembered what-string is "forgotten". - -input: const int file_index File index to write to. -input: const char *what_string What string to remember (contains version) -output: int *error_return Error return. - - Possible errors: -FILE_INDEX_OUT_OF_RANGE -NULL_STRING_POINTER -STRING_LENGTH_ZERO -***********************************************************************/ -void ADFI_remember_version_update( - const int file_index, - const char *what_string, - int *error_return ) -{ - -*error_return = NO_ERROR ; - -if( (file_index < 0) || (file_index > MAXIMUM_FILES) ) { - *error_return = FILE_INDEX_OUT_OF_RANGE ; - return ; - } /* end if */ - -if( what_string == NULL ) { - *error_return = NULL_STRING_POINTER ; - return; - } /* end if */ - -if( what_string[0] == '\0' ) { - *error_return = STRING_LENGTH_ZERO ; - return; - } /* end if */ - -if( strlen( what_string ) > WHAT_STRING_SIZE ) { - *error_return = STRING_LENGTH_TOO_BIG ; - return ; - } /* end if */ - -strcpy( file_version_update[ file_index ], what_string ) ; - -} /* end of ADFI_remember_version_update */ -/* end of file ADFI_remember_version_update.c */ -/* file ADFI_set_blank_disk_pointer.c */ -/********************************************************************** -ADFI_set_blank_disk_pointer: - Set the block and offset to the defined "blank", or unused values. - -output: struct DISK_POINTER *block_offset Block & offset in the file. - - Possible errors: -None allowed -**********************************************************************/ -void ADFI_set_blank_disk_pointer( - struct DISK_POINTER *block_offset ) -{ -block_offset->block = BLANK_FILE_BLOCK ; -block_offset->offset = BLANK_BLOCK_OFFSET ; -} /* end of ADFI_set_blank_disk_pointer */ -/* end of file ADFI_set_blank_disk_pointer.c */ -/* file ADFI_stack_control.c */ -/*********************************************************************** -ADFI stack control: - -input: const unsigned int file_index The file index. -input: const unsigned long file_block Block within the file. -input: const unsigned long block_offset Offset within the block. -input: const int stack_mode Control mode: INIT, GET or SET -input; const int stack_type Type of stack entry to process: FILE, NODE, etc.. -input: const unsigned int data_length Length of the data to buffer. -input/output: char *stack_data The character string buffered, is input for - mode SET and output for mode GET. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -PRISTK_NOT_FOUND - Note: errors are only important for GET mode since you must then go ahead - and read the data fom the file. The stack is only meant to speed things - up, not stop the process !!! -***********************************************************************/ -int ADFI_stack_control( const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - const int stack_mode, - const int stack_type, - const unsigned long data_length, - char *stack_data ) -{ -int i; -int low_priority; -int insert_index = -1; /* lint */ -int found; - -if( stack_data == NULL && (stack_mode == GET_STK || stack_mode == SET_STK) ) { - return NULL_STRING_POINTER ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 && stack_mode != INIT_STK ) { - return ADF_FILE_NOT_OPENED ; - } /* end if */ - -/* Process depending on the mode */ - - switch( stack_mode ) { - case INIT_STK: - case CLEAR_STK: - case CLEAR_STK_TYPE: - /* Clear all entries with current file_index and or type, - if file_index is 0 then clear all the entries!! */ - for (i=0; i 0 ) free(PRISTK[i].stack_data); - PRISTK[i].file_index = -1; - PRISTK[i].file_block = 0; - PRISTK[i].block_offset = 0; - PRISTK[i].stack_type = -1; - PRISTK[i].priority_level = -1; - } /* end for */ - if ( stack_mode == INIT_STK ) STACK_INIT = 1; - /* just in case link or linked-to node deleted */ - last_link_ID = 0.0; - break ; - case GET_STK: - /* Try and find the entry in the current stack by matching the - file index, block and offset, if found copy data else if - not return with an error. */ - for (i=0; i= 0 ) { - /* Existing entry so lower its priority, if it is the lowest - then save its index for possible replacement. */ - if ( PRISTK[i].priority_level > low_priority ) { - low_priority = PRISTK[i].priority_level; - insert_index = i; - } /* end if */ - PRISTK[i].priority_level++; - } /* end else if */ - else if ( found == 'f' ) { - /* An empty entry set pointer for possible insertion */ - low_priority = MAX_STACK * MAX_STACK; - insert_index = i; - found = 'e'; - } /* end else if */ - } /* end for */ - /* If the item was already on the stack then we are done */ - if ( found == 't' ) return NO_ERROR; - /* Insert the data onto the stack at the index_insert location. */ - i = insert_index; - if ( PRISTK[i].priority_level > 0 ) free(PRISTK[i].stack_data); - PRISTK[i].stack_data = ( char * ) malloc(data_length*sizeof(char)); - if ( PRISTK[i].stack_data == NULL ) { - /* Error allocating memory buffer so clear stack and punt */ - PRISTK[i].file_index = -1; - PRISTK[i].file_block = 0; - PRISTK[i].block_offset = 0; - PRISTK[i].stack_type = -1; - PRISTK[i].priority_level = -1; - return NO_ERROR; - } /* end if */ - strncpy( PRISTK[i].stack_data, stack_data, data_length ); - PRISTK[i].file_index = file_index; - PRISTK[i].file_block = file_block; - PRISTK[i].block_offset = block_offset; - PRISTK[i].stack_type = stack_type; - PRISTK[i].priority_level = 1; - break ; - } /* end switch */ - - return NO_ERROR; - -} /* end of ADFI_stack_control */ -/* end of file ADFI_stack_control.c */ -/* file ADFI_stridx_c.c */ -/********************************************************************** -ADFI stridx c: - To find the location of a substring within a string. This - routine is case InSeNsItIvE!!! - - It is NOT assumed that the substring is already upper-case!!! - -input: const char *str The string to search in. -input: const char *substr The substring to search for. -output: int return-value The position in str where substr was found. - -1 if substr was not found. - - Possible errors: -none: Errors are not allowed. -***********************************************************************/ -int ADFI_stridx_c( - const char *str, - const char *substr ) -{ -int i, j, k ; - -if( str == NULL || substr == NULL || substr[0] == '\0' ) { - return -1 ; /* not found - nothing to check */ -} - -for( i=0; str[i] != '\0'; i++ ) { - for( j=i, k=0; TO_UPPER( str[j] ) == TO_UPPER( substr[k] ); j++ ) { - if( substr[++k] == '\0' ) - return i ; /* the substring was found */ - } /* end for */ - } /* end for */ -return -1 ; /* the substring was not found */ -} /* end of ADFI_stridx_c */ -/* end of file ADFI_stridx_c.c */ -/* file ADFI_string_2_C_string.c */ -/********************************************************************** -ADFI string to C string: - Create a C string of the maximum length (+1 for null) which is - null terminated and has no trailing blanks. - -input: const char *string Input string. -input: const int string_length Length of input string to use. -output: char *c_string Returned C string. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -**********************************************************************/ -void ADFI_string_2_C_string( - const char *string, - const int string_length, - char *c_string, - int *error_return ) -{ -int i, iend ; - -if( (string == NULL) || (c_string == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Skip and trailing blanks **/ -for( iend=string_length-1; iend>=0; iend-- ) { - if( string[ iend ] != ' ' ) { - break ; - } /* end if */ - } /* end for */ - - /** Copy the non-trailing blank portion of the string **/ -for( i=0; i<=iend; i++ ) - c_string[i] = string[i] ; - - /** NULL terminate the C string **/ -c_string[i] = '\0' ; -} /* end of ADFI_string_2_C_string */ -/* end of file ADFI_string_2_C_string.c */ -/* file ADFI_unsigned_int_2_ASCII_Hex.c */ -/*********************************************************************** -ADFI unsigned int to ASCII hex: - Convert an unsigned int to an ASCII-Hex string. - -input: const unsigned int number The integer number to convert to ASCII. -input: const unsigned int minimum The expected minimum number in the int. -input: const unsigned int maximum The expected maximum number in the int. -input: const unsigned int string_length The length of the returned string. -output: char string[] The string. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NUMBER_LESS_THAN_MINIMUM -NUMBER_GREATER_THAN_MAXIMUM -STRING_LENGTH_ZERO -STRING_LENGTH_TOO_BIG -***********************************************************************/ -void ADFI_unsigned_int_2_ASCII_Hex( - const unsigned int number, - const unsigned int minimum, - const unsigned int maximum, - const unsigned int string_length, - char string[], - int *error_return ) -{ -unsigned int i, /** Index from 0 to string_length - 1 **/ - ir, /** Index from string_length - 1 to 0 **/ - j, /** Temoprary integer variable **/ - num ; /** Working value of ther number **/ - -if( string == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( number < minimum ) { - *error_return = NUMBER_LESS_THAN_MINIMUM ; - return ; - } /* end if */ - -if( number > maximum ) { - *error_return = NUMBER_GREATER_THAN_MAXIMUM ; - return ; - } /* end if */ - -if( string_length == 0 ) { - *error_return = STRING_LENGTH_ZERO ; - return ; - } /* end if */ - -if( string_length > 8 ) { - *error_return = STRING_LENGTH_TOO_BIG ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Convert the number using power-of-2 table **/ -num = number ; -for( i=0, ir=string_length - 1; i= pows[ ir ] ) { - j = num / pows[ ir ] ; - num = num - j * pows[ ir ] ; - } /* end if */ - else - j = 0 ; - string[i] = ASCII_Hex[ j ] ; - } /* end for */ -} /* end of ADFI_unsignedlong_2_ASCII_Hex */ -/* end of file ADFI_unsigned_int_2_ASCII_Hex.c */ -/* file ADFI_write_data_chunk.c */ -/*********************************************************************** -ADFI write data chunk: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const struct TOKENIZED_DATA_TYPE *tokenized_data_type Array. -input: const int data_size Size of data entity in bytes. -input: const long chunk_bytes Number of bytes in data chunk. -input: const long start_offset Starting offset into the data chunk -input: const long total_bytes Number of bytes to write in data chunk. -input: const char *data Pointer to the data. If 0, zero data. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_write_data_chunk( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - const struct TOKENIZED_DATA_TYPE *tokenized_data_type, - const int data_size, - const long chunk_bytes, - const long start_offset, - const long total_bytes, - const char *data, - int *error_return ) -{ -int format_compare ; -struct DISK_POINTER current_location, end_of_chunk_tag ; - -tStart(&gADFI_write_data_chunk_Timer); -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_write_data_chunk_Timer); - return ; - } /* end if */ - -if( tokenized_data_type == NULL ) { - *error_return = NULL_STRING_POINTER ; - tEnd(&gADFI_write_data_chunk_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_write_data_chunk_Timer); - return ; - } /* end if */ - -if( total_bytes+start_offset > chunk_bytes ) { - *error_return = REQUESTED_DATA_TOO_LONG ; - tEnd(&gADFI_write_data_chunk_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Write the tag **/ -ADFI_write_file( file_index, block_offset->block, block_offset->offset, - TAG_SIZE, data_chunk_start_tag, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_data_chunk_Timer); - return ; - } - - /** Calculate the end-of-chunk-tag pointer **/ -end_of_chunk_tag.block = block_offset->block ; -end_of_chunk_tag.offset = block_offset->offset + TAG_SIZE + - DISK_POINTER_SIZE + chunk_bytes ; -ADFI_adjust_disk_pointer( &end_of_chunk_tag, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_data_chunk_Timer); - return ; - } - - /** Adjust location and write end-of-chunk pointer **/ -current_location.block = block_offset->block ; -current_location.offset = block_offset->offset + TAG_SIZE ; -ADFI_adjust_disk_pointer( ¤t_location, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_data_chunk_Timer); - return ; - } - -ADFI_write_disk_pointer_2_disk( file_index, current_location.block, - current_location.offset, &end_of_chunk_tag, error_return ) ; - -current_location.offset += start_offset + DISK_POINTER_SIZE ; -ADFI_adjust_disk_pointer( ¤t_location, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_data_chunk_Timer); - return ; - } - - /** write the data **/ -if( data == NULL ) { /** Zero out the file data **/ - - /** If the data-pointer is NULL, write zeros to the file **/ - - /** Initialize the block of zeros **/ - if( block_of_00_initialized == FALSE ) { - int i ; - for( i=0; i DISK_BLOCK_SIZE ) { - long t_bytes = total_bytes ; - - /** If the number of bytes to write is larger than the block of - zeros we have, write out a series of zero blocks... - **/ - - /** write out the remainder of this block **/ - ADFI_write_file( file_index, current_location.block, - current_location.offset, DISK_BLOCK_SIZE - current_location.offset + 1, - block_of_00, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_data_chunk_Timer); - return ; - } - - current_location.block++ ; - current_location.offset = 0 ; - t_bytes -= (DISK_BLOCK_SIZE - current_location.offset + 1) ; - - /** Write blocks of zeros, then a partial block **/ - while( t_bytes > 0 ) { - ADFI_write_file( file_index, current_location.block, - current_location.offset, MIN( DISK_BLOCK_SIZE, t_bytes), - block_of_00, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_data_chunk_Timer); - return ; - } - t_bytes -= (MIN( DISK_BLOCK_SIZE, t_bytes)) ; - } /* end while */ - - } /* end if */ - else { - - /** Write a partial block of zeros to disk **/ - ADFI_write_file( file_index, current_location.block, - current_location.offset, total_bytes, block_of_00, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_data_chunk_Timer); - return ; - } - } /* end else */ - } /* end if */ -else { - - /** check for need of data translation **/ - ADFI_file_and_machine_compare( file_index, tokenized_data_type, - &format_compare, error_return ); - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_data_chunk_Timer); - return ; - } - if( format_compare == 1 ) { - /** Write the data to disk **/ - ADFI_write_file( file_index, current_location.block, - current_location.offset, total_bytes, data, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_data_chunk_Timer); - return ; - } - } /* end if */ - else { - ADFI_write_data_translated( file_index, current_location.block, - current_location.offset, tokenized_data_type, data_size, - total_bytes, data, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_data_chunk_Timer); - return ; - } - } /* end else */ - } /* end else */ - - /** Write the ending tag to disk **/ -ADFI_write_file( file_index, end_of_chunk_tag.block, end_of_chunk_tag.offset, - TAG_SIZE, data_chunk_end_tag, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_data_chunk_Timer); - return ; - } - -tEnd(&gADFI_write_data_chunk_Timer); -} /* end of ADFI_write_data_chunk */ -/* end of file ADFI_write_data_chunk.c */ -/* file ADFI_write_data_chunk_table.c */ -/*********************************************************************** -ADFI write data chunk table: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const int number_of_data_chunks Number of entries to write. -output: struct DATA_CHUNK_TABLE_ENTRY data_chunk_table[] Array of entries. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_write_data_chunk_table( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - const int number_of_data_chunks, - struct DATA_CHUNK_TABLE_ENTRY data_chunk_table[], - int *error_return ) -{ -struct DISK_POINTER disk_pointer, end_of_chunk_tag ; -int i ; - -tStart(&gADFI_write_data_chunk_table_Timer); -if( (block_offset == NULL) || (data_chunk_table == NULL) ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_write_data_chunk_table_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_write_data_chunk_table_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Write Starting boundary tag **/ -disk_pointer.block = block_offset->block ; -disk_pointer.offset = block_offset->offset ; -ADFI_write_file( file_index, disk_pointer.block, disk_pointer.offset, - TAG_SIZE, data_chunk_table_start_tag, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_data_chunk_table_Timer); - return ; - } - -disk_pointer.offset += TAG_SIZE ; -ADFI_adjust_disk_pointer( &disk_pointer, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_data_chunk_table_Timer); - return ; - } - - /** Calculate the end-of-chunk-tag location **/ -end_of_chunk_tag.block = disk_pointer.block ; -end_of_chunk_tag.offset = disk_pointer.offset + DISK_POINTER_SIZE + - number_of_data_chunks * 2 * DISK_POINTER_SIZE ; -ADFI_adjust_disk_pointer( &end_of_chunk_tag, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_data_chunk_table_Timer); - return ; - } -ADFI_write_disk_pointer_2_disk( file_index, disk_pointer.block, - disk_pointer.offset, &end_of_chunk_tag, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_data_chunk_table_Timer); - return ; - } - - /** Write data chunk table entries **/ -disk_pointer.offset += DISK_POINTER_SIZE ; -for( i=0; i number_of_data_elements ) { - chunk_size -= ( number_of_elements_written - number_of_data_elements ) ; - delta_to_bytes = chunk_size * data_size ; - delta_from_bytes = chunk_size * machine_size ; - } - ADFI_convert_number_format( - ADF_this_machine_format, /* from format */ - ADF_this_machine_os_size, /* from os size */ - ADF_file_format[file_index], /* to format */ - ADF_file_os_size[file_index], /* to os size */ - TO_FILE_FORMAT, - tokenized_data_type, chunk_size, from_data, - to_data, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_data_translated_Timer); - return ; - } - ADFI_write_file( file_index, disk_pointer.block, disk_pointer.offset, - delta_to_bytes, (char *)to_data, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_data_translated_Timer); - return ; - } - from_data += delta_from_bytes ; - disk_pointer.offset += delta_to_bytes ; - if ( disk_pointer.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &disk_pointer, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_data_translated_Timer); - return ; - } - } /* end if */ - } /* end while */ - -tEnd(&gADFI_write_data_translated_Timer); -} /* end of ADFI_write_data_translated */ -/* end of file ADFI_write_data_translated.c */ -/* file ADFI_write_disk_block.c */ -/*********************************************************************** -ADFI write disk block: -***********************************************************************/ -void ADFI_write_disk_block() -{ -fprintf(stderr,"Subroutine ADFI_write_disk_block is not yet implemented...\n" ) ; -} /* end of ADFI_write_disk_block */ -/* end of file ADFI_write_disk_block.c */ -/* file ADFI_write_disk_pointer_2_disk.c */ -/*********************************************************************** -ADFI write disk pointer 2 disk: - Given a pointer to a disk pointer, convert it to ASCII Hex - and write it to disk. - -input: const unsigned int file_index File to write to. -input: const unsigned long file_block Block within the file. -input: const unsigned long block_offset Offset within the block. -input: const struct DISK_POINTER *block_and_offset Disk pointer. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_write_disk_pointer_2_disk( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - const struct DISK_POINTER *block_and_offset, - int *error_return ) -{ -char disk_block_offset[DISK_POINTER_SIZE] ; - -tStart(&gADFI_write_disk_pointer_2_disk_Timer); -if( block_and_offset == NULL ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_write_disk_pointer_2_disk_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_write_disk_pointer_2_disk_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Convert into ASCII_Hex form **/ -ADFI_disk_pointer_2_ASCII_Hex( block_and_offset, &disk_block_offset[0], - &disk_block_offset[8], error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_disk_pointer_2_disk_Timer); - return ; - } - - /** Put the block/offset to disk **/ -ADFI_write_file( file_index, file_block, block_offset, - DISK_POINTER_SIZE, disk_block_offset, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_disk_pointer_2_disk_Timer); - return ; - } - - /** Set the block/offset onto the stack **/ -#if 0 -ADFI_stack_control(file_index, file_block, block_offset, - SET_STK, DISK_PTR_STK, DISK_POINTER_SIZE, - disk_block_offset ); -#endif -tEnd(&gADFI_write_disk_pointer_2_disk_Timer); -} /* end of ADFI_write_disk_pointer_2_disk */ -/* end of file ADFI_write_disk_pointer_2_disk.c */ -/* file ADFI_write_file.c */ -/*********************************************************************** -ADFI write file: - Write a number of bytes to an ADF file, given the file, - block, and block offset. - -input: const unsigned int file_index File to write to. -input: const unsigned long file_block Block within the file. -input: const unsigned long block_offset Offset within the block. -input: const unsigned int data_length Length of the data to write. -input: const char *data Address of the data. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -FWRITE_ERROR -***********************************************************************/ -void ADFI_write_file( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - const unsigned int data_length, - const char *data, - int *error_return ) -{ -int iret, end_block ; - -tStart(&gADFI_write_file_Timer); -if( data == NULL ) { - *error_return = NULL_STRING_POINTER ; - tEnd(&gADFI_write_file_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_write_file_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -printf("\t\tADFI_write_file(file=%d, block=%d, offset=%d, len=%d); last_wr_block: %d\n", file_index, file_block, block_offset, data_length, last_wr_block); - /** If the read buffer overlaps the buffer then reset it to make - sure its currrent **/ - -end_block = file_block+(block_offset+data_length)/DISK_BLOCK_SIZE+1; -if ( last_rd_file == (long int) file_index && last_rd_block >= (long int) file_block && - last_rd_block <= (long int) end_block ) - last_rd_block = last_rd_file = num_in_rd_block = -1 ; - - /** Check to see if we need to flush the write buffer. this happens if we - are writing a large chunk or the write moves out of the current block. - If the data length is zero then just flush the buffer and return. - Note that the ADF_modification_date routine will flush the buffer - after any write operations !! **/ - -if( ( (unsigned long int) data_length + block_offset > DISK_BLOCK_SIZE || - last_wr_block != (long int) file_block || last_wr_file != (long int) file_index || - data_length == 0 ) && flush_wr_block > 0 ) { - - printf("\t\tflush write: needed: %d\n", last_wr_block); - - tStart(&gADFI_write_file_flush_Timer); - DC_add_block(last_wr_file, last_wr_block, 1, wr_block_buffer, error_return); - -// /** Position the file **/ -// tStart(&gADFI_write_file_fseek_Timer); -// ADFI_fseek_file( last_wr_file, last_wr_block, 0, error_return ) ; -// tEnd(&gADFI_write_file_fseek_Timer); -// if( *error_return != NO_ERROR ) { -// tEnd(&gADFI_write_file_flush_Timer); -// tEnd(&gADFI_write_file_Timer); -// return ; -// } /* end if */ -// -// /** write the buffer **/ -// tStart(&gADFI_write_file_flush_fwrite_Timer); -// iret=fwrite( wr_block_buffer, 1, DISK_BLOCK_SIZE, ADF_file[last_wr_file] ); -// tEnd(&gADFI_write_file_flush_fwrite_Timer); - flush_wr_block = -2 ; /** Make sure we don't flush twice due to error **/ -// if( iret != DISK_BLOCK_SIZE ) { -// *error_return = FWRITE_ERROR ; -// tEnd(&gADFI_write_file_flush_Timer); -// tEnd(&gADFI_write_file_Timer); -// return ; -// DC_clear(ADF_file[last_wr_file]); -// } /* end if */ - - /** If the write buffer overlaps the buffer then reset it to make - sure its currrent, set flush buffer flag to false. **/ - if ( last_wr_file == (long int) file_index && last_wr_block >= (long int) file_block && - last_wr_block <= (long int) end_block ) - last_wr_block = last_wr_file = -2 ; - -tEnd(&gADFI_write_file_flush_Timer); -} /* end if */ -if ( data_length == 0 ) { - tEnd(&gADFI_write_file_Timer); - return; /** Just a buffer flush **/ -} - - /** No need to buffer large pieces of data or to take special - measures to cross block boundaries **/ - -tStart(&gADFI_write_file_large_Timer); -if( data_length + block_offset > DISK_BLOCK_SIZE ) { - - printf("\t\tlarge write: %d, needed: %d\n", file_block); - - /** Position the file **/ - tStart(&gADFI_write_file_fseek_Timer); - ADFI_fseek_file( file_index, file_block, block_offset, error_return ) ; - tEnd(&gADFI_write_file_fseek_Timer); - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_file_large_Timer); - tEnd(&gADFI_write_file_Timer); - return ; - } /* end if */ - - /** write the data **/ - iret = fwrite( data, 1, data_length, ADF_file[ file_index ] ) ; - if( iret != (int) data_length ) { - *error_return = FWRITE_ERROR ; - tEnd(&gADFI_write_file_large_Timer); - tEnd(&gADFI_write_file_Timer); - return ; - } /* end if */ - - /** Now make sure the cache matches up */ - { - char start_block[DISK_BLOCK_SIZE], end_block[DISK_BLOCK_SIZE]; - off_t end_pos = file_block * DISK_BLOCK_SIZE + data_length +block_offset; - if (DC_get_block(file_index, file_block, start_block)) { - memcpy(start_block + block_offset, data, - DISK_BLOCK_SIZE - block_offset); - DC_add_block(file_index, file_block, 0, start_block, error_return); - } - if (DC_get_block(file_index, end_pos / DISK_BLOCK_SIZE, end_block)) { - memcpy(end_block, data, end_pos % DISK_BLOCK_SIZE); - DC_add_block(file_index, end_pos / DISK_BLOCK_SIZE, 0, end_block, - error_return); - } - } - - tEnd(&gADFI_write_file_large_Timer); - tEnd(&gADFI_write_file_Timer); - return; -} /* end if */ - - /** For smaller pieces of data, write a block at a time. This will improve - performance if neighboring data is writen a small piece at a time - (strided reads, file overhead). - - Some assumptions apply to the block size. With some experimenting, - 1K blocks do not offer much improvement. 4K blocks (4096 bytes) - do improve performance remarkably. This is due to the fact that the - file structure is based of 4K blocks with offsets. Also the CRAY - loves 4K block writes!! - **/ -tStart(&gADFI_write_file_small_Timer); -if(((long int) file_block != last_wr_block || /*- a different block -*/ - (long int) file_index != last_wr_file )) { /*- entirely different file -*/ -// (long int) file_index != last_wr_file ) && /*- entirely different file -*/ -// (last_wr_block != -2 && last_wr_file != -2)) { /* And we didn't just flush */ - - /** buffer is not current, re-read **/ - - if ( (long int) file_block == last_rd_block && (long int) file_index == last_rd_file ) { - - /* Copy data from read buffer */ - memcpy( wr_block_buffer, rd_block_buffer, DISK_BLOCK_SIZE ); - iret = num_in_rd_block; - } - else { - - printf("\t\tsmall write: needed: %d\n", file_block); - - if ( !DC_get_block( file_index, file_block, wr_block_buffer ) ) { - /** Position the file **/ - ADFI_fseek_file( file_index, file_block, 0, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_file_small_Timer); - tEnd(&gADFI_write_file_Timer); - return ; - } /* end if */ - - /** Read the data from disk **/ - iret=fread( wr_block_buffer, 1, DISK_BLOCK_SIZE, ADF_file[file_index] ); - if( iret == EOF || iret < DISK_BLOCK_SIZE ) { - if ( iret < 0 ) iret = 0; - memset( &wr_block_buffer[iret], (size_t) ' ', DISK_BLOCK_SIZE-iret); - DC_add_block( file_index, file_block, 1, wr_block_buffer, error_return); - } /* end if */ - else - DC_add_block( file_index, file_block, 0, wr_block_buffer, error_return); - } - } /* end if */ - - /** Remember buffer information **/ - last_wr_block = file_block ; - last_wr_file = file_index ; - -} /* end if */ -tEnd(&gADFI_write_file_small_Timer); - - /** Write into the buffer and set flush buffer flag **/ -memcpy( &wr_block_buffer[block_offset], data, data_length ); -flush_wr_block = 1 ; -//last_wr_block = file_block ; -//last_wr_file = file_index ; -//if (last_rd_block == last_wr_block && last_rd_file == last_wr_file) -// memcpy( rd_block_buffer, wr_block_buffer, DISK_BLOCK_SIZE); -//DC_add_block(ADF_file[file_index], file_block, wr_block_buffer); - -// DC_add_block(file_index, file_block, 1, wr_block_buffer, error_return); -// DC_flush(); -tEnd(&gADFI_write_file_Timer); -} /* end of ADFI_write_file */ -/* end of file ADFI_write_file.c */ -/* file ADFI_write_file_header.c */ -/*********************************************************************** -ADFI write file header: - To take information in the FILE_HEADER structure and format it - for disk, and write it out. -input: const int file_index File index to write to. -input: const FILE_HEADER *file_header The file header structure. -input: const int cache 1 if cache, 0 if write directly - to disk. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_MEMORY_TAG_ERROR -ADF_DISK_TAG_ERROR -***********************************************************************/ -void ADFI_write_file_header( - const int file_index, - const struct FILE_HEADER *file_header, - const int cache, - int *error_return ) -{ -char disk_header[ FILE_HEADER_SIZE ] ; - -tStart(&gADFI_write_file_header_Timer); -if( file_header == NULL ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_write_file_header_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_write_file_header_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check memory tags for proper data **/ -if( strncmp( file_header->tag0, file_header_tags[0], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_write_file_header_Timer); - return ; - } /* end if */ - -if( strncmp( file_header->tag1, file_header_tags[1], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_write_file_header_Timer); - return ; - } /* end if */ - -if( strncmp( file_header->tag2, file_header_tags[2], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_write_file_header_Timer); - return ; - } /* end if */ - -if( strncmp( file_header->tag3, file_header_tags[3], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_write_file_header_Timer); - return ; - } /* end if */ - -if( strncmp( file_header->tag4, file_header_tags[4], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_write_file_header_Timer); - return ; - } /* end if */ - -if( strncmp( file_header->tag5, file_header_tags[5], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_write_file_header_Timer); - return ; - } /* end if */ - -/** OK the memory tags look good, let's format the file header information - into the disk format and write it out. -**/ -if ( cache && file_header_cache[ file_index ]->initialized ) - file_header_cache[ file_index ]->header = *file_header; -else -{ - strncpy( &disk_header[ 0], (char *)file_header->what, WHAT_STRING_SIZE ) ; - strncpy( &disk_header[ 32], (char *)file_header->tag0, TAG_SIZE ) ; - strncpy( &disk_header[ 36], (char *)file_header->creation_date, - DATE_TIME_SIZE); - strncpy( &disk_header[ 64], (char *)file_header->tag1, TAG_SIZE ) ; - strncpy( &disk_header[ 68], (char *)file_header->modification_date, - DATE_TIME_SIZE ) ; - strncpy( &disk_header[ 96], (char *)file_header->tag2, TAG_SIZE ) ; - disk_header[100] = file_header->numeric_format ; - disk_header[101] = file_header->os_size ; - strncpy( &disk_header[102], (char *)file_header->tag3, TAG_SIZE ) ; - - ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_char, 0, 255, 2, - &disk_header[106], error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_file_header_Timer); - return ; - } - ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_short, 0, 255, 2, - &disk_header[108], error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_file_header_Timer); - return ; - } - ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_int, 0, 255, 2, - &disk_header[110], error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_file_header_Timer); - return ; - } - ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_long, 0, 255, 2, - &disk_header[112], error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_file_header_Timer); - return ; - } - ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_float, 0, 255, 2, - &disk_header[114], error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_file_header_Timer); - return ; - } - ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_double, 0, 255, 2, - &disk_header[116], error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_file_header_Timer); - return ; - } - ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_char_p, 0, 255, 2, - &disk_header[118], error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_file_header_Timer); - return ; - } - ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_short_p, 0, 255, 2, - &disk_header[120], error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_file_header_Timer); - return ; - } - ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_int_p, 0, 255, 2, - &disk_header[122], error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_file_header_Timer); - return ; - } - ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_long_p, 0, 255, 2, - &disk_header[124], error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_file_header_Timer); - return ; - } - ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_float_p, 0, 255, 2, - &disk_header[126], error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_file_header_Timer); - return ; - } - ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_double_p, 0, 255, 2, - &disk_header[128], error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_file_header_Timer); - return ; - } - - strncpy( &disk_header[130], file_header->tag4, TAG_SIZE ) ; - - ADFI_disk_pointer_2_ASCII_Hex( &file_header->root_node, &disk_header[134], - &disk_header[142], error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_file_header_Timer); - return ; - } - - ADFI_disk_pointer_2_ASCII_Hex( &file_header->end_of_file, &disk_header[146], - &disk_header[154], error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_file_header_Timer); - return ; - } - - ADFI_disk_pointer_2_ASCII_Hex( &file_header->free_chunks, &disk_header[158], - &disk_header[166], error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_file_header_Timer); - return ; - } - - ADFI_disk_pointer_2_ASCII_Hex( &file_header->extra, &disk_header[170], - &disk_header[178], error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_file_header_Timer); - return ; - } - - strncpy( &disk_header[182], file_header->tag5, TAG_SIZE ) ; - - /** Now write the disk header out... **/ - ADFI_write_file( file_index, 0, 0, FILE_HEADER_SIZE, disk_header, - error_return ) ; -} -if ( cache && !file_header_cache[ file_index ]->initialized ) -{ - file_header_cache[ file_index ]->header = *file_header; - file_header_cache[ file_index ]->initialized = 1; -} - - /** Set the header onto the stack **/ -ADFI_stack_control(file_index, 0, 0, SET_STK, FILE_STK, - FILE_HEADER_SIZE, disk_header ); -tEnd(&gADFI_write_file_header_Timer); -} /* end of ADFI_write_file_header */ -/* end of file ADFI_write_file_header.c */ -/* file ADFI_write_free_chunk.c */ -/*********************************************************************** -ADFI write free chunk: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const struct FREE_CHUNK *free_chunk Pointer to free-chunk. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_write_free_chunk( - const int file_index, - const struct DISK_POINTER *block_offset, - const struct FREE_CHUNK *free_chunk, - int *error_return ) -{ -unsigned int i ; -struct DISK_POINTER current_location ; - -tStart(&gADFI_write_free_chunk_Timer); -if( (block_offset == NULL) || (free_chunk == NULL) ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_write_free_chunk_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_write_free_chunk_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Initialize the block of 'X's **/ -if( block_of_XX_initialized == FALSE ) { - for( i=0; istart_tag, free_chunk_start_tag, TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_write_free_chunk_Timer); - return ; - } /* end if */ - -if( strncmp( free_chunk->end_tag, free_chunk_end_tag, TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_write_free_chunk_Timer); - return ; - } /* end if */ - - /** Write start TAG **/ -ADFI_write_file( file_index, block_offset->block, block_offset->offset, - TAG_SIZE, free_chunk->start_tag, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_free_chunk_Timer); - return ; - } - - /** Write disk pointers **/ -current_location.block = block_offset->block ; -current_location.offset = block_offset->offset + TAG_SIZE ; -ADFI_adjust_disk_pointer( ¤t_location, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_free_chunk_Timer); - return ; - } - -ADFI_write_disk_pointer_2_disk( file_index, current_location.block, - current_location.offset, - &free_chunk->end_of_chunk_tag, - error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_free_chunk_Timer); - return ; - } - -current_location.offset += DISK_POINTER_SIZE ; -ADFI_adjust_disk_pointer( ¤t_location, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_free_chunk_Timer); - return ; - } - -ADFI_write_disk_pointer_2_disk( file_index, current_location.block, - current_location.offset, - &free_chunk->next_chunk, - error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_free_chunk_Timer); - return ; - } - - /** Write out a bunch of 'x's in the free chunk's empty space **/ -current_location.offset += DISK_POINTER_SIZE ; -ADFI_adjust_disk_pointer( ¤t_location, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_free_chunk_Timer); - return ; - } - - /** Fill in partial end of a block **/ -if( (current_location.block != free_chunk->end_of_chunk_tag.block) && - (current_location.offset != 0 ) ) { - ADFI_write_file( file_index, current_location.block, - current_location.offset, DISK_BLOCK_SIZE - current_location.offset, - block_of_XX, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_free_chunk_Timer); - return ; - } - current_location.block++ ; - current_location.offset = 0 ; - } /* end if */ - - /** Fill in intermediate whole blocks **/ -while( current_location.block < free_chunk->end_of_chunk_tag.block ) { - ADFI_write_file( file_index, current_location.block, - 0, DISK_BLOCK_SIZE, block_of_XX, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_free_chunk_Timer); - return ; - } - current_location.block++ ; - } /* end if */ - - /** Fill in partial block to end-of-free-chunk **/ -if( current_location.offset < free_chunk->end_of_chunk_tag.offset ) { - ADFI_write_file( file_index, current_location.block, - current_location.offset, - free_chunk->end_of_chunk_tag.offset - current_location.offset, - block_of_XX, error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_free_chunk_Timer); - return ; - } - } /* end if */ - - /** Now (finally) write out the free_chunk-end_tag **/ -ADFI_write_file( file_index, current_location.block, - free_chunk->end_of_chunk_tag.offset, TAG_SIZE, free_chunk->end_tag, - error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_free_chunk_Timer); - return ; - } - -tEnd(&gADFI_write_free_chunk_Timer); -} /* end of ADFI_write_free_chunk */ -/* end of file ADFI_write_free_chunk.c */ -/* file ADFI_write_free_chunk_table.c */ -/*********************************************************************** -ADFI write free chunk table: - To take information in the FREE_CHUNK_TABLE structure and format it - for disk, and write it out. -input: const int file_index File index to write to. -input: const FREE_CHUNK_TABLE *free_chunk_table The free_chunk header struct. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_write_free_chunk_table( - const int file_index, - const struct FREE_CHUNK_TABLE *free_chunk_table, - int *error_return ) -{ -char disk_free_chunk_data[ FREE_CHUNK_TABLE_SIZE ] ; - -tStart(&gADFI_write_free_chunk_table_Timer); -if( free_chunk_table == NULL ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_write_free_chunk_table_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_write_free_chunk_table_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check memory tags for proper data **/ -if( strncmp( free_chunk_table->start_tag, free_chunk_table_start_tag, - TAG_SIZE ) != 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_write_free_chunk_table_Timer); - return ; - } /* end if */ - -if( strncmp( free_chunk_table->end_tag, free_chunk_table_end_tag, - TAG_SIZE ) != 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_write_free_chunk_table_Timer); - return ; - } /* end if */ - -/** OK the memory tags look good, let's format the free_chunk header - information into the disk format and write it out. -**/ -strncpy( &disk_free_chunk_data[ 0], (char *)free_chunk_table->start_tag, - TAG_SIZE ) ; - -ADFI_disk_pointer_2_ASCII_Hex( &free_chunk_table->small_first_block, - &disk_free_chunk_data[TAG_SIZE], - &disk_free_chunk_data[DISK_POINTER_SIZE], error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_free_chunk_table_Timer); - return ; - } - -ADFI_disk_pointer_2_ASCII_Hex( &free_chunk_table->small_last_block, - &disk_free_chunk_data[16], &disk_free_chunk_data[24], error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_free_chunk_table_Timer); - return ; - } - -ADFI_disk_pointer_2_ASCII_Hex( &free_chunk_table->medium_first_block, - &disk_free_chunk_data[28], &disk_free_chunk_data[36], error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_free_chunk_table_Timer); - return ; - } - -ADFI_disk_pointer_2_ASCII_Hex( &free_chunk_table->medium_last_block, - &disk_free_chunk_data[40], &disk_free_chunk_data[48], error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_free_chunk_table_Timer); - return ; - } - -ADFI_disk_pointer_2_ASCII_Hex( &free_chunk_table->large_first_block, - &disk_free_chunk_data[52], &disk_free_chunk_data[60], error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_free_chunk_table_Timer); - return ; - } - -ADFI_disk_pointer_2_ASCII_Hex( &free_chunk_table->large_last_block, - &disk_free_chunk_data[64], &disk_free_chunk_data[72], error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_free_chunk_table_Timer); - return ; - } - -strncpy( &disk_free_chunk_data[ 76], (char *)free_chunk_table->end_tag, - TAG_SIZE ) ; - - /** Now write the free_chunk header out to disk... **/ -ADFI_write_file( file_index, FREE_CHUNKS_BLOCK, FREE_CHUNKS_OFFSET, - FREE_CHUNK_TABLE_SIZE, disk_free_chunk_data, error_return ) ; - /** Set the free chunk onto the stack **/ -ADFI_stack_control(file_index, FREE_CHUNKS_BLOCK, FREE_CHUNKS_OFFSET, - SET_STK, FREE_CHUNK_STK, FREE_CHUNK_TABLE_SIZE, - disk_free_chunk_data ); -tEnd(&gADFI_write_free_chunk_table_Timer); -} /* end of ADFI_write_free_chunk_table */ -/* end of file ADFI_write_free_chunk_table.c */ -/* file ADFI_write_modification_date.c */ -/*********************************************************************** -ADFI write modification date: - Writes the current date/time into the modification date field of - the file header. Also updates the file version (what string) - in the header if the file version global variable has been set - - after writing, file version global variable is unset so that it is - only written once. - -input: const int file_index File index to write to. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -FWRITE_ERROR -***********************************************************************/ -void ADFI_write_modification_date( - const int file_index, - int *error_return ) -{ -int i_block_offset ; -char mod_date[DATE_TIME_SIZE] ; - -tStart(&gADFI_write_modification_date_Timer); -*error_return = NO_ERROR ; - -ADFI_get_current_date( mod_date ) ; - - /** block offset depends on the location the of modification date - in the FILE_HEADER structure **/ -i_block_offset = WHAT_STRING_SIZE + TAG_SIZE + DATE_TIME_SIZE + TAG_SIZE ; -ADFI_write_file( file_index, 0, i_block_offset, DATE_TIME_SIZE, mod_date, - error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_modification_date_Timer); - return; - } /* end if */ - - /** Flush the write buffer to ensure the file is current!! **/ -ADFI_flush_buffers( file_index, FLUSH, error_return ); -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_modification_date_Timer); - return; - } /* end if */ - -if( file_version_update[ file_index ][ 0 ] != '\0' ) -{ - i_block_offset = 0 ; /* what-string is first field in header */ - ADFI_write_file( file_index, 0, i_block_offset, WHAT_STRING_SIZE, - file_version_update[ file_index ], error_return ) ; - -/** reset the version to default so that it only gets updated once **/ - file_version_update[ file_index ][ 0 ] = '\0' ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_modification_date_Timer); - return; - } /* end if */ - } /* end if */ - -tEnd(&gADFI_write_modification_date_Timer); -} /* end of ADFI_write_modification_date */ -/* end of file ADFI_write_modification_date.c */ -/* file ADFI_write_node_header.c */ -/*********************************************************************** -ADFI write node header: - To take information in the NODE_HEADER structure and format it - for disk, and write it out. -input: const int file_index File index to write to. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const NODE_HEADER *node_header The node header structure. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_write_node_header( - const int file_index, - const struct DISK_POINTER *block_offset, - const struct NODE_HEADER *node_header, - int *error_return ) -{ -int i ; -char disk_node_data[ NODE_HEADER_SIZE ] ; - -tStart(&gADFI_write_node_header_Timer); -if( (block_offset == NULL) || (node_header == NULL) ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_write_node_header_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_write_node_header_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -/** Check memory tags for proper data **/ -if( strncmp( node_header->node_start_tag, node_start_tag, TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_write_node_header_Timer); - return ; - } /* end if */ - -if( strncmp( node_header->node_end_tag, node_end_tag, TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - tEnd(&gADFI_write_node_header_Timer); - return ; - } /* end if */ - -/** OK the memory tags look good, let's format the node header information - into the disk format and write it out. -**/ -strncpy( &disk_node_data[ 0], (char *)node_header->node_start_tag, TAG_SIZE ) ; -strncpy( &disk_node_data[ TAG_SIZE], (char *)node_header->name, - ADF_NAME_LENGTH ); -strncpy( &disk_node_data[ 36], (char *)node_header->label, ADF_LABEL_LENGTH ) ; - -ADFI_unsigned_int_2_ASCII_Hex( node_header->num_sub_nodes, 0, - MAXIMUM_32_BITS, 8, &disk_node_data[ 68], error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_node_header_Timer); - return ; - } - -ADFI_unsigned_int_2_ASCII_Hex( node_header->entries_for_sub_nodes, 0, - MAXIMUM_32_BITS, 8, &disk_node_data[ 76], error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_node_header_Timer); - return ; - } - -ADFI_disk_pointer_2_ASCII_Hex( &node_header->sub_node_table, - &disk_node_data[84], &disk_node_data[92], error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_node_header_Timer); - return ; - } - -strncpy( &disk_node_data[ 96], (char *)node_header->data_type, - ADF_DATA_TYPE_LENGTH ) ; - -ADFI_unsigned_int_2_ASCII_Hex( node_header->number_of_dimensions, 0, - 12, 2, &disk_node_data[128], error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_node_header_Timer); - return ; - } - -for( i=0; idimension_values[i], 0, - MAXIMUM_32_BITS, 8, &disk_node_data[130+(i*8)], error_return ) ; - if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_node_header_Timer); - return ; - } - } /* end for */ - -ADFI_unsigned_int_2_ASCII_Hex( node_header->number_of_data_chunks, 0, - 65535, 4, &disk_node_data[226], error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_node_header_Timer); - return ; - } - -ADFI_disk_pointer_2_ASCII_Hex( &node_header->data_chunks, - &disk_node_data[230], &disk_node_data[238], error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_node_header_Timer); - return ; - } - -strncpy( &disk_node_data[242], (char *)node_header->node_end_tag, TAG_SIZE ) ; - - /** Now write the node-header out to disk... **/ -//if (cached_node_header_location[file_index].block != block_offset->block || -// cached_node_header_location[file_index].offset != block_offset->offset) { -// tStart(&gADFI_write_node_header_write_Timer); -// ADFI_write_file( file_index, cached_node_header_location[file_index].block, -// cached_node_header_location[ file_index ].offset, -// NODE_HEADER_SIZE, node_header_cache[file_index], -// error_return ) ; - ADFI_write_file( file_index, block_offset->block, block_offset->offset, - NODE_HEADER_SIZE, disk_node_data, error_return ) ; -// tEnd(&gADFI_write_node_header_write_Timer); -//} -//memcpy(node_header_cache[ file_index ], disk_node_data, NODE_HEADER_SIZE); -//cached_node_header_location[ file_index ].block = block_offset->block; -//cached_node_header_location[ file_index ].offset = block_offset->offset; - - /** Set the header onto the stack **/ -ADFI_stack_control(file_index, block_offset->block, block_offset->offset, - SET_STK, NODE_STK, NODE_HEADER_SIZE, disk_node_data ); -tEnd(&gADFI_write_node_header_Timer); -} /* end of ADFI_write_node_header */ -/* end of file ADFI_write_node_header.c */ -/* file ADFI_write_sub_node_table.c */ -/*********************************************************************** -ADFI write sub node table: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const int number_of_sub_nodes Number of sub-node entries. -input: struct SUB_NODE_TABLE_ENTRY sub_node_table[] Array of sub-node entries. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_write_sub_node_table( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - const int number_of_sub_nodes, - struct SUB_NODE_TABLE_ENTRY sub_node_table[], - int *error_return ) -{ -int i ; -struct DISK_POINTER end_of_chunk_tag, current_child ; - -tStart(&gADFI_write_sub_node_table_Timer); -if( (block_offset == NULL) || (sub_node_table == NULL) ) { - *error_return = NULL_POINTER ; - tEnd(&gADFI_write_sub_node_table_Timer); - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - tEnd(&gADFI_write_sub_node_table_Timer); - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** calculate the end-of-chunk tag pointer **/ -end_of_chunk_tag.block = block_offset->block ; -end_of_chunk_tag.offset = block_offset->offset + TAG_SIZE + DISK_POINTER_SIZE + - number_of_sub_nodes * (ADF_NAME_LENGTH + DISK_POINTER_SIZE) ; -ADFI_adjust_disk_pointer( &end_of_chunk_tag, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_sub_node_table_Timer); - return ; - } - - /** Write start TAG **/ -ADFI_write_file( file_index, block_offset->block, block_offset->offset, - TAG_SIZE, sub_node_start_tag, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_sub_node_table_Timer); - return ; - } - - /** Write disk pointer **/ -current_child.block = block_offset->block ; -current_child.offset = block_offset->offset + TAG_SIZE ; -ADFI_adjust_disk_pointer( ¤t_child, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_sub_node_table_Timer); - return ; - } - -ADFI_write_disk_pointer_2_disk( file_index, current_child.block, - current_child.offset, &end_of_chunk_tag, - error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_sub_node_table_Timer); - return ; - } - - /** Format and write out the table entries **/ -current_child.offset += DISK_POINTER_SIZE ; -for( i=0; ichild_name, - ADF_NAME_LENGTH ) ; -ADFI_disk_pointer_2_ASCII_Hex( &sub_node_table_entry->child_location, - &sub_node_entry_disk_data[ ADF_NAME_LENGTH ], - &sub_node_entry_disk_data[ ADF_NAME_LENGTH + 8 ], error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_sub_node_table_entry_Timer); - return ; - } - - /** Now write it out to disk **/ -ADFI_write_file( file_index, block_offset->block, block_offset->offset, - ADF_NAME_LENGTH + DISK_POINTER_SIZE, - sub_node_entry_disk_data, error_return ) ; -if( *error_return != NO_ERROR ) { - tEnd(&gADFI_write_sub_node_table_entry_Timer); - return ; - } - - /** Set the subnode onto the stack **/ -ADFI_stack_control(file_index, block_offset->block, block_offset->offset, - SET_STK, SUBNODE_STK, ADF_NAME_LENGTH + DISK_POINTER_SIZE, - sub_node_entry_disk_data ); - -tEnd(&gADFI_write_sub_node_table_entry_Timer); -} /* end of ADFI_write_sub_node_table_entry */ -/* end of file ADFI_write_sub_node_table_entry.c */ -/* file ADFI_strtok.c */ -/*********************************************************************** -ADFI get string token: This routine simulates strtok except it returns the -current postion in the string tobe used later. Thas avoids the problem of -trying using strtok in a recrusive subroutine call which does not work! - -input/output: *string - the string to parse tokens from. - returns string with token replaced by nil. -input/output: *string_pos - the string position to begin parsing should - be placed at the beginning of the string. - returns postion after last token to continue - string parsing. Token may change from last call. -input: *token - The token to search for. -function return: - a pointer to the desired substring. - A NULL returns indicates the end of the string. - -***********************************************************************/ -char *ADFI_strtok( - char *string, - char **string_pos, - char *token ) -{ - char *tmp_ptr ; - char *sub_string ; - int string_len ; - - if ( string_pos == NULL ) return NULL ; - if( token == NULL || string == NULL || *string_pos == NULL ) return NULL ; - - /* Get the length left in the string */ - - string_len = strlen ( *string_pos ) ; - if ( string_len == 0 ) return NULL ; - - /* Find the first character in the string which does not match the token */ - tmp_ptr = *string_pos ; - while ( string_len > 0 ) { - if ( tmp_ptr[0] == token[0] ) { - tmp_ptr++ ; - string_len-- ; - } - else { - break ; - } /* end if */ - } /* end while */ - if ( string_len == 0 ) return NULL ; - - /* Set the begining fof the sub string */ - sub_string = tmp_ptr ; - - /* Find the next token or the end of the string */ - - while ( string_len > 0 ) { - if ( tmp_ptr[0] != token[0] ) { - tmp_ptr++ ; - string_len-- ; - } - else { - tmp_ptr[0] = '\0' ; - break ; - } /* end if */ - } /* end while */ - - /* Set location for the next search */ - - if ( string_len > 0 ) - *string_pos = &tmp_ptr[1] ; - else - *string_pos = NULL ; - - return sub_string ; - -} /* end of ADFI_strtok */ -/* end of file ADFI_strtok.c */ -/* end of combine 2.0 */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_internals_new.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_internals_new.c deleted file mode 100644 index 748e92499c..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/ADF_internals_new.c +++ /dev/null @@ -1,8392 +0,0 @@ -/* created by combine 2.0 */ -/* file ADFI_AAA_var.c */ -/*** -File: ADF_internals.c - ---------------------------------------------------------------------- - BOEING - ---------------------------------------------------------------------- - Project: CGNS - Author: Tom Dickens 234-1024 tpd6908@yak.ca.boeing.com - Date: 3/2/1995 - Purpose: Provide the underlying support for the ADF-Core. - ---------------------------------------------------------------------- - ---------------------------------------------------------------------- -Notes: Integer numbers are stored on disk as ASCII-hex numbers. - 2 bytes gives a number from 0 to 255, - 4 bytes 0 to 65,535, - 8 bytes 0 to 4,294,967,295, - and 12 bytes from 0 to 281,474,976,710,655. - -Pointers are 12 bytes. - 8 bytes pointing to a 4096-byte chunk on disk, - and 4 bytes is an offset into that chunk. -This gives a maximum file size of 17,592,186,048,512 bytes (17.5 Tera bytes). - - ---------------------------------------------------------------------- - The tables below detail the format of the information which - makes up the ADF file. - - There are 7 different, unique types of data "chunks" used. - Three of these are of fixed length, and the other four are - variable in length. - - With the exception of numeric data (user's data), all information - in an ADF file is written in ASCII. - - Uniquely-defined boundary-tags are used to surround all "chunks" - of information. These tags are checked to confirm "chunk" type - and also to ensure data integrity. - ---------------------------------------------------------------------- - 186 Physical disk-First block -bytes start end description range / format - 32 0 31 "what" description "@(#)ADF Database Version AXXxxx>" - 4 32 35 "AdF0" boundary tag Tag - 28 36 63 Creation date/time "Wed Apr 19 09:33:25 1995 " - 4 64 67 "AdF1" boundary tag Tag - 28 68 95 Modification date/time "Wed Apr 19 09:33:29 1995 " - 4 96 99 "AdF2" boundary tag Tag - 1 100 100 Numeric format ['B', 'L', 'C', 'N'] - 1 101 101 Duplicate of numeric format ['B', 'L', 'C', 'N'] - 4 102 105 "AdF3" boundary tag Tag - 2 106 107 sizeof( char ) 0 to 255 - 2 108 109 sizeof( short ) 0 to 255 - 2 110 111 sizeof( int ) 0 to 255 - 2 112 113 sizeof( long ) 0 to 255 - 2 114 115 sizeof( float ) 0 to 255 - 2 116 117 sizeof( double ) 0 to 255 - 2 118 119 sizeof( char * ) 0 to 255 - 2 120 121 sizeof( short * ) 0 to 255 - 2 122 123 sizeof( int *) 0 to 255 - 2 124 125 sizeof( long * ) 0 to 255 - 2 126 127 sizeof( float *) 0 to 255 - 2 128 129 sizeof( double *) 0 to 255 - 4 130 133 "AdF4" boundary tag Tag - 12 134 145 Root-node header pointer Disk chunk, chunk offset. - 12 146 157 End-of-File pointer Disk chunk, chunk offset. - 12 158 169 Free-Chunk table pointer Disk chunk, chunk offset. - 12 170 181 Extra pointer Disk chunk, chunk offset. - 4 182 185 "AdF5" boundary tag Tag - - - 80 Free-Chunk table -bytes start end description range / format - 4 0 3 "fCbt" boundary tag Tag - 12 4 15 First small block pointer Disk chunk, chunk offset. - 12 16 27 Last small block pointer Disk chunk, chunk offset. - 12 28 39 First medium block pointer Disk chunk, chunk offset. - 12 40 51 Last medium block pointer Disk chunk, chunk offset. - 12 52 63 First large block pointer Disk chunk, chunk offset. - 12 64 75 Last large block pointer Disk chunk, chunk offset. - 4 76 79 "fcte" boundarg tag Tag - - - Variable: min 32 Free Chunk -bytes start end description range / format - 4 0 3 "FreE" boundary tag Tag - 12 4 15 Pointer to End-of-Chunk-Tag - 12 16 27 Pointer to Next-Chunk in list - 0 28 - more free space - 4 28 31 "EndC" boundarg tag Tag - -Note: There can occur other free space "gas" in the file which are smaller - than the 32-bytes needed to have tags and pointers. The convention - in these cases is to just fill the entire free space with the letter - z, lower-case. - - 246 Node header -bytes start end description range / format - 4 0 3 "NoDe" boundary tag Tag - 32 4 35 Name Text: Blank filled - 32 36 67 Label Text: Blank filled - 8 68 75 Number of sub-nodes 0 to 4,294,967,295 - 8 76 83 Entries for sub-nodes 0 to 4,294,967,295 - 12 84 95 Pointer to sub-node table Disk chunk, chunk offset. - 32 96 127 Data-type Text: Blank filled - 2 128 129 Number of dimensions 0 to 12 - 8 130 137 Dimension value 0 0 to 4,294,967,295 - 8 138 145 Dimension value 1 0 to 4,294,967,295 - 8 146 153 Dimension value 2 0 to 4,294,967,295 - 8 154 161 Dimension value 3 0 to 4,294,967,295 - 8 162 169 Dimension value 4 0 to 4,294,967,295 - 8 170 177 Dimension value 5 0 to 4,294,967,295 - 8 178 185 Dimension value 6 0 to 4,294,967,295 - 8 186 193 Dimension value 7 0 to 4,294,967,295 - 8 194 201 Dimension value 8 0 to 4,294,967,295 - 8 202 209 Dimension value 9 0 to 4,294,967,295 - 8 210 217 Dimension value 10 0 to 4,294,967,295 - 8 218 225 Dimension value 11 0 to 4,294,967,295 - 4 226 229 Number of data chunks 0 to 65,535 - 12 230 241 Pointer to data chunk (or table) Disk chunk, chunk offset. - 4 242 245 "TaiL" boundary tag Tag - - - Variable: min 64 Sub-node table -bytes start end description range / format - 4 0 3 "SNTb" boundary tag Tag - 12 4 15 Pointer to End-of-Table-Tag - 32 16 47 Child's name Text: Blank filled - 12 48 59 Pointer to child Disk chunk, chunk offset. - 32 - - Child's name Text: Blank filled - 12 - - Pointer to child Disk chunk, chunk offset. - 32 - - Child's name Text: Blank filled - 12 - - Pointer to child Disk chunk, chunk offset. - 32 - - Child's name Text: Blank filled - 12 - - Pointer to child Disk chunk, chunk offset. - 32 - - Child's name Text: Blank filled - 12 - - Pointer to child Disk chunk, chunk offset. - 32 - - Child's name Text: Blank filled - 12 - - Pointer to child Disk chunk, chunk offset. - 4 60 63 "snTE" boundary tag Tag - - - Variable: min 44 Data-chunk table -bytes start end description range / format - 4 0 3 "DCtb" boundary tag Tag - 12 4 15 Pointer to End-of-Table-Tag - 12 16 27 Pointer to data start Disk chunk, chunk offset. - 12 28 39 Pointer to data end Disk chunk, chunk offset. - 12 - - Pointer to data start Disk chunk, chunk offset. - 12 - - Pointer to data end Disk chunk, chunk offset. - 12 - - Pointer to data start Disk chunk, chunk offset. - 12 - - Pointer to data end Disk chunk, chunk offset. - 12 - - Pointer to data start Disk chunk, chunk offset. - 12 - - Pointer to data end Disk chunk, chunk offset. - 4 40 43 "dcTE" boundarg tag Tag - - - Variable: min 32 Data-chunks -(Minimum is 32 bytes, which cooresponds to the size required for a free-chunk) -bytes start end description range / format - 4 0 3 "DaTa" boundary tag Tag - 12 4 15 Pointer to End-of-Data-Tag - 16 16 27 The data - 4 28 31 "dEnD" boundarg tag Tag - -**/ -/*********************************************************************** - Includes -***********************************************************************/ -#ifndef MAKEDEPEND -#include -#include -#include -#include -#include -#include -#if defined(_WIN32) && !defined(__NUTC__) -#include -#include -#else -#include -#include -#endif -#endif - -#include "ADF.h" -#include "ADF_internals.h" - -/*********************************************************************** - Character string defining the data tags: -***********************************************************************/ -/* These were moved from ADF_internals.h since they are only used here - and leaving them here gives warning messages when the other .c files - are compiled. WRO 2005-Jan-11 */ -static char *file_header_tags[] = { - "AdF0", "AdF1", "AdF2", "AdF3", "AdF4", "AdF5" } ; -static char node_start_tag[] = "NoDe" ; -static char node_end_tag[] = "TaiL" ; -static char free_chunk_table_start_tag[] = "fCbt" ; -static char free_chunk_table_end_tag[] = "Fcte" ; - -static char free_chunk_start_tag[] = "FreE" ; -static char free_chunk_end_tag[] = "EndC" ; -static char sub_node_start_tag[] = "SNTb" ; -static char sub_node_end_tag[] = "snTE" ; -static char data_chunk_table_start_tag[] = "DCtb" ; -static char data_chunk_table_end_tag[] = "dcTE" ; -static char data_chunk_start_tag[] = "DaTa" ; -static char data_chunk_end_tag[] = "dEnD" ; - -/*********************************************************************** - Global variables: - file_in_use: Used to track the files currently in use. - 0 if file is NOT in use. - 1 if file IS in use. - first_file_in_system: If a file is opened which is a sub-tree - of a parent ADF structure, first_file_in_system is the index - of the top parent file. - ADF_FILE: The system-returned file descriptor of an opened file. - names_of_files: Names of opened files. - file_open_mode: The mode the file was opened in. - file_version_update: If library file version is greater than - file version, library file version (what-string) is temporarily - stored in this array to update to the file. The file only - needs its version updated once while open, so don't expect the - version to persist until file closing. Otherwise, the first - byte in the string is null ('\0'). -***********************************************************************/ -static unsigned char file_in_use[ MAXIMUM_FILES] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 - } ; - - /** We need to track the top file in a system so that when the - system is closed, all files associated with it can also be closed. - **/ -static int first_file_in_system[MAXIMUM_FILES] ; -static FILE *ADF_file[MAXIMUM_FILES] ; -static char names_of_files[MAXIMUM_FILES][ADF_FILENAME_LENGTH] ; -static char file_open_mode[MAXIMUM_FILES][10] ; -static char file_version_update[MAXIMUM_FILES][WHAT_STRING_SIZE+1]; - - /** Track the format of this machine as well as the format - of eack of the files. This is used for reading and - writing numeric data associated with the nodes, which may - include numeric-format translations. - **/ -static char ADF_file_format[MAXIMUM_FILES] ; -static char ADF_file_os_size[MAXIMUM_FILES] ; -static char ADF_this_machine_format = UNDEFINED_FORMAT_CHAR ; -static char ADF_this_machine_os_size = UNDEFINED_FORMAT_CHAR ; - - /** we need a block of "zz"-bytes for dead-space **/ -static char block_of_ZZ[ SMALLEST_CHUNK_SIZE ] ; -static int block_of_ZZ_initialized = FALSE ; - /** we need a block of "xx"-bytes for free-blocks **/ -static char block_of_XX[ DISK_BLOCK_SIZE ] ; -static int block_of_XX_initialized = FALSE ; - /** we need a block of null-bytes for disk conditioning **/ -static char block_of_00[ DISK_BLOCK_SIZE ] ; -static int block_of_00_initialized = FALSE ; - - /** read/write conversion buffer **/ -#define CONVERSION_BUFF_SIZE 100000 -static unsigned char from_to_data[ CONVERSION_BUFF_SIZE ] ; - - /** read/write buffering variables **/ -static char rd_block_buffer[DISK_BLOCK_SIZE] ; -static long last_rd_block = -1 ; -static long last_rd_file = -1 ; -static long num_in_rd_block = -1 ; -static char wr_block_buffer[DISK_BLOCK_SIZE] ; -static long last_wr_block = -2 ; -static long last_wr_file = -2 ; -static int flush_wr_block = -2 ; -static double last_link_ID = 0.0; -static double last_link_LID = 0.0; -enum { FLUSH, FLUSH_CLOSE }; - - /** Assumed machine variable sizes for the currently supported - machines. For ordering of data see the Figure_Machine_Format - function. Note that when openning a new file not in the machine - format these are the sizes used!! **/ -enum { TO_FILE_FORMAT, FROM_FILE_FORMAT } ; -#define NUMBER_KNOWN_MACHINES 5 -static size_t machine_sizes[NUMBER_KNOWN_MACHINES][16] = { - /* IEEE BIG 32 */ { 1, 1, 1, 2, 2, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4 }, - /* IEEE SML 32 */ { 1, 1, 1, 2, 2, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4 }, - /* IEEE BIG 64 */ { 1, 1, 1, 2, 2, 4, 4, 8, 8, 4, 8, 8, 8, 8, 8, 8 }, - /* IEEE SML 64 */ { 1, 1, 1, 2, 2, 4, 4, 8, 8, 4, 8, 8, 8, 8, 8, 8 }, - /* CRAY 64 */ { 1, 1, 1, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 } } ; - -/*********************************************************************** - pows: Powers of 16, from 16^0 to 16^7 - ASCII_Hex: Hex numbers from 0 to 15. -***********************************************************************/ -static const unsigned int pows[8] = { /** Powers of 16 **/ - 1, 16, 256, 4096, 65536, 1048576, 16777216, 268435456 } ; -static const char ASCII_Hex[16] = { - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' } ; - -/*********************************************************************** - Priority Stack Buffer is used to buffer some of the overhead of - reading small blocks of file control information like the node - header by saving the data into a memory buffer. The buffer has - a priority value associated with it and is used to determine - which entry to replace when the stack is full!! Each stack entry - could be as large as 274 bytes since the stack data could be for - a node where NODE_HEADER_SIZE = 246. -***********************************************************************/ -#define MAX_STACK 50 -static struct { - int file_index; - unsigned int file_block; - unsigned int block_offset; - int stack_type; - char *stack_data; - int priority_level; -} PRISTK[MAX_STACK] ; -static int STACK_INIT=-1; -/* Define stack types */ -enum { FILE_STK=1, NODE_STK, DISK_PTR_STK, FREE_CHUNK_STK, SUBNODE_STK }; -/* Define stack control modes */ -enum { INIT_STK, CLEAR_STK, CLEAR_STK_TYPE, DEL_STK_ENTRY, GET_STK, SET_STK }; -/*********************************************************************** - Defined macros -***********************************************************************/ -#define EVAL_2_BYTES( C0, C1 ) (((C0)<<8)+((C1))) -#define EVAL_4_BYTES( C0, C1, C2, C3 ) (((C0)<<24)+((C1)<<16)+((C2)<<8)+((C3))) -/* end of file ADFI_AAA_var.c */ -/* file ADFI_ASCII_Hex_2_unsigned_int.c */ -/*********************************************************************** -ADFI ASCII Hex to unsigned int: - Convert a number of ASCII-HEX into an unsigned integer. - -input: const unsigned int minimum Expected minimum number. -input: const unsigned int maximum Expected maximum number. -input: const unsigned int string_length Length (bytes) of the input string. -input: const char string[] The input string. -output: unsigned int *number The resulting number. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -STRING_LENGTH_ZERO -STRING_LENGTH_TOO_BIG -STRING_NOT_A_HEX_STRING -NUMBER_LESS_THAN_MINIMUM -NUMBER_GREATER_THAN_MAXIMUM -***********************************************************************/ -void ADFI_ASCII_Hex_2_unsigned_int( - const unsigned int minimum, - const unsigned int maximum, - const unsigned int string_length, - const char string[], - unsigned int *number, - int *error_return ) -{ -unsigned int i, /** Index from 0 to string_length - 1 **/ - ir, /** Index from string_length - 1 to 0 **/ - j, /** Temoprary integer variable **/ - num ; /** Working value of ther number **/ - -if( string == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( string_length == 0 ) { - *error_return = STRING_LENGTH_ZERO ; - return ; - } /* end if */ - -if( number == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( string_length > 8 ) { - *error_return = STRING_LENGTH_TOO_BIG ; - return ; - } /* end if */ - -if( minimum > maximum ) { - *error_return = MINIMUM_GT_MAXIMUM ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Convert the ASCII-Hex string into decimal **/ -num = 0 ; -#if 0 -for( i=0, ir=string_length - 1; i= '0' && string[i] <= '9') - j = string[i] - 48; - else if (string[i] >= 'A' && string[i] <= 'F') - j = string[i] - 55; - else if (string[i] >= 'a' && string[i] <= 'f') - j = string[i] - 87; - else { - *error_return = STRING_NOT_A_HEX_STRING ; - return ; - } - num += (j << ir); - ir -= 4; -} -#endif - -if( num < minimum ) { - *error_return = NUMBER_LESS_THAN_MINIMUM ; - return ; - } /* end if */ - -if( num > maximum ) { - *error_return = NUMBER_GREATER_THAN_MAXIMUM ; - return ; - } /* end if */ - - /** Return the number **/ -*number = num ; -} /* end of ADFI_ASCII_Hex_2_unsigned_int */ -/* end of file ADFI_ASCII_Hex_2_unsigned_int.c */ -/* file ADFI_Abort.c */ -/*********************************************************************** -ADFI Abort: - Do any cleanup and then shut the application down. - -input: const int error_code Error which caused the Abort. -output: -none- Hey, we ain't coming back... -***********************************************************************/ -void ADFI_Abort( - const int error_code ) -{ -fprintf(stderr,"ADF Aborted: Exiting\n" ) ; -exit( error_code ) ; -} /* end of ADFI_Abort */ -/* end of file ADFI_Abort.c */ -/* file ADFI_ID_2_file_block_offset.c */ -/*********************************************************************** -ADFI ID to file block and offset: - - The ID is a combination of the file-index, the block within the - file, and an offset within the block. - - the file index is an unsigned 16-bit int. - block pointer is a 32-bit unsigned int. - block offset is a 16-bit unsigned int. - -input: const double ID Given ADF ID. -output: unsigned int *file_index File index from the ID. -output: unsigned long *file_block File block from the ID. -output: unsigned long *block_offset Block offset from the ID. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -FILE_INDEX_OUT_OF_RANGE -BLOCK_OFFSET_OUT_OF_RANGE -***********************************************************************/ -void ADFI_ID_2_file_block_offset( - const double ID, - unsigned int *file_index, - unsigned long *file_block, - unsigned long *block_offset, - int *error_return ) -{ -unsigned char * cc; - -if( (file_index == NULL) || (file_block == NULL) || (block_offset == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( ID == 0.0 ) { - *error_return = NODE_ID_ZERO ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; -cc = (unsigned char *) &ID; -#ifdef PRINT_STUFF -printf("In ADFI_ID_2_file_block_offset: ID=%lf\n",ID); -printf("cc[0-7] = %02X %02X %02X %02X %02X %02X %02X %02X \n", - cc[0], cc[1], cc[2], cc[3], - cc[4], cc[5], cc[6], cc[7] ) ; -#endif - /** Unmap the bytes from the character **/ -if ( ADF_this_machine_format == IEEE_BIG_FORMAT_CHAR ) { - *file_index = cc[1] + ((cc[0]<<8) & 0x003f) ; - *file_block = cc[2] + (cc[3]<<8) + - (cc[4]<<16) + (cc[5]<<24) ; - *block_offset = cc[6] + (cc[7]<<8) ; - } /* end if */ -else if ( ADF_this_machine_format == IEEE_LITTLE_FORMAT_CHAR ) { - *file_index = cc[6] + ((cc[7]<<8) & 0x003f) ; - *file_block = cc[2] + (cc[3]<<8) + - (cc[4]<<16) + (cc[5]<<24) ; - *block_offset = cc[0] + (cc[1]<<8) ; - } /* end else if */ -else { - *file_index = cc[0] + (cc[1]<<8) ; - *file_block = cc[2] + (cc[3]<<8) + - (cc[4]<<16) + (cc[5]<<24) ; - *block_offset = cc[6] + (cc[7]<<8) ; - } /* end else */ - -#ifdef PRINT_STUFF - printf("*file_index=%d, *file_block=%d, *block_offset=%d\n", - *file_index, *file_block, *block_offset); -#endif - -if( *file_index >= MAXIMUM_FILES ) { - *error_return = FILE_INDEX_OUT_OF_RANGE ; - return ; - } /* end if */ - -if( *block_offset >= DISK_BLOCK_SIZE ) { - *error_return = BLOCK_OFFSET_OUT_OF_RANGE ; - return ; - } /* end if */ -} /* end of ADFI_ID_2_file_block_offset */ -/* end of file ADFI_ID_2_file_block_offset.c */ -/* file ADFI_add_2_sub_node_table.c */ -/*********************************************************************** -ADFI add 2 sub node table: - Add a child to a parent's sub-node table. - -input: const int file_index Index of ADF file. -input: const struct DISK_POINTER *parent Location of the parent -input: const struct DISK_POINTER *child Location of the child. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -SUB_NODE_TABLE_ENTRIES_BAD -MEMORY_ALLOCATION_FAILED -***********************************************************************/ -void ADFI_add_2_sub_node_table( - const int file_index, - const struct DISK_POINTER *parent, - const struct DISK_POINTER *child, - int *error_return ) -{ -struct NODE_HEADER parent_node, child_node ; -struct SUB_NODE_TABLE_ENTRY *sub_node_table ; -struct DISK_POINTER tmp_disk_ptr ; -unsigned int old_num_entries ; -int i ; - -if( (parent == NULL) || (child == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Get node_header for the node (parent) **/ -ADFI_read_node_header( file_index, parent, &parent_node, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Get node_header for the node (child) **/ -ADFI_read_node_header( file_index, child, &child_node, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Check current length of sub-node_table, add space if needed **/ -if( parent_node.entries_for_sub_nodes <= parent_node.num_sub_nodes ) { - old_num_entries = parent_node.entries_for_sub_nodes ; - - /** Increase the table space (double it) **/ - if( parent_node.entries_for_sub_nodes == 0 ) - parent_node.entries_for_sub_nodes = LIST_CHUNK ; - else - parent_node.entries_for_sub_nodes = (unsigned int) ( - (float) parent_node.entries_for_sub_nodes * LIST_CHUNK_GROW_FACTOR ) ; - - if( parent_node.entries_for_sub_nodes <= parent_node.num_sub_nodes ) { - *error_return = SUB_NODE_TABLE_ENTRIES_BAD ; - return ; - } /* end if */ - - /** Allocate memory for the required table space in memory **/ - sub_node_table = (struct SUB_NODE_TABLE_ENTRY *) - malloc( parent_node.entries_for_sub_nodes * - sizeof( *sub_node_table ) ) ; - if( sub_node_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - return ; - } /* end if */ - - /** If sub-node table exists, get it **/ - if( old_num_entries > 0 ) { - ADFI_read_sub_node_table( file_index, &parent_node.sub_node_table, - sub_node_table, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - - /** Blank out the new part of the sub-node_table **/ - for( i=parent_node.num_sub_nodes; i<(int) parent_node.entries_for_sub_nodes; - i++ ) { - strncpy( sub_node_table[i].child_name, - /* " ", ADF_NAME_LENGTH ) ; */ - "unused entry in sub-node-table ", ADF_NAME_LENGTH ) ; - sub_node_table[i].child_location.block = 0 ; - sub_node_table[i].child_location.offset = DISK_BLOCK_SIZE ; - } /* end for */ - - /** Allocate memory for the required table space on disk **/ - if( parent_node.num_sub_nodes > 0 ) { /* delete old table from file */ - ADFI_delete_sub_node_table( file_index, &parent_node.sub_node_table, - old_num_entries, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - - ADFI_file_malloc( file_index, TAG_SIZE + DISK_POINTER_SIZE + TAG_SIZE + - parent_node.entries_for_sub_nodes * (ADF_NAME_LENGTH + DISK_POINTER_SIZE), - &tmp_disk_ptr, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - parent_node.sub_node_table.block = tmp_disk_ptr.block ; - parent_node.sub_node_table.offset = tmp_disk_ptr.offset ; - - /** Write out modified sub_node_table **/ - ADFI_write_sub_node_table( file_index, &parent_node.sub_node_table, - parent_node.entries_for_sub_nodes, - (struct SUB_NODE_TABLE_ENTRY *)sub_node_table, error_return ) ; - free( sub_node_table ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - - /** Insert new entry in sub-node table **/ -tmp_disk_ptr.block = parent_node.sub_node_table.block ; -tmp_disk_ptr.offset = parent_node.sub_node_table.offset + - TAG_SIZE + DISK_POINTER_SIZE + - parent_node.num_sub_nodes * (ADF_NAME_LENGTH + DISK_POINTER_SIZE) ; - -ADFI_adjust_disk_pointer( &tmp_disk_ptr, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Write the child's name **/ -ADFI_write_file( file_index, tmp_disk_ptr.block, tmp_disk_ptr.offset, - ADF_NAME_LENGTH, child_node.name, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Write out new sub_node_table entry **/ -tmp_disk_ptr.offset += ADF_NAME_LENGTH ; -ADFI_adjust_disk_pointer( &tmp_disk_ptr, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_write_disk_pointer_2_disk( file_index, tmp_disk_ptr.block, - tmp_disk_ptr.offset, child, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Write out modified parent node-header **/ -parent_node.num_sub_nodes++ ; -ADFI_write_node_header( file_index, parent, &parent_node, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -} /* end of ADFI_add_2_sub_node_table */ -/* end of file ADFI_add_2_sub_node_table.c */ -/* file ADFI_adjust_disk_pointer.c */ -/*********************************************************************** -ADFI adjust disk pointer: - Adjust the disk pointer so that the offset is in a legal - range; from 0 and < DISK_BLOCK_SIZE. - -input: const struct DISK_POINTER *block_offset -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -BLOCK_OFFSET_OUT_OF_RANGE -***********************************************************************/ -void ADFI_adjust_disk_pointer( - struct DISK_POINTER *block_offset, - int *error_return ) -{ -unsigned long oblock ; -unsigned long nblock ; - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -if ( block_offset->offset < DISK_BLOCK_SIZE ) return ; - - /** Calculate the number of blocks in the current offset **/ -nblock = (unsigned long) (block_offset->offset / DISK_BLOCK_SIZE) ; - - /** Adjust block/offset checking for block roll-over **/ -oblock = block_offset->block ; -block_offset->block += nblock ; -block_offset->offset -= nblock * DISK_BLOCK_SIZE ; -if ( block_offset->block < oblock ) { - *error_return = BLOCK_OFFSET_OUT_OF_RANGE ; - return ; - } /* end if */ - -} /* end of ADFI_adjust_disk_pointer */ -/* end of file ADFI_adjust_disk_pointer.c */ -/* file ADFI_big_endian_32_swap_64.c */ -/*********************************************************************** -ADFI big endian 32 swap 64: - -input: const char from_format Format to convert from. 'B','L','C','N' -input: const char from_os_size Format to convert from. 'B','L' -input: const char to_format Format to convert to. -input: const char to_os_size Format to convert to. 'B','L' -input: const char data_type[2] The type of data to convert. - MT I4 I8 U4 U8 R4 R8 X4 X8 C1 B1 -input: const unsigned long delta_from_bytes Number of from_bytes used. -input: const unsigned long delta_to_bytes Number of to_bytes used. -input: const char *from_data The data to convert from. -output: char *to_data The resulting data. -output: int *error_return Error return. - - Recognized data types: - Machine representations - Type Notation IEEE_BIG IEEE_LITTLE Cray - 32 64 32 64 - No data MT - Integer 32 I4 I4 I4 I4 I4 I8 - Integer 64 I8 -- I8 -- I8 I8 - Unsigned 32 U4 I4 I4 I4 I4 I8 - Unsigned 64 U8 -- I8 -- I8 I8 - Real 32 R4 R4 R4 R4 R4 R8 - Real 64 R8 R8 R8 R8 R8 R8 - Complex 64 X4 R4R4 R4R4 R4R4 R4R4 R8R8 - Complex 128 X8 R8R8 R8R8 R8R8 R8R8 R8R8 - Character (unsigned byte) C1 C1 C1 C1 C1 C1 - Byte (unsigned byte) B1 C1 C1 C1 C1 C1 - -Machine Numeric Formats: -***IEEE_BIG (SGI-Iris Assembly Language Programmer's Guide, pages 1-2, 6-3) -I4: Byte0 Byte1 Byte2 Byte3 - MSB---------------------LSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: sign-bit, 8-bit exponent, 23-bit mantissa - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -Machine Numeric Formats: -***IEEE_LITTLE ( The backwards Big Endian ) -I4: Byte0 Byte1 Byte2 Byte3 - LSB---------------------MSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: 23-bit mantissa, 8-bit exponent, sign-bit - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: 52-bit mantissa, 11-bit exponent, sign-bit - -Note: To convert between these two formats the order of the bytes is reversed -since by definition the Big endian starts at the LSB and goes to the MSB where -the little goes form the MSB to the LSB of the word. -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_big_endian_32_swap_64( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -if ( delta_to_bytes == delta_from_bytes ) { - memcpy( to_data, from_data, delta_from_bytes ) ; - } /* end if */ -else if ( delta_from_bytes < delta_to_bytes ) { - switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - case EVAL_2_BYTES( 'I', '8' ): - if( (from_data[0] & 0x80) == 0x80 ) { /* Negative number */ - to_data[0] = 0xff ; - to_data[1] = 0xff ; - to_data[2] = 0xff ; - to_data[3] = 0xff ; - } /* end if */ - else { - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - } /* end else */ - to_data[4] = from_data[0] ; - to_data[5] = from_data[1] ; - to_data[6] = from_data[2] ; - to_data[7] = from_data[3] ; - break ; - default: - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ - } /* end else if */ -else { - switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - case EVAL_2_BYTES( 'I', '8' ): - to_data[0] = from_data[4] ; - to_data[1] = from_data[5] ; - to_data[2] = from_data[6] ; - to_data[3] = from_data[7] ; - break ; - default: - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ - } /* end else */ - -} /* end of ADFI_big_endian_32_swap_64 */ -/* end of file ADFI_big_endian_32_swap_64.c */ -/* file ADFI_big_endian_to_cray.c */ -/*********************************************************************** -ADFI big endian to cray: - -input: const char from_format Format to convert from. 'B','L','C','N' -input: const char from_os_size Format to convert from. 'B','L' -input: const char to_format Format to convert to. -input: const char to_os_size Format to convert to. 'B','L' -input: const char data_type[2] The type of data to convert. - MT I4 I8 U4 U8 R4 R8 X4 X8 C1 B1 -input: const unsigned long delta_from_bytes Number of from_bytes used. -input: const unsigned long delta_to_bytes Number of to_bytes used. -input: const char *from_data The data to convert from. -output: char *to_data The resulting data. -output: int *error_return Error return. - - Recognized data types: - Machine representations - Type Notation IEEE_BIG IEEE_LITTLE Cray - 32 64 32 64 - No data MT - Integer 32 I4 I4 I4 I4 I4 I8 - Integer 64 I8 -- I8 -- I8 I8 - Unsigned 32 U4 I4 I4 I4 I4 I8 - Unsigned 64 U8 -- I8 -- I8 I8 - Real 32 R4 R4 R4 R4 R4 R8 - Real 64 R8 R8 R8 R8 R8 R8 - Complex 64 X4 R4R4 R4R4 R4R4 R4R4 R8R8 - Complex 128 X8 R8R8 R8R8 R8R8 R8R8 R8R8 - Character (unsigned byte) C1 C1 C1 C1 C1 C1 - Byte (unsigned byte) B1 C1 C1 C1 C1 C1 - -Machine Numeric Formats: -***IEEE_BIG (SGI-Iris Assembly Language Programmer's Guide, pages 1-2, 6-3) -I4: Byte0 Byte1 Byte2 Byte3 - MSB---------------------LSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: sign-bit, 8-bit exponent, 23-bit mantissa - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -***Cray (Cray CFT77 Reference Manual, pages G-1 G-2) -I8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - MSB-----------------------------------------------------LSB -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, exponent-sign, 14-bit exponent, 48-bit mantissa -Note: Exponent sign: 1 in this bits indicates a positive exponent sign, - thus bit 62 is the inverse of bit 61 (the sign in the exponent). - The exception to this is a zero, in which all 64 bits are zero! - The interpreation of the floating-point number is: - >>> .mantissia(fraction) X 2^exponent. <<< - The mantissia is left justified (the leftmost bit is a 1). - This MUST be done! - -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_big_endian_to_cray( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ -int i, exp ; - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - - case EVAL_2_BYTES( 'M', 'T' ): - *error_return = NO_DATA ; - return ; - - case EVAL_2_BYTES( 'C', '1' ): - case EVAL_2_BYTES( 'B', '1' ): - to_data[0] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'I', '4' ): - if( (from_data[0] & 0x80) == 0x80 ) { /* Negative number */ - to_data[0] = 0xff ; - to_data[1] = 0xff ; - to_data[2] = 0xff ; - to_data[3] = 0xff ; - } /* end if */ - else { - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - } /* end else */ - to_data[4] = from_data[0] ; - to_data[5] = from_data[1] ; - to_data[6] = from_data[2] ; - to_data[7] = from_data[3] ; - break ; - - case EVAL_2_BYTES( 'U', '4' ): - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - to_data[4] = from_data[0] ; - to_data[5] = from_data[1] ; - to_data[6] = from_data[2] ; - to_data[7] = from_data[3] ; - break ; - - case EVAL_2_BYTES( 'I', '8' ): - if( (from_data[0] & 0x80) == 0x80 ) { /* Negative number */ - to_data[0] = 0xff ; - to_data[1] = 0xff ; - to_data[2] = 0xff ; - to_data[3] = 0xff ; - } /* end if */ - else { - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - } /* end else */ - for( i=0; i<(int)delta_from_bytes; i++ ) - to_data[8-delta_from_bytes+i] = from_data[i] ; - break ; - - case EVAL_2_BYTES( 'U', '8' ): - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - for( i=0; i<(int)delta_from_bytes; i++ ) - to_data[8-delta_from_bytes+i] = from_data[i] ; - break ; - - case EVAL_2_BYTES( 'R', '4' ): - for( i=0; i<8; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[0] == 0x00) && (from_data[1] == 0x00) && - (from_data[2] == 0x00) && (from_data[3] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[0] = from_data[0] & 0x80 ; - - /** Convert the exponent **/ - /** 8 bits to 14 bits. Sign extent from 8 to 14 **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = (from_data[0] & 0x3f) << 1 ; - if( (from_data[1] & 0x80) == 0x80 ) - exp += 1 ; - if( (from_data[0] & 0x40) == 0x00 ) /* set sign */ - exp -= 128 ; - exp += 2 ; - - to_data[1] = exp & 0xff ; - if( exp < 0 ) - to_data[0] |= 0x3f ; /* exponent sign 0, sign extend exponent */ - else - to_data[0] |= 0x40 ; /* exponent sign 1 */ - - /** Convert the mantissia **/ - /** 23 bits to 48 bits. Left shift 25 bits, zero fill **/ - to_data[2] = from_data[1] | 0x80 ; - to_data[3] = from_data[2] ; - to_data[4] = from_data[3] ; - break ; - - case EVAL_2_BYTES( 'R', '8' ): - for( i=0; i<8; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[0] == 0x00) && (from_data[1] == 0x00) && - (from_data[2] == 0x00) && (from_data[3] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[0] = from_data[0] & 0x80 ; - - /** Convert the exponent **/ - /** 11 bits to 14 bits. Sign extent from 11 to 14 **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = ((from_data[0] & 0x3f) << 4) + ((from_data[1]>>4)&0x0f) ; - - if( (from_data[0] & 0x40) == 0x00 ) /* set sign */ - exp -= 1024 ; - exp += 2 ; - - to_data[1] = (unsigned int)(exp & 0xff) ; - to_data[0] |= ((exp>>8) & 0x03) ; - if( exp < 0 ) - to_data[0] |= 0x3c ; /* exponent sign 0, sign extend exponent */ - else - to_data[0] |= 0x40 ; /* exponent sign 1 */ - - /** Convert the mantissia **/ - /** 52 bits to 48 bits. Use 48, drop last 4 bits **/ - to_data[2] = 0x80 | ((from_data[1]<<3)&0x78) | - ((from_data[2]>>5)&0x07) ; - for( i=3; i<8; i++ ) - to_data[i] = ((from_data[i-1]<<3)&0xF8) | - ((from_data[i]>>5)&0x07) ; -#ifdef PRINT_STUFF -printf("from:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", from_data[i] ) ; -printf("to:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", to_data[i] ) ; -printf("\n" ) ; -#endif - break ; - - case EVAL_2_BYTES( 'X', '4' ): - ADFI_big_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_big_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, &from_data[4], &to_data[8], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - case EVAL_2_BYTES( 'X', '8' ): - ADFI_big_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_big_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, &from_data[8], &to_data[8], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - default: - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ -} /* end of ADFI_big_endian_to_cray */ -/* end of file ADFI_big_endian_to_cray.c */ -/* file ADFI_big_little_endian_swap.c */ -/*********************************************************************** -ADFI big little endian swap: - -input: const char from_format Format to convert from. 'B','L','C','N' -input: const char from_os_size Format to convert from. 'B','L' -input: const char to_format Format to convert to. -input: const char to_os_size Format to convert to. 'B','L' -input: const char data_type[2] The type of data to convert. - MT I4 I8 U4 U8 R4 R8 X4 X8 C1 B1 -input: const unsigned long delta_from_bytes Number of from_bytes used. -input: const unsigned long delta_to_bytes Number of to_bytes used. -input: const char *from_data The data to convert from. -output: char *to_data The resulting data. -output: int *error_return Error return. - - Recognized data types: - Machine representations - Type Notation IEEE_BIG IEEE_LITTLE Cray - 32 64 32 64 - No data MT - Integer 32 I4 I4 I4 I4 I4 I8 - Integer 64 I8 -- I8 -- I8 I8 - Unsigned 32 U4 I4 I4 I4 I4 I8 - Unsigned 64 U8 -- I8 -- I8 I8 - Real 32 R4 R4 R4 R4 R4 R8 - Real 64 R8 R8 R8 R8 R8 R8 - Complex 64 X4 R4R4 R4R4 R4R4 R4R4 R8R8 - Complex 128 X8 R8R8 R8R8 R8R8 R8R8 R8R8 - Character (unsigned byte) C1 C1 C1 C1 C1 C1 - Byte (unsigned byte) B1 C1 C1 C1 C1 C1 - -Machine Numeric Formats: -***IEEE_BIG (SGI-Iris Assembly Language Programmer's Guide, pages 1-2, 6-3) -I4: Byte0 Byte1 Byte2 Byte3 - MSB---------------------LSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: sign-bit, 8-bit exponent, 23-bit mantissa - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -Machine Numeric Formats: -***IEEE_LITTLE ( The backwards Big Endian ) -I4: Byte0 Byte1 Byte2 Byte3 - LSB---------------------MSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: 23-bit mantissa, 8-bit exponent, sign-bit - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: 52-bit mantissa, 11-bit exponent, sign-bit - -Note: To convert between these two formats the order of the bytes is reversed -since by definition the Big endian starts at the LSB and goes to the MSB where -the little goes form the MSB to the LSB of the word. -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_big_little_endian_swap( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ -int i ; - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -if ( from_os_size != to_os_size || delta_to_bytes != delta_from_bytes ) { - *error_return = DATA_TYPE_NOT_SUPPORTED ; - return ; -} /** end if **/ - -*error_return = NO_ERROR ; - -for ( i=0; i<(int)delta_from_bytes; i++ ) - to_data[i] = from_data[delta_from_bytes-1-i] ; - -} /* end of ADFI_big_little_endian_swap */ -/* end of file ADFI_big_little_endian_swap.c */ -/* file ADFI_blank_fill_string.c */ -/*********************************************************************** -ADFI blank fill string: - -input/output: char *str The string to fill with blanks. -input: const int length The total length of the string to fill. -***********************************************************************/ -void ADFI_blank_fill_string( - char *str, - const int length ) -{ -int i ; -for( i=strlen( str ); iblock, - &block_offset->offset, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - ADFI_read_node_header( *file_index, block_offset, node_header, - error_return ) ; - return ; -} - -Link_ID = ID ; -while( done == FALSE ) { - /** Get the file, block, and offset numbers from the ID **/ - ADFI_ID_2_file_block_offset( Link_ID, file_index, &block_offset->block, - &block_offset->offset, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Get node_header for the node **/ - ADFI_read_node_header( *file_index, block_offset, node_header, - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - if( (node_header->data_type[0] == 'L') && - (node_header->data_type[1] == 'K')) { - - /** node is a link get file and path data **/ - ADF_Get_Link_Path( Link_ID, link_file, link_path, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - if( link_file[0] != '\0' ) { /* A filename is specified, open it. **/ - - /** Link_ID = root-node of the new file. - note: the file could already be opened, and may be the - current file! **/ - - ADFI_get_file_index_from_name( link_file, &found, &link_file_index, - &Link_ID, error_return ) ; - if( ! found ) { /** Not found; try to open it **/ - if (access(link_file,2)) /* check for read-only mode */ - status = "READ_ONLY"; - else /* open in same mode as current file */ - status = (char *) file_open_mode[*file_index] ; - if ( ADFI_stridx_c(status, "READ_ONLY" ) != 0 ) status="OLD" ; - ADF_Database_Open( link_file, status, "", &Link_ID, - error_return ) ; - if( *error_return != NO_ERROR ) { - *error_return = LINKED_TO_FILE_NOT_THERE ; - return ; - } /* end if */ - } /* end else */ - } /* end if */ - else { /* filename NOT specified, file must be root of link */ - ADF_Get_Node_ID( Link_ID, "/", &temp_ID, error_return ) ; - if( *error_return != NO_ERROR ) { - *error_return = LINKED_TO_FILE_NOT_THERE ; - return ; - } /* end if */ - Link_ID = temp_ID ; - } /* end else */ - - /** Get the node ID of the link to node (may be other links) **/ - ADF_Get_Node_ID( Link_ID, link_path, &temp_ID, error_return ) ; - if( *error_return == CHILD_NOT_OF_GIVEN_PARENT ) - *error_return = LINK_TARGET_NOT_THERE ; /* A better error message */ - if( *error_return != NO_ERROR ) - return ; - - Link_ID = temp_ID ; - if( ++link_depth > ADF_MAXIMUM_LINK_DEPTH ) { - *error_return = LINKS_TOO_DEEP ; - return ; - } /* end if */ - } /* end if */ - else { /** node is NOT a link **/ - done = TRUE ; - } /* end else */ - } /* end while */ - -*LID = Link_ID ; -if (Link_ID != ID) { - last_link_ID = ID; - last_link_LID = Link_ID; -} - -} /* end of ADFI_chase_link */ -/* end of file ADFI_chase_link.c */ -/* file ADFI_check_4_child_name.c */ -/*********************************************************************** -ADFI check 4 child name: - -input: const int file_index Index of ADF file. -input: const struct DISK_POINTER *parent Location of the parent -input: const char *name The name of the new child. -output: int *found 0 if NOT found, else 1. -output: struct DISK_POINTER *sub_node_entry_location -output: struct SUB_NODE_TABLE_ENTRY *sub_node_entry -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -MEMORY_ALLOCATION_FAILED -***********************************************************************/ -void ADFI_check_4_child_name( - const int file_index, - const struct DISK_POINTER *parent, - const char *name, - int *found, - struct DISK_POINTER *sub_node_entry_location, - struct SUB_NODE_TABLE_ENTRY *sub_node_entry, - int *error_return ) -{ -struct NODE_HEADER parent_node ; -struct SUB_NODE_TABLE_ENTRY *sub_node_table ; -int i ; - -if( (parent == NULL) || (found == NULL) || (sub_node_entry_location == NULL) || - (sub_node_entry == NULL ) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( name == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; -*found = 0 ; /* default to NOT found */ - - /** Get node_header for the node **/ -ADFI_read_node_header( file_index, parent, &parent_node, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Check for valid node name **/ - - /** If parent has no children, the new name MUST be NOT found **/ -if( parent_node.num_sub_nodes == 0 ) { - *found = 0 ; - return ; - } /* end if */ - - /** Allocate memory for the required table space in memory **/ -sub_node_table = (struct SUB_NODE_TABLE_ENTRY *) - malloc( parent_node.entries_for_sub_nodes * - sizeof( *sub_node_table ) ) ; -if( sub_node_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - return ; - } /* end if */ - -if( parent_node.entries_for_sub_nodes > 0 ) { - ADFI_read_sub_node_table( file_index, &parent_node.sub_node_table, - sub_node_table, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - - /** Check all names for our new name **/ -for( i=0; i<(int)parent_node.num_sub_nodes; i++ ) { - ADFI_compare_node_names( sub_node_table[i].child_name, name, - found, error_return ) ; - if( *error_return != NO_ERROR ) - break ; - if( *found == 1 ) { /* name was found, save off addresses */ - sub_node_entry_location->block = parent_node.sub_node_table.block ; - sub_node_entry_location->offset = parent_node.sub_node_table.offset + - TAG_SIZE + DISK_POINTER_SIZE + - (ADF_NAME_LENGTH + DISK_POINTER_SIZE) * i ; - - ADFI_adjust_disk_pointer( sub_node_entry_location, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Also save off the child's name **/ - strncpy( sub_node_entry->child_name, sub_node_table[i].child_name, - ADF_NAME_LENGTH ) ; - sub_node_entry->child_location.block = - sub_node_table[i].child_location.block ; - sub_node_entry->child_location.offset = - sub_node_table[i].child_location.offset ; - - /** Get out of the for loop **/ - break ; - } /* end if */ - } /* end for */ - -free( sub_node_table ) ; -} /* end of ADFI_check_4_child_name */ -/* end of file ADFI_check_4_child_name.c */ -/* file ADFI_check_string_length.c */ -/*********************************************************************** -ADFI check string length: - Check a character string for: - being a NULL pointer, - being too long, - being zero length. - -input: const char *str The input string. -input: const int max_length Maximum allowable length of the string. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -STRING_LENGTH_ZERO -STRING_LENGTH_TOO_BIG -***********************************************************************/ -void ADFI_check_string_length( - const char *str, - const int max_length, - int *error_return ) -{ -int str_length, i ; - -if( str == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -str_length = strlen( str ) ; -if( str_length == 0 ) { - *error_return = STRING_LENGTH_ZERO ; - return ; - } /* end if */ - -if( (int) strlen( str ) > max_length ) { - *error_return = STRING_LENGTH_TOO_BIG ; - return ; - } /* end if */ - - /** Check for blank string **/ -*error_return = STRING_LENGTH_ZERO ; -for( i=0; i>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -Machine Numeric Formats: -***IEEE_LITTLE ( The backwards Big Endian ) -I4: Byte0 Byte1 Byte2 Byte3 - LSB---------------------MSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: 23-bit mantissa, 8-bit exponent, sign-bit - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: 52-bit mantissa, 11-bit exponent, sign-bit - -***Cray (Cray CFT77 Reference Manual, pages G-1 G-2) -I8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - MSB-----------------------------------------------------LSB -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, exponent-sign, 14-bit exponent, 48-bit mantissa -Note: Exponent sign: 1 in this bits indicates a positive exponent sign, - thus bit 62 is the inverse of bit 61 (the sign in the exponent). - The exception to this is a zero, in which all 64 bits are zero! - The interpreation of the floating-point number is: - >>> .mantissia(fraction) X 2^exponent. <<< - The mantissia is left justified (the leftmost bit is a 1). - This MUST be done! - -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_convert_number_format( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const int convert_dir, - const struct TOKENIZED_DATA_TYPE *tokenized_data_type, - const unsigned int length, - unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ -unsigned char temp_data[16] ; -char data_type[2] ; -int current_token ; -int array_size ; -int l, s ; -unsigned long delta_from_bytes, delta_to_bytes ; - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( length == 0 ) { - *error_return = NUMBER_LESS_THAN_MINIMUM ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -switch( EVAL_4_BYTES( from_format, to_format, from_os_size, to_os_size ) ) { - case EVAL_4_BYTES( 'B', 'B', 'B', 'B' ): - case EVAL_4_BYTES( 'C', 'C', 'B', 'B' ): - case EVAL_4_BYTES( 'L', 'L', 'B', 'B' ): - case EVAL_4_BYTES( 'B', 'B', 'L', 'L' ): - case EVAL_4_BYTES( 'C', 'C', 'L', 'L' ): - case EVAL_4_BYTES( 'L', 'L', 'L', 'L' ): - *error_return = CONVERSION_FORMATS_EQUAL ; - return ; - } /* end switch */ - -*error_return = NO_ERROR ; - - /** loop over each element **/ -for ( l=0; l<(int)length; l++ ) { - current_token = -1 ; - while( tokenized_data_type[ ++current_token ].type[0] != 0 ) { - data_type[0] = tokenized_data_type[ current_token ].type[0] ; - data_type[1] = tokenized_data_type[ current_token ].type[1] ; - array_size = tokenized_data_type[ current_token ].length ; - if ( convert_dir == FROM_FILE_FORMAT ) { - delta_from_bytes=tokenized_data_type[ current_token ].file_type_size ; - delta_to_bytes =tokenized_data_type[ current_token ].machine_type_size ; - } /** end if **/ - else { - delta_to_bytes =tokenized_data_type[ current_token ].file_type_size ; - delta_from_bytes=tokenized_data_type[ current_token ].machine_type_size ; - } /** end else **/ - - for ( s=0; s 12) ) { - *error_return = BAD_NUMBER_OF_DIMENSIONS ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Chek the inputs **/ -for( i=0; i=1 **/ - if( dims[i] < 1 ) { - *error_return = BAD_DIMENSION_VALUE ; - return ; - } /* end if */ - - /** Check starting values >=1 and <= dims **/ - if( (dim_start[i] < 1) || (dim_start[i] > (int) dims[i]) ) { - *error_return = START_OUT_OF_DEFINED_RANGE ; - return ; - } /* end if */ - - /** Check ending values >=1 and <= dims and >= dim_start **/ - if( (dim_end[i] < 1) || (dim_end[i] > (int) dims[i]) ) { - *error_return = END_OUT_OF_DEFINED_RANGE ; - return ; - } /* end if */ - if( dim_end[i] < dim_start[i] ) { - *error_return = MINIMUM_GT_MAXIMUM ; - return ; - } /* end if */ - - /** Check stride >= 1 **/ - if( dim_stride[i] < 1 ) { - *error_return = BAD_STRIDE_VALUE ; - return ; - } /* end if */ - } /* end for */ - -total = 1 ; -offset = 0 ; -accumlated_size = 1 ; -for( i=0; i>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -***Cray (Cray CFT77 Reference Manual, pages G-1 G-2) -I8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - MSB-----------------------------------------------------LSB -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, exponent-sign, 14-bit exponent, 48-bit mantissa -Note: Exponent sign: 1 in this bits indicates a positive exponent sign, - thus bit 62 is the inverse of bit 61 (the sign in the exponent). - The exception to this is a zero, in which all 64 bits are zero! - The interpreation of the floating-point number is: - >>> .mantissia(fraction) X 2^exponent. <<< - The mantissia is left justified (the leftmost bit is a 1). - This MUST be done! - -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_cray_to_big_endian( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ -int i, exp ; - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - case EVAL_2_BYTES( 'M', 'T' ): - *error_return = NO_DATA ; - return ; - - case EVAL_2_BYTES( 'C', '1' ): - case EVAL_2_BYTES( 'B', '1' ): - to_data[0] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'I', '4' ): - case EVAL_2_BYTES( 'U', '4' ): - to_data[0] = from_data[4] ; - to_data[1] = from_data[5] ; - to_data[2] = from_data[6] ; - to_data[3] = from_data[7] ; - break ; - - case EVAL_2_BYTES( 'I', '8' ): - case EVAL_2_BYTES( 'U', '8' ): - for( i=0; i<(int) delta_to_bytes; i++ ) - to_data[i] = from_data[8-delta_to_bytes+i] ; - break ; - - case EVAL_2_BYTES( 'R', '4' ): - for( i=0; i<4; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[0] == 0x00) && (from_data[1] == 0x00) && - (from_data[2] == 0x00) && (from_data[3] == 0x00) && - (from_data[4] == 0x00) && (from_data[5] == 0x00) && - (from_data[6] == 0x00) && (from_data[7] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[0] = from_data[0] & 0x80 ; - - /** Convert the exponent **/ - /** 14 bits to 8 bits. Sign extent from 8 to 14 **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = from_data[1] + ((from_data[0]&0x3f)<<8) ; - if( (from_data[0] & 0x40) == 0x00 ) /* set sign */ - exp -= 16384 ; - exp -= 2 ; - - if( exp >= 128 ) { - *error_return = NUMERIC_OVERFLOW ; - return ; - } /* end if */ - else if ( exp < -128 ) { - for( i=0; i<4; i++ ) to_data[i] = 0x00 ; /* underflow set to 0 */ - break; - } /* end else */ - - to_data[0] |= ((exp&0x7F) >> 1) ; - if( (exp & 0x01) == 0x01 ) /* LSBit of the exponent */ - to_data[1] |= 0x80 ; - - if( exp >= 0 ) /* Set exponent sign */ - to_data[0] |= 0x40 ; - - /** Convert the mantissia **/ - /** 48 bits to 23 bits, skip the first '1' (2.fract) **/ - to_data[1] |= (from_data[2] & 0x7f) ; - to_data[2] = from_data[3] ; - to_data[3] = from_data[4] ; - break ; - - case EVAL_2_BYTES( 'R', '8' ): - for( i=0; i<8; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[0] == 0x00) && (from_data[1] == 0x00) && - (from_data[2] == 0x00) && (from_data[3] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[0] = from_data[0] & 0x80 ; - - /** Convert the exponent **/ - /** 14 bits to 11 bits **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = from_data[1] + ((from_data[0]&0x3f)<<8) ; - /* set sign if exponent is non-zero */ - if( (exp != 0) && ((from_data[0] & 0x40) == 0x00) ) - exp -= 16384 ; - exp -= 2 ; - - if( exp >= 1024 ) { - *error_return = NUMERIC_OVERFLOW ; - return ; - } /* end if */ - else if ( exp < -1024 ) { - for( i=0; i<4; i++ ) to_data[i] = 0x00 ; /* underflow set to 0 */ - break; - } /* end else */ - - to_data[0] |= ((exp & 0x03F0) >> 4) ; - to_data[1] |= ((exp & 0x000F) << 4) ; - - if( exp >= 0 ) /* Set exponent sign */ - to_data[0] |= 0x40 ; - - /** Convert the mantissia **/ - /** 48 bits to 52 bits, skip the first '1' (2.fract) **/ - to_data[1] |= ((from_data[2] & 0x78) >> 3) ; - for( i=2; i<7; i++ ) - to_data[i] = ((from_data[i] & 0x07) << 5) | - ((from_data[i+1] & 0xf8) >> 3) ; - to_data[7] = ((from_data[7] & 0x07) << 5) ; - -#ifdef PRINT_STUFF -printf("from:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", from_data[i] ) ; -printf("to:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", to_data[i] ) ; -printf("\n" ) ; -#endif - break ; - - case EVAL_2_BYTES( 'X', '4' ): - ADFI_cray_to_big_endian( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_cray_to_big_endian( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, &from_data[8], &to_data[4], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - case EVAL_2_BYTES( 'X', '8' ): - ADFI_cray_to_big_endian( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_cray_to_big_endian( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, &from_data[8], &to_data[8], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - default: - *error_return = INVALID_DATA_TYPE ; - return ; - - } /* end switch */ -} /* end of ADFI_cray_to_big_endian */ -/* end of file ADFI_cray_to_big_endian.c */ -/* file ADFI_cray_to_little_endian.c */ -/*********************************************************************** -ADFI cray to little endian: - -input: const char from_format Format to convert from. 'B','L','C','N' -input: const char from_os_size Format to convert from. 'B','L' -input: const char to_format Format to convert to. -input: const char to_os_size Format to convert to. 'B','L' -input: const char data_type[2] The type of data to convert. - MT I4 I8 U4 U8 R4 R8 X4 X8 C1 B1 -input: const unsigned long delta_from_bytes Number of from_bytes used. -input: const unsigned long delta_to_bytes Number of to_bytes used. -input: const char *from_data The data to convert from. -output: char *to_data The resulting data. -output: int *error_return Error return. - - Recognized data types: - Machine representations - Type Notation IEEE_BIG IEEE_L Cray - No data MT - Integer 32 I4 I4 I4 I4 I4 I8 - Integer 64 I8 -- I8 -- I8 I8 - Unsigned 32 U4 I4 I4 I4 I4 I8 - Unsigned 64 U8 -- I8 -- I8 I8 - Real 32 R4 R4 R4 R4 R4 R8 - Real 64 R8 R8 R8 R8 R8 R8 - Complex 64 X4 R4R4 R4R4 R4R4 R4R4 R8R8 - Complex 128 X8 R8R8 R8R8 R8R8 R8R8 R8R8 - Character (unsigned byte) C1 C1 C1 C1 C1 C1 - Byte (unsigned byte) B1 C1 C1 C1 C1 C1 - -Machine Numeric Formats: -***IEEE_BIG (SGI-Iris Assembly Language Programmer's Guide, pages 1-2, 6-3) -I4: Byte0 Byte1 Byte2 Byte3 - MSB---------------------LSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: sign-bit, 8-bit exponent, 23-bit mantissa - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -***Cray (Cray CFT77 Reference Manual, pages G-1 G-2) -I8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - MSB-----------------------------------------------------LSB -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, exponent-sign, 14-bit exponent, 48-bit mantissa -Note: Exponent sign: 1 in this bits indicates a positive exponent sign, - thus bit 62 is the inverse of bit 61 (the sign in the exponent). - The exception to this is a zero, in which all 64 bits are zero! - The interpreation of the floating-point number is: - >>> .mantissia(fraction) X 2^exponent. <<< - The mantissia is left justified (the leftmost bit is a 1). - This MUST be done! - -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_cray_to_little_endian( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ -int i, exp ; - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - case EVAL_2_BYTES( 'M', 'T' ): - *error_return = NO_DATA ; - return ; - - case EVAL_2_BYTES( 'C', '1' ): - case EVAL_2_BYTES( 'B', '1' ): - to_data[0] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'I', '4' ): - case EVAL_2_BYTES( 'U', '4' ): - to_data[3] = from_data[4] ; - to_data[2] = from_data[5] ; - to_data[1] = from_data[6] ; - to_data[0] = from_data[7] ; - break ; - - case EVAL_2_BYTES( 'I', '8' ): - case EVAL_2_BYTES( 'U', '8' ): - for( i=0; i<(int) delta_to_bytes; i++ ) - to_data[delta_to_bytes-1-i] = from_data[8-delta_to_bytes+i] ; - break ; - - case EVAL_2_BYTES( 'R', '4' ): - for( i=0; i<4; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[0] == 0x00) && (from_data[1] == 0x00) && - (from_data[2] == 0x00) && (from_data[3] == 0x00) && - (from_data[4] == 0x00) && (from_data[5] == 0x00) && - (from_data[6] == 0x00) && (from_data[7] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[3] = from_data[0] & 0x80 ; - - /** Convert the exponent **/ - /** 14 bits to 8 bits. Sign extent from 8 to 14 **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = from_data[1] + ((from_data[0]&0x3f)<<8) ; - if( (from_data[0] & 0x40) == 0x00 ) /* set sign */ - exp -= 16384 ; - exp -= 2 ; - - if( exp >= 128 ) { - *error_return = NUMERIC_OVERFLOW ; - return ; - } /* end if */ - else if ( exp < -128 ) { - for( i=0; i<4; i++ ) to_data[i] = 0x00 ; /* underflow set to 0 */ - break; - } /* end else */ - - to_data[3] |= ((exp&0x7F) >> 1) ; - if( (exp & 0x01) == 0x01 ) /* LSBit of the exponent */ - to_data[2] |= 0x80 ; - - if( exp >= 0 ) /* Set exponent sign */ - to_data[3] |= 0x40 ; - - /** Convert the mantissia **/ - /** 48 bits to 23 bits, skip the first '1' (2.fract) **/ - to_data[2] |= (from_data[2] & 0x7f) ; - to_data[1] = from_data[3] ; - to_data[0] = from_data[4] ; - break ; - - case EVAL_2_BYTES( 'R', '8' ): - for( i=0; i<8; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[0] == 0x00) && (from_data[1] == 0x00) && - (from_data[2] == 0x00) && (from_data[3] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[7] = from_data[0] & 0x80 ; - - /** Convert the exponent **/ - /** 14 bits to 11 bits **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = from_data[1] + ((from_data[0]&0x3f)<<8) ; - /* set sign if exponent is non-zero */ - if( (exp != 0) && ((from_data[0] & 0x40) == 0x00) ) - exp -= 16384 ; - exp -= 2 ; - - if( exp >= 1024 ) { - *error_return = NUMERIC_OVERFLOW ; - return ; - } /* end if */ - else if ( exp < -1024 ) { - for( i=0; i<4; i++ ) to_data[i] = 0x00 ; /* underflow set to 0 */ - break; - } /* end else */ - - to_data[7] |= ((exp & 0x03F0) >> 4) ; - to_data[6] |= ((exp & 0x000F) << 4) ; - - if( exp >= 0 ) /* Set exponent sign */ - to_data[7] |= 0x40 ; - - /** Convert the mantissia **/ - /** 48 bits to 52 bits, skip the first '1' (2.fract) **/ - to_data[6] |= ((from_data[2] & 0x78) >> 3) ; - for( i=2; i<7; i++ ) - to_data[7-i] = ((from_data[i] & 0x07) << 5) | - ((from_data[i+1] & 0xf8) >> 3) ; - to_data[0] = ((from_data[7] & 0x07) << 5) ; - -#ifdef PRINT_STUFF -printf("from:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", from_data[i] ) ; -printf("to:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", to_data[i] ) ; -printf("\n" ) ; -#endif - break ; - - case EVAL_2_BYTES( 'X', '4' ): - ADFI_cray_to_little_endian( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_cray_to_little_endian( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, &from_data[8], &to_data[4], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - case EVAL_2_BYTES( 'X', '8' ): - ADFI_cray_to_little_endian( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_cray_to_little_endian( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, &from_data[8], &to_data[8], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - default: - *error_return = INVALID_DATA_TYPE ; - return ; - - } /* end switch */ -} /* end of ADFI_cray_to_little_endian */ -/* end of file ADFI_cray_to_little_endian.c */ -/* file ADFI_delete_data.c */ -/*********************************************************************** -ADFI delete data: - -Deletes all data from the file for a node. - -input: const int file_index The file index. -input: const struct NODE_HEADER Node header information. -output: int *error_return Error return. -***********************************************************************/ -void ADFI_delete_data( - const int file_index, - const struct NODE_HEADER *node_header, - int *error_return ) -{ -struct DATA_CHUNK_TABLE_ENTRY *data_chunk_table ; -int i ; - -*error_return = NO_ERROR ; - -if( node_header == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -switch( node_header->number_of_data_chunks ) { -case 0 : /** No data to free, do nothing **/ - return ; - -case 1 : /** A single data-chunk to free, so free it **/ - ADFI_file_free( file_index, &node_header->data_chunks, 0, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - -default : /** Multiple data-chunks to free. Free them, - and also the data_chunk table **/ - /** Allocate memory for the required table space in memory **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( node_header->number_of_data_chunks * sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - return ; - } /* end if */ - - /** Read in the table **/ - ADFI_read_data_chunk_table( file_index, &node_header->data_chunks, - data_chunk_table, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Free each entry in the table **/ - for( i=0; i<(int)node_header->number_of_data_chunks; i++ ) { - ADFI_file_free( file_index, &data_chunk_table[i].start, - 0, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end for */ - free( data_chunk_table ) ; - ADFI_file_free( file_index, &node_header->data_chunks, 0, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - }/* end switch */ - -/** Clear all disk entries off the priority stack for file **/ -ADFI_stack_control(file_index, 0, 0, CLEAR_STK_TYPE, DISK_PTR_STK, - 0, NULL ) ; - -} /* end of ADFI_delete_data */ -/* end of file ADFI_delete_data.c */ -/* file ADFI_delete_from_sub_node_table.c */ -/*********************************************************************** -ADFI delete from sub node table: - Delete a child from a parent's sub-node table. - -input: const int file_index Index of ADF file. -input: const struct DISK_POINTER *parent Location of the parent -input: const struct DISK_POINTER *child Location of the child. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_delete_from_sub_node_table( - const int file_index, - const struct DISK_POINTER *parent, - const struct DISK_POINTER *child, - int *error_return ) -{ - -int i, found ; -struct NODE_HEADER parent_node ; -struct SUB_NODE_TABLE_ENTRY *sub_node_table ; - -if( (parent == NULL) || (child == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_read_node_header( file_index, parent, &parent_node, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -sub_node_table = (struct SUB_NODE_TABLE_ENTRY *) - malloc( parent_node.entries_for_sub_nodes * - sizeof( struct SUB_NODE_TABLE_ENTRY ) ) ; -if( sub_node_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - return ; - } /* end if */ - -ADFI_read_sub_node_table( file_index, &parent_node.sub_node_table, - sub_node_table, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Find the child in the parent's sub-node table **/ -for( i=0, found = -1 ; i<(int)parent_node.num_sub_nodes ; i++ ) { - if( child->block == sub_node_table[i].child_location.block && - child->offset == sub_node_table[i].child_location.offset ) { - found = i ; - break ; - } /* end if */ -} /* end for */ - -if( found == -1 ) { - *error_return = SUB_NODE_TABLE_ENTRIES_BAD ; - return ; -} - - /** Move the rest of the table up to fill the hole **/ -for( i=found ; i<(int) (parent_node.num_sub_nodes-1) ; i++ ) { - sub_node_table[i].child_location.block = - sub_node_table[i+1].child_location.block ; - sub_node_table[i].child_location.offset = - sub_node_table[i+1].child_location.offset ; - strncpy ( sub_node_table[i].child_name, sub_node_table[i+1].child_name, - ADF_NAME_LENGTH ) ; - } /* end for */ - -i = parent_node.num_sub_nodes - 1 ; -sub_node_table[i].child_location.block = 0 ; -sub_node_table[i].child_location.offset = 0 ; -strncpy ( sub_node_table[i].child_name, - "unused entry in sub-node-table ", ADF_NAME_LENGTH ) ; - - /** Re-write the parent's sub-node table **/ - -ADFI_write_sub_node_table( file_index, &parent_node.sub_node_table, - parent_node.entries_for_sub_nodes, - sub_node_table, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Update the sub-node count and write the parent's node-header **/ -parent_node.num_sub_nodes -= 1; -ADFI_write_node_header( file_index, parent, &parent_node, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -/** Clear all subnode/disk entries off the priority stack for file **/ -ADFI_stack_control(file_index, 0, 0, CLEAR_STK_TYPE, SUBNODE_STK, - 0, NULL ) ; -ADFI_stack_control(file_index, 0, 0, CLEAR_STK_TYPE, DISK_PTR_STK, - 0, NULL ) ; - -free(sub_node_table); - -} /* end of ADFI_delete_from_sub_node_table */ -/* end of file ADFI_delete_from_sub_node_table.c */ -/* file ADFI_delete_sub_node_table.c */ -/*********************************************************************** -ADFI delete sub node table: - Deletes a sub-node table from the file. - -input: const int file_index Index of ADF file. -input: const struct DISK_POINTER *block_offset The block & offset of - the sub node table. -input: const unsigned int size_sub_node_table Current size of the sub - node table (usually node_header.entries_for_sub_nodes). - If zero, then no action performed. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -FREE_OF_ROOT_NODE -ADF_DISK_TAG_ERROR -FREE_OF_FREE_CHUNK_TABLE -***********************************************************************/ -void ADFI_delete_sub_node_table( - const int file_index, - const struct DISK_POINTER *block_offset, - const unsigned int size_sub_node_table, - int *error_return ) -{ -unsigned int num_bytes ; - - -*error_return = NO_ERROR ; - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -if( size_sub_node_table == 0 ) - return ; /* assume nothing to delete */ - -/* calculate size */ -num_bytes = TAG_SIZE + TAG_SIZE + DISK_POINTER_SIZE + - size_sub_node_table * (ADF_NAME_LENGTH + DISK_POINTER_SIZE); - -ADFI_file_free( file_index, block_offset, num_bytes, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -/** Clear all subnode/disk entries off the priority stack for file **/ -ADFI_stack_control(file_index, 0, 0, CLEAR_STK_TYPE, SUBNODE_STK, - 0, NULL ) ; -ADFI_stack_control(file_index, 0, 0, CLEAR_STK_TYPE, DISK_PTR_STK, - 0, NULL ) ; - -} /* end of ADFI_delete_sub_node_table */ -/* end of file ADFI_delete_sub_node_table.c */ -/* file ADFI_disk_pointer_2_ASCII_Hex.c */ -/*********************************************************************** -ADFI disk pointer to ASCII Hex: - Convert a disk pointer into an ASCII-Hex representation (for disk). - -input: const struct DISK_POINTER *block_offset Disk-pointer struct. -output: char block[8] ASCII block number. -output: char offset[4] ASCII offset number. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -***********************************************************************/ -void ADFI_disk_pointer_2_ASCII_Hex( - const struct DISK_POINTER *block_offset, - char block[8], - char offset[4], - int *error_return ) -{ - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (block == NULL) || (offset == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Convert into ASCII-Hex form **/ -ADFI_unsigned_int_2_ASCII_Hex( block_offset->block, 0, MAXIMUM_32_BITS, - 8, block, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_unsigned_int_2_ASCII_Hex( block_offset->offset, 0, DISK_BLOCK_SIZE, - 4, offset, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -} /* end of ADFI_disk_pointer_2_ASCII_Hex */ -/* end of file ADFI_disk_pointer_2_ASCII_Hex.c */ -/* file ADFI_disk_pointer_from_ASCII_Hex.c */ -/*********************************************************************** -ADFI disk pointer from ASCII Hex: - Convert an ASCII-Hex representation into a disk-pointer (for memory). - -input: const char block[8] ASCII block number. -input: const char offset[4] ASCII offset number. -output: struct DISK_POINTER *block_offset Disk-pointer struct. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -***********************************************************************/ -void ADFI_disk_pointer_from_ASCII_Hex( - const char block[8], - const char offset[4], - struct DISK_POINTER *block_offset, - int *error_return ) -{ -unsigned int tmp ; - -if( (block == NULL) || (offset == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Convert into numeric form **/ -ADFI_ASCII_Hex_2_unsigned_int( 0, MAXIMUM_32_BITS, 8, block, - &tmp, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -block_offset->block = tmp ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, DISK_BLOCK_SIZE, 4, offset, - &tmp, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -block_offset->offset = tmp ; -} /* end of ADFI_disk_pointer_from_ASCII_Hex */ -/* end of file ADFI_disk_pointer_from_ASCII_Hex.c */ -/* file ADFI_evaluate_datatype.c */ -/*********************************************************************** -ADFI evaluate datatype: - -input: const int file_index The file index (0 to MAXIMUM_FILES). -input: const char *data_type. Data-type string. -output: int *file_bytes. Number of bytes used by the data type. -output: int *machine_ bytes. Number of bytes used by the data type. -output: struct TOKENIZED_DATA_TYPE *tokenized_data_type Array. -output: char *file_format The format of this file. -output: char *machine_format The format of this machine. -output: int error_return. Error return. - - Recognized data types: - Type Notation - No data MT - Integer 32 I4 - Integer 64 I8 - Unsigned 32 U4 - Unsigned 64 U8 - Real 32 R4 - Real 64 R8 - Complex 64 X4 - Complex 128 X8 - Character (unsigned byte) C1 - Link (same as C1) LK - Byte (unsigned byte) B1 - A structure is represented as the string "I4,I4,R8". - An array of 25 integers is "I4[25]". - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -DATA_TYPE_TOO_LONG -INVALID_DATA_TYPE -***********************************************************************/ -void ADFI_evaluate_datatype( - const int file_index, - const char data_type[], - int *file_bytes, - int *machine_bytes, - struct TOKENIZED_DATA_TYPE *tokenized_data_type, - char *file_format, - char *machine_format, - int *error_return ) -{ -int str_position = 0 ; -int current_token = 0 ; -int i, str_len, size_file, size_machine ; -char data_type_string[ADF_DATA_TYPE_LENGTH + 1 ] ; -struct FILE_HEADER file_header ; - -if( (file_format == NULL) || (machine_format == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (file_bytes == NULL) || (machine_bytes == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -*file_bytes = 0 ; -*machine_bytes = 0 ; -*error_return = NO_ERROR ; - - /** Return the file & machine's format info **/ -if( file_index >= MAXIMUM_FILES ) { - *error_return = FILE_INDEX_OUT_OF_RANGE ; - return ; - } /* end if */ -*file_format = ADF_file_format[file_index] ; -*machine_format = ADF_this_machine_format ; - - /** Convert blank-filled datatype into C string **/ -ADFI_string_2_C_string( data_type, ADF_DATA_TYPE_LENGTH, data_type_string, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Upper_CASE the data-type string **/ -str_len = strlen( data_type_string ) ; -if ( str_len == 0 ) { - *error_return = STRING_LENGTH_ZERO ; - return ; -} /** end if **/ -for( i=0; i= '0') && - (data_type_string[ str_position ] <= '9') ) { - array_size = array_size * 10 + - (data_type_string[ str_position ] - '0') ; - str_position += 1 ; - } /* end while */ - if( data_type_string[ str_position ] != ']' ) { - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end if */ - str_position += 1 ; - /** Check for comma between types **/ - if( data_type_string[ str_position ] == ',' ) { - str_position += 1 ; - } /* end if */ - *file_bytes = *file_bytes + size_file * array_size ; - *machine_bytes = *machine_bytes + size_machine * array_size ; - tokenized_data_type[ current_token++ ].length = array_size ; - } - break ; - - case ',' : - str_position += 1 ; - *file_bytes = *file_bytes + size_file ; - *machine_bytes = *machine_bytes + size_machine ; - break ; - - default : /** Error condition **/ - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ - } /* end while */ -tokenized_data_type[ current_token ].type[0] = 0x00 ; -tokenized_data_type[ current_token ].type[1] = 0x00 ; -tokenized_data_type[ current_token ].file_type_size = *file_bytes; -tokenized_data_type[ current_token ].machine_type_size = *machine_bytes ; -} /* end of ADFI_evaluate_datatype */ -/* end of file ADFI_evaluate_datatype.c */ -/* file ADFI_fflush_file.c */ -/*********************************************************************** -ADFI fflush file: - To flush the file output stream. - -input: const unsigned int file_index File to use. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -ADF_FILE_NOT_OPENED -FFLUSH_ERROR -***********************************************************************/ -void ADFI_fflush_file( - const unsigned int file_index, - int *error_return ) -{ - - -int iret ; - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -iret = fflush( ADF_file[ file_index ] ) ; -if( iret != 0 ) { - *error_return = FFLUSH_ERROR ; - return ; - } /* end if */ -} /* end of ADFI_fflush_file */ -/* end of file ADFI_fflush_file.c */ -/* file ADFI_figure_machine_format.c */ -/* file ADFI_figure_machine_format.c */ -/*********************************************************************** -ADFI figure machine format: - Determine if the host computer is IEEE_BIG, IEEE_LITTLE, - CRAY, or NATIVE. Once this machines format if determined, - look at the requested format. If NATIVE, use this machines - format, otherwise use the requested format. - -input: const char *format IEEE_BIG, IEEE_LITTLE, CRAY, or NATIVE. -output: const char *machine_format 'B', 'L', 'C', 'N' -output: const char *format_to_use 'B', 'L', 'C', 'N' -output: const char *os_to_use 'B', 'L' -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -***********************************************************************/ - -static unsigned char bits[NUMBER_KNOWN_MACHINES][8][8] = { - /* IEEE BIG 32 */ - /* u.i = 123456789: */ { { 0x07, 0x5B, 0xCD, 0x15, 0x00, 0x00, 0x00, 0x00 }, - /* u.i = -123456789: */ { 0xF8, 0xA4, 0x32, 0xEB, 0x00, 0x00, 0x00, 0x00 }, - /* u.l = 1234567890L: */ { 0x49, 0x96, 0x02, 0xD2, 0x00, 0x00, 0x00, 0x00 }, - /* u.l = -1234567890L: */ { 0xB6, 0x69, 0xFD, 0x2E, 0x00, 0x00, 0x00, 0x00 }, - /* u.f = 12345.6789: */ { 0x46, 0x40, 0xE6, 0xB7, 0x00, 0x00, 0x00, 0x00 }, - /* u.f = -12345.6789: */ { 0xC6, 0x40, 0xE6, 0xB7, 0x00, 0x00, 0x00, 0x00 }, - /* u.d = 12345.6789: */ { 0x40, 0xC8, 0x1C, 0xD6, 0xE6, 0x31, 0xF8, 0xA1 }, - /* u.d = -12345.6789: */ { 0xC0, 0xC8, 0x1C, 0xD6, 0xE6, 0x31, 0xF8, 0xA1 } }, - - /* IEEE LITTLE 32 */ - /* u.i = 123456789: */ { { 0x15, 0xCD, 0x5B, 0x07, 0x00, 0x00, 0x00, 0x00 }, - /* u.i = -123456789: */ { 0xEB, 0x32, 0xA4, 0xF8, 0x00, 0x00, 0x00, 0x00 }, - /* u.l = 1234567890L: */ { 0xD2, 0x02, 0x96, 0x49, 0x00, 0x00, 0x00, 0x00 }, - /* u.l = -1234567890L: */ { 0x2E, 0xFD, 0x69, 0xB6, 0x00, 0x00, 0x00, 0x00 }, - /* u.f = 12345.6789: */ { 0xB7, 0xE6, 0x40, 0x46, 0x00, 0x00, 0x00, 0x00 }, - /* u.f = -12345.6789: */ { 0xB7, 0xE6, 0x40, 0xC6, 0x00, 0x00, 0x00, 0x00 }, - /* u.d = 12345.6789: */ { 0xA1, 0xF8, 0x31, 0xE6, 0xD6, 0x1C, 0xC8, 0x40 }, - /* u.d = -12345.6789: */ { 0xA1, 0xF8, 0x31, 0xE6, 0xD6, 0x1C, 0xC8, 0xC0 } }, - - /* IEEE BIG 64 */ - /* u.i = 123456789: */ { { 0x07, 0x5B, 0xCD, 0x15, 0x00, 0x00, 0x00, 0x00 }, - /* u.i = -123456789: */ { 0xF8, 0xA4, 0x32, 0xEB, 0x00, 0x00, 0x00, 0x00 }, - /* u.l = 1234567890L: */ { 0x00, 0x00, 0x00, 0x00, 0x49, 0x96, 0x02, 0xD2 }, - /* u.l = -1234567890L: */ { 0xFF, 0xFF, 0xFF, 0xFF, 0xB6, 0x69, 0xFD, 0x2E }, - /* u.f = 12345.6789: */ { 0x46, 0x40, 0xE6, 0xB7, 0x00, 0x00, 0x00, 0x00 }, - /* u.f = -12345.6789: */ { 0xC6, 0x40, 0xE6, 0xB7, 0x00, 0x00, 0x00, 0x00 }, - /* u.d = 12345.6789: */ { 0x40, 0xC8, 0x1C, 0xD6, 0xE6, 0x31, 0xF8, 0xA1 }, - /* u.d = -12345.6789: */ { 0xC0, 0xC8, 0x1C, 0xD6, 0xE6, 0x31, 0xF8, 0xA1 } }, - - /* IEEE LITTLE 64 */ - /* u.i = 123456789: */ { { 0x15, 0xCD, 0x5B, 0x07, 0x00, 0x00, 0x00, 0x00 }, - /* u.i = -123456789: */ { 0xEB, 0x32, 0xA4, 0xF8, 0x00, 0x00, 0x00, 0x00 }, - /* u.l = 1234567890L: */ { 0xD2, 0x02, 0x96, 0x49, 0x00, 0x00, 0x00, 0x00 }, - /* u.l = -1234567890L: */ { 0x2E, 0xFD, 0x69, 0xB6, 0xFF, 0xFF, 0xFF, 0xFF }, - /* u.f = 12345.6789: */ { 0xB7, 0xE6, 0x40, 0x46, 0x00, 0x00, 0x00, 0x00 }, - /* u.f = -12345.6789: */ { 0xB7, 0xE6, 0x40, 0xC6, 0x00, 0x00, 0x00, 0x00 }, - /* u.d = 12345.6789: */ { 0xA1, 0xF8, 0x31, 0xE6, 0xD6, 0x1C, 0xC8, 0x40 }, - /* u.d = -12345.6789: */ { 0xA1, 0xF8, 0x31, 0xE6, 0xD6, 0x1C, 0xC8, 0xC0 } }, - - /* CRAY */ - /* u.i = 123456789: */ { { 0x00, 0x00, 0x00, 0x00, 0x07, 0x5B, 0xCD, 0x15 }, - /* u.i = -123456789: */ { 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xA4, 0x32, 0xEB }, - /* u.l = 1234567890L: */ { 0x00, 0x00, 0x00, 0x00, 0x49, 0x96, 0x02, 0xD2 }, - /* u.l = -1234567890L: */ { 0xFF, 0xFF, 0xFF, 0xFF, 0xB6, 0x69, 0xFD, 0x2E }, - /* u.f = 12345.6789: */ { 0x40, 0x0E, 0xC0, 0xE6, 0xB7, 0x31, 0x8F, 0xC5 }, - /* u.f = -12345.6789: */ { 0xC0, 0x0E, 0xC0, 0xE6, 0xB7, 0x31, 0x8F, 0xC5 }, - /* u.d = 12345.6789: */ { 0x40, 0x0E, 0xC0, 0xE6, 0xB7, 0x31, 0x8F, 0xC5 }, - /* u.d = -12345.6789: */ { 0xC0, 0x0E, 0xC0, 0xE6, 0xB7, 0x31, 0x8F, 0xC5 } } - } ; - -void ADFI_figure_machine_format( - const char *format, - char *machine_format, - char *format_to_use, - char *os_to_use, - int *error_return ) -{ -char requested_format, requested_os, machine_os_size ; -union { int i; long l; float f; double d; unsigned char bytes[8]; } u ; -int i, k, OK ; - -if( (machine_format == NULL) || (format_to_use == NULL) || - (os_to_use == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check requested format **/ -if( format == NULL ) { - requested_format = NATIVE_FORMAT_CHAR ; - requested_os = OS_32_BIT ; - } /* end if */ -else if( (format[0] == '\0') || (format[0] == ' ') ) { - requested_format = NATIVE_FORMAT_CHAR ; - requested_os = OS_32_BIT ; - } /* end else if */ -else if( ADFI_stridx_c( IEEE_BIG_32_FORMAT_STRING, format ) == 0 ) { - requested_format = IEEE_BIG_FORMAT_CHAR ; - requested_os = OS_32_BIT ; - } /* end else if */ -else if( ADFI_stridx_c( IEEE_LITTLE_32_FORMAT_STRING, format ) == 0 ) { - requested_format = IEEE_LITTLE_FORMAT_CHAR ; - requested_os = OS_32_BIT ; - } /* end else if */ -else if( ADFI_stridx_c( IEEE_BIG_64_FORMAT_STRING, format ) == 0 ) { - requested_format = IEEE_BIG_FORMAT_CHAR ; - requested_os = OS_64_BIT ; - } /* end else if */ -else if( ADFI_stridx_c( IEEE_LITTLE_64_FORMAT_STRING, format ) == 0 ) { - requested_format = IEEE_LITTLE_FORMAT_CHAR ; - requested_os = OS_64_BIT ; - } /* end else if */ -else if( ADFI_stridx_c( CRAY_FORMAT_STRING, format ) == 0 ) { - requested_format = CRAY_FORMAT_CHAR ; - requested_os = OS_64_BIT ; - } /* end else if */ -else if( ADFI_stridx_c( NATIVE_FORMAT_STRING, format ) == 0 ) { - requested_format = NATIVE_FORMAT_CHAR ; - requested_os = OS_32_BIT ; - } /* end else if */ -else { - *error_return = ADF_FILE_FORMAT_NOT_RECOGNIZED ; - return ; - } /* end else */ - - /***** Determine this machine's numeric format *****/ - /** Check for numeric bit patterns **/ -#define ZERO_UNION() \ - for( k=0; k<8; k++ ) \ - u.bytes[k] = '\0' ; -#define CHECK_UNION(B) \ - if( (u.bytes[0] != B[0]) || (u.bytes[1] != B[1]) || \ - (u.bytes[2] != B[2]) || (u.bytes[3] != B[3]) || \ - (u.bytes[4] != B[4]) || (u.bytes[5] != B[5]) || \ - (u.bytes[6] != B[6]) || (u.bytes[7] != B[7]) ) continue ; - -OK = FALSE ; -*machine_format = NATIVE_FORMAT_CHAR ; -for( i=0; i= 8 ) machine_os_size = OS_64_BIT ; - else machine_os_size = OS_32_BIT ; - } /* end if */ - -if( ADF_this_machine_format == UNDEFINED_FORMAT_CHAR ) { - ADF_this_machine_format = *machine_format ; - ADF_this_machine_os_size = machine_os_size ; - } /* end if */ - -if( requested_format == NATIVE_FORMAT_CHAR ) { - *format_to_use = *machine_format ; - *os_to_use = machine_os_size ; - } /* end if */ -else { - *format_to_use = requested_format ; - *os_to_use = requested_os ; - } /* end if */ - -if( *machine_format == NATIVE_FORMAT_CHAR ) - *error_return = MACHINE_FORMAT_NOT_RECOGNIZED ; - -} /* end of ADFI_figure_machine_format */ -/* end of file ADFI_figure_machine_format.c */ -/* end of file ADFI_figure_machine_format.c */ -/* file ADFI_file_and_machine_compare.c */ -/*********************************************************************** -ADFI file and machine compare: - Compares file and machine formats. - -input: const int file_index The file index (0 to MAXIMUM_FILES). -output: int *compare 1 = formats compare, 0 = do not -output: int *error_return Error return - - Possible errors: -FILE_INDEX_OUT_OF_RANGE -***********************************************************************/ -void ADFI_file_and_machine_compare( - const int file_index, - const struct TOKENIZED_DATA_TYPE *tokenized_data_type, - int *compare, - int *error_return ) -{ - int machine_size, file_size, token ; - *compare = 0 ; - *error_return = NO_ERROR ; - - if( file_index < 0 || file_index >= MAXIMUM_FILES ) { - *error_return = FILE_INDEX_OUT_OF_RANGE ; - return ; - } - - if( ADF_this_machine_format == NATIVE_FORMAT_CHAR || - ADF_file_format[file_index] == NATIVE_FORMAT_CHAR ) { - struct FILE_HEADER file_header ; - /** Get file_header for the file variable sizes **/ - ADFI_read_file_header( file_index, &file_header, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - /** Make sure the sizes are the same or we are cooked!! **/ - if ( ADF_file_format[file_index] != NATIVE_FORMAT_CHAR || - file_header.sizeof_char != sizeof( char ) || - file_header.sizeof_short != sizeof( short ) || - file_header.sizeof_int != sizeof( int ) || - file_header.sizeof_long != sizeof( long ) || - file_header.sizeof_float != sizeof( float ) || - file_header.sizeof_double != sizeof( double ) || - file_header.sizeof_char_p != sizeof( char * ) || - file_header.sizeof_short_p != sizeof( short * ) || - file_header.sizeof_int_p != sizeof( int * ) || - file_header.sizeof_long_p != sizeof( long * ) || - file_header.sizeof_float_p != sizeof( float * ) || - file_header.sizeof_double_p != sizeof( double * ) ) { - *error_return = MACHINE_FILE_INCOMPATABLE ; - return ; - } /** end if **/ - } /** end if **/ - - if( ADF_file_format[file_index] == ADF_this_machine_format && - ADF_file_os_size[file_index] == ADF_this_machine_os_size ) { - *compare = 1 ; - } else if( ADF_file_format[file_index] == ADF_this_machine_format ) { - /** If the file and machine binary type are the same and only the - sizes may be different (like long is 32 or 64), then if all the - sizes are the same then no converion is necessary and ws can avoid - the conversion overhead and just do direct read/writes. **/ - if ( tokenized_data_type == NULL ) return ; - token = -1 ; - *compare = 1 ; - do { - token++ ; - machine_size = tokenized_data_type[ token ].machine_type_size ; - file_size = tokenized_data_type[ token ].file_type_size ; - if ( machine_size != file_size ) { - *compare = 0 ; - break ; - } - } while( tokenized_data_type[ token ].type[0] != 0 ) ; - } -} /* end of ADFI_file_and_machine_compare */ -/* end of file ADFI_file_and_machine_compare.c */ -/* file ADFI_file_block_offset_2_ID.c */ -/*********************************************************************** -ADFI file block and offset to ID: - Convert an ADF file, block, and offset to an ADF ID. - -input: const int file_index The file index (0 to MAXIMUM_FILES). -input: const unsigned long file_block The block within the file. -input: const unsigned long block_offset The offset within the block. -output: double *ID The resulting ADF ID. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -FILE_INDEX_OUT_OF_RANGE -BLOCK_OFFSET_OUT_OF_RANGE -***********************************************************************/ -void ADFI_file_block_offset_2_ID( - const int file_index, - const unsigned long file_block, - const unsigned long block_offset, - double *ID, - int *error_return ) -{ -double dd; -unsigned char * cc; - -if( ID == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; -if( file_index >= MAXIMUM_FILES ) { - *error_return = FILE_INDEX_OUT_OF_RANGE ; - return ; - } /* end if */ - -if( block_offset >= DISK_BLOCK_SIZE ) { - *error_return = BLOCK_OFFSET_OUT_OF_RANGE ; - return ; - } /* end if */ - - /** Map the bytes into the character variable **/ - /* Note that there were problems with some machines flushing small numbers - to zero causing problems with the encoding of ID (which is not in - its self a true number). The IEEE standard says that this is not - allowed and so should not be a problem except that you get a major - performance hit on the machine if you have it enforce the IEEE - standard. Thus I force the sign bit on the exponent to always be positive - so that the ID is a number greater than |1|. Previously on the - IEEE big endian the numbers would look like 3.132313E-311. The - new encoding changes the max number of open files to 16K from 64K */ - -cc = (unsigned char *) ⅆ -if ( ADF_this_machine_format == IEEE_BIG_FORMAT_CHAR ) { - cc[1] = (unsigned char) (file_index & 0x00ff) ; - cc[0] = (unsigned char) (64 + (( file_index >> 8) & 0x003f)) ; - - cc[2] = (unsigned char) (file_block & 0x000000ff) ; - cc[3] = (unsigned char) ((file_block >> 8) & 0x000000ff) ; - cc[4] = (unsigned char) ((file_block >> 16) & 0x000000ff) ; - cc[5] = (unsigned char) ((file_block >> 24) & 0x000000ff) ; - - cc[6] = (unsigned char) (block_offset & 0x00ff) ; - cc[7] = (unsigned char) ((block_offset >> 8) & 0x00ff) ; - } /* end if */ -else if ( ADF_this_machine_format == IEEE_LITTLE_FORMAT_CHAR ) { - cc[6] = (unsigned char) (file_index & 0x00ff) ; - cc[7] = (unsigned char) (64 + (( file_index >> 8) & 0x003f)) ; - - cc[2] = (unsigned char) (file_block & 0x000000ff) ; - cc[3] = (unsigned char) ((file_block >> 8) & 0x000000ff) ; - cc[4] = (unsigned char) ((file_block >> 16) & 0x000000ff) ; - cc[5] = (unsigned char) ((file_block >> 24) & 0x000000ff) ; - - cc[0] = (unsigned char) (block_offset & 0x00ff) ; - cc[1] = (unsigned char) ((block_offset >> 8) & 0x00ff) ; - } /* end else if */ -else { - cc[0] = (unsigned char) (file_index & 0x00ff) ; - cc[1] = (unsigned char) ((file_index >> 8) & 0x00ff) ; - - cc[2] = (unsigned char) (file_block & 0x000000ff) ; - cc[3] = (unsigned char) ((file_block >> 8) & 0x000000ff) ; - cc[4] = (unsigned char) ((file_block >> 16) & 0x000000ff) ; - cc[5] = (unsigned char) ((file_block >> 24) & 0x000000ff) ; - - cc[6] = (unsigned char) (block_offset & 0x00ff) ; - cc[7] = (unsigned char) ((block_offset >> 8) & 0x00ff) ; - } /* end else */ - -*ID = dd; -#ifdef PRINT_STUFF -printf("cc[0-7] = %02X %02X %02X %02X %02X %02X %02X %02X \n", - cc[0], cc[1], cc[2], cc[3], - cc[4], cc[5], cc[6], cc[7] ) ; -printf("In ADFI_file_block_offset_2_ID: ID=%lf\n",*ID); -#endif - -} /* end of ADFI_file_block_offset_2_ID */ -/* end of file ADFI_file_block_offset_2_ID.c */ -/* file ADFI_file_free.c */ -/*********************************************************************** -ADFI file free: - To free-up a chunk of file space. - -input: const int file_index The file index (0 to MAXIMUM_FILES). -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const long number_of_bytes Number of bytes to free. If 0, - then look at type of chunk to get size. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -FREE_OF_ROOT_NODE -ADF_DISK_TAG_ERROR -FREE_OF_FREE_CHUNK_TABLE -***********************************************************************/ -void ADFI_file_free( - const int file_index, - const struct DISK_POINTER *block_offset, - const long in_number_of_bytes, - int *error_return ) -{ -char tag[TAG_SIZE + 1] ; -struct DISK_POINTER end_of_chunk_tag ; -struct DISK_POINTER tmp_blk_ofst ; -struct FREE_CHUNK_TABLE free_chunk_table ; -struct FREE_CHUNK free_chunk ; -int i ; -long number_of_bytes = in_number_of_bytes ; - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -if( number_of_bytes == 0 ) { - - /** Check the disk tag to see what kind of disk chunk we have. - We need this to determine the length of the chunk. **/ - ADFI_read_file( file_index, block_offset->block, block_offset->offset, - TAG_SIZE, tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - tag[TAG_SIZE] = '\0' ; /* Null terminate the string */ - - end_of_chunk_tag.block = 0 ; - end_of_chunk_tag.offset = 0 ; - if( ADFI_stridx_c( tag, node_start_tag ) == 0 ) { /** This is a node **/ - if( (block_offset->block == ROOT_NODE_BLOCK) && - (block_offset->offset == ROOT_NODE_OFFSET) ) { - *error_return = FREE_OF_ROOT_NODE ; - return ; - } /* end if */ - end_of_chunk_tag.block = block_offset->block ; - end_of_chunk_tag.offset = block_offset->offset + NODE_HEADER_SIZE - - TAG_SIZE ; - if ( end_of_chunk_tag.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } - - /** Check disk boundary-tag **/ - ADFI_read_file( file_index, end_of_chunk_tag.block, - end_of_chunk_tag.offset, TAG_SIZE, tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - if( ADFI_stridx_c( tag, node_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - } /* end if */ - else if( ADFI_stridx_c( tag, free_chunk_table_start_tag ) == 0 ) { - /** Trying to free the free-chunk-table. This is BAD. **/ - *error_return = FREE_OF_FREE_CHUNK_TABLE ; - return ; - } /* end else if */ - else if( ADFI_stridx_c( tag, free_chunk_start_tag ) == 0 ) { - - /** Set a temporary block/offset to read disk pointer **/ - tmp_blk_ofst.block = block_offset->block ; - tmp_blk_ofst.offset = block_offset->offset + TAG_SIZE ; - if ( tmp_blk_ofst.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &tmp_blk_ofst, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } - /** Get the end_of_chunk-tag block/offset from disk **/ - ADFI_read_disk_pointer_from_disk( file_index, tmp_blk_ofst.block, - tmp_blk_ofst.offset, &end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Check disk boundary-tag **/ - ADFI_read_file( file_index, end_of_chunk_tag.block, - end_of_chunk_tag.offset, TAG_SIZE, tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - if( ADFI_stridx_c( tag, free_chunk_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - } /* end else if */ - else if( ADFI_stridx_c( tag, sub_node_start_tag ) == 0 ) { - - /** Set a temporary block/offset to read disk pointer **/ - tmp_blk_ofst.block = block_offset->block ; - tmp_blk_ofst.offset = block_offset->offset + TAG_SIZE ; - if ( tmp_blk_ofst.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &tmp_blk_ofst, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } - - /** Get the end_of_chunk-tag block/offset from disk **/ - ADFI_read_disk_pointer_from_disk( file_index, tmp_blk_ofst.block, - tmp_blk_ofst.offset, &end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Check disk boundary-tag **/ - ADFI_read_file( file_index, end_of_chunk_tag.block, - end_of_chunk_tag.offset, TAG_SIZE, tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - if( ADFI_stridx_c( tag, sub_node_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - } /* end else if */ - else if( ADFI_stridx_c( tag, data_chunk_table_start_tag ) == 0 ) { - - /** Set a temporary block/offset to read disk pointer **/ - tmp_blk_ofst.block = block_offset->block ; - tmp_blk_ofst.offset = block_offset->offset + TAG_SIZE ; - if ( tmp_blk_ofst.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &tmp_blk_ofst, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } - - /** Get the end_of_chunk-tag block/offset from disk **/ - ADFI_read_disk_pointer_from_disk( file_index, tmp_blk_ofst.block, - tmp_blk_ofst.offset, &end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Check disk boundary-tag **/ - ADFI_read_file( file_index, end_of_chunk_tag.block, - end_of_chunk_tag.offset, TAG_SIZE, tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - if( ADFI_stridx_c( tag, data_chunk_table_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - } /* end else if */ - else if( ADFI_stridx_c( tag, data_chunk_start_tag ) == 0 ) { - - /** Set a temporary block/offset to read disk pointer **/ - tmp_blk_ofst.block = block_offset->block ; - tmp_blk_ofst.offset = block_offset->offset + TAG_SIZE ; - if ( tmp_blk_ofst.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &tmp_blk_ofst, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } - - /** Get the end_of_chunk-tag block/offset from disk **/ - ADFI_read_disk_pointer_from_disk( file_index, tmp_blk_ofst.block, - tmp_blk_ofst.offset, &end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Check disk boundary-tag **/ - ADFI_read_file( file_index, end_of_chunk_tag.block, - end_of_chunk_tag.offset, TAG_SIZE, tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - if( ADFI_stridx_c( tag, data_chunk_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - } /* end else if */ - else { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end else */ - number_of_bytes = (end_of_chunk_tag.block - block_offset->block) * - DISK_BLOCK_SIZE + (end_of_chunk_tag.offset - block_offset->offset + - TAG_SIZE) ; - } /* end if */ -else { /** Use the number of bytes passed in **/ - end_of_chunk_tag.block = block_offset->block ; - end_of_chunk_tag.offset = block_offset->offset + number_of_bytes - TAG_SIZE ; - ADFI_adjust_disk_pointer( &end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - -if( number_of_bytes <= SMALLEST_CHUNK_SIZE ) { /** Too small, z-gas **/ - /** Initialize the block of 'Z's **/ - if( block_of_ZZ_initialized == FALSE ) { - for( i=0; iblock, block_offset->offset, - number_of_bytes, block_of_ZZ, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ -else { /** Add this chunk to the free table **/ - /** Get the free-chunk-table **/ - ADFI_read_free_chunk_table( file_index, &free_chunk_table, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - if( block_offset->block == end_of_chunk_tag.block ) { /* small or medium */ - if( (end_of_chunk_tag.offset + TAG_SIZE - block_offset->offset) <= - SMALL_CHUNK_MAXIMUM ) { /** SMALL chunk **/ - free_chunk.end_of_chunk_tag.block = end_of_chunk_tag.block ; - free_chunk.end_of_chunk_tag.offset = end_of_chunk_tag.offset ; - free_chunk.next_chunk.block = free_chunk_table.small_first_block.block; - free_chunk.next_chunk.offset = - free_chunk_table.small_first_block.offset ; - - free_chunk_table.small_first_block.block = block_offset->block ; - free_chunk_table.small_first_block.offset = block_offset->offset ; - - /** If linked-list was empty, also point to this as the last. **/ - if( free_chunk.next_chunk.offset == BLANK_BLOCK_OFFSET ) { - free_chunk_table.small_last_block.block = block_offset->block ; - free_chunk_table.small_last_block.offset = block_offset->offset ; - } /* end if */ - } /* end if */ - else { /** MEDIUM chunk **/ - free_chunk.end_of_chunk_tag.block = end_of_chunk_tag.block ; - free_chunk.end_of_chunk_tag.offset = end_of_chunk_tag.offset ; - free_chunk.next_chunk.block = - free_chunk_table.medium_first_block.block ; - free_chunk.next_chunk.offset = - free_chunk_table.medium_first_block.offset; - - free_chunk_table.medium_first_block.block = block_offset->block ; - free_chunk_table.medium_first_block.offset = block_offset->offset ; - - /** If linked-list was empty, also point to this as the last. **/ - if( free_chunk.next_chunk.offset == BLANK_BLOCK_OFFSET ) { - free_chunk_table.medium_last_block.block = block_offset->block ; - free_chunk_table.medium_last_block.offset = block_offset->offset ; - } /* end if */ - } /* end else */ - } /* end if */ - else { /** LARGE chunk **/ - free_chunk.end_of_chunk_tag.block = end_of_chunk_tag.block ; - free_chunk.end_of_chunk_tag.offset = end_of_chunk_tag.offset ; - free_chunk.next_chunk.block = free_chunk_table.large_first_block.block; - free_chunk.next_chunk.offset = - free_chunk_table.large_first_block.offset ; - - free_chunk_table.large_first_block.block = block_offset->block ; - free_chunk_table.large_first_block.offset = block_offset->offset ; - - /** If linked-list was empty, also point to this as the last. **/ - if( free_chunk.next_chunk.offset == BLANK_BLOCK_OFFSET ) { - free_chunk_table.large_last_block.block = block_offset->block ; - free_chunk_table.large_last_block.offset = block_offset->offset ; - } /* end if */ - } /* end else */ - - /** Put the free-chunk tags in place **/ - strncpy( free_chunk.start_tag, free_chunk_start_tag, TAG_SIZE ) ; - strncpy( free_chunk.end_tag, free_chunk_end_tag, TAG_SIZE ) ; - - /** Write out the free chunk **/ - ADFI_write_free_chunk( file_index, block_offset, &free_chunk, error_return ); - if( *error_return != NO_ERROR ) - return ; - /** Update the free-chunk-table **/ - ADFI_write_free_chunk_table( file_index, &free_chunk_table, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - - /** Delete the block/offset off the stack **/ - ADFI_stack_control(file_index, block_offset->block, block_offset->offset, - DEL_STK_ENTRY, 0, 0, NULL ) ; - -} /* end of ADFI_file_free */ -/* end of file ADFI_file_free.c */ -/* file ADFI_file_malloc.c */ -/*********************************************************************** -ADFI file malloc: - To allocate a chunk of disk space. - -input: const int file_index The file index (0 to MAXIMUM_FILES). -input: size_bytes The size in bytes to allocate. -output: const struct DISK_POINTER *block_offset Block & offset in the file. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_file_malloc( - const int file_index, - const long size_bytes, - struct DISK_POINTER *block_offset, - int *error_return ) -{ -struct FILE_HEADER file_header ; -struct FREE_CHUNK_TABLE free_chunk_table ; -struct DISK_POINTER disk_pointer, previous_disk_pointer ; -struct DISK_POINTER *first_free_block, *last_free_block ; -struct FREE_CHUNK free_chunk, previous_free_chunk ; -int i ; -int memory_found = FALSE ; -unsigned long size ; - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - - /** Get the free-chunk_table **/ -ADFI_read_free_chunk_table( file_index, &free_chunk_table, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Look for the needed space in the 3 free lists. - Note that all file control headers are smaller than - the SMALLEST_CHUNK_SIZE and so will be fit later into - a block at the end of the file. This greatly improves - node creation efficiency. **/ -for( i=0; i<3; i++ ) { - if( memory_found == TRUE || size_bytes <= SMALLEST_CHUNK_SIZE ) - break ; - ADFI_set_blank_disk_pointer( &previous_disk_pointer ) ; - switch( i ) { - case 0: /** SMALL CHUNKS **/ - if( size_bytes > SMALL_CHUNK_MAXIMUM ) - continue ; /** Next in the for loop **/ - first_free_block = &free_chunk_table.small_first_block ; - last_free_block = &free_chunk_table.small_last_block ; - break ; - case 1: /** MEDIUM CHUNKS **/ - if( size_bytes > MEDIUM_CHUNK_MAXIMUM ) - continue ; /** Next in the for loop **/ - first_free_block = &free_chunk_table.medium_first_block ; - last_free_block = &free_chunk_table.medium_last_block ; - break ; - case 2: /** LARGE CHUNKS **/ - first_free_block = &free_chunk_table.large_first_block ; - last_free_block = &free_chunk_table.large_last_block ; - break ; - } /* end switch */ - - disk_pointer = *first_free_block ; - while( (memory_found != TRUE) && - ((disk_pointer.block != BLANK_FILE_BLOCK) || - (disk_pointer.offset != BLANK_BLOCK_OFFSET)) ) { - ADFI_read_free_chunk( file_index, &disk_pointer, &free_chunk, - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - size = (free_chunk.end_of_chunk_tag.block - disk_pointer.block) * - DISK_BLOCK_SIZE + - (free_chunk.end_of_chunk_tag.offset - disk_pointer.offset) + - TAG_SIZE ; - if( (long int) size >= size_bytes ) { - *block_offset = disk_pointer ; - if( (previous_disk_pointer.block != BLANK_FILE_BLOCK) || - (previous_disk_pointer.offset != BLANK_BLOCK_OFFSET) ) { - - /** Link previous free-chunk to the next free-chunk, - removing this free-chunk from the list - **/ - ADFI_read_free_chunk( file_index, &previous_disk_pointer, - &previous_free_chunk, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - previous_free_chunk.next_chunk = free_chunk.next_chunk ; - ADFI_write_free_chunk( file_index, &previous_disk_pointer, - &previous_free_chunk, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - else { - - /** Free-chunk was the first one, change entry in the free-chunk-header **/ - *first_free_block = free_chunk.next_chunk ; - ADFI_write_free_chunk_table( file_index, &free_chunk_table, - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - - if((last_free_block->block == disk_pointer.block) && - (last_free_block->offset == disk_pointer.offset)){ - if( (previous_disk_pointer.block != BLANK_FILE_BLOCK) || - (previous_disk_pointer.offset != BLANK_BLOCK_OFFSET) ) { - *last_free_block = previous_disk_pointer ; - } /* end if */ - else { - ADFI_set_blank_disk_pointer( last_free_block ) ; - } /* end else */ - ADFI_write_free_chunk_table( file_index, &free_chunk_table, - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - - size -= size_bytes ; - if ( size > 0 ) { - disk_pointer.offset += size_bytes ; - ADFI_adjust_disk_pointer( &disk_pointer, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - ADFI_file_free( file_index, &disk_pointer, size, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } - memory_found = TRUE ; - } /* end if */ - else { - previous_disk_pointer = disk_pointer ; - disk_pointer = free_chunk.next_chunk ; - } /* end else */ - } /* end while */ - } /* end if */ - - /** The end-of_file pointer points to the last byte USED, - NOT the next byte TO USE. - **/ -if( memory_found != TRUE ) { /* Append memory at end of file **/ - ADFI_read_file_header( file_index, &file_header, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - /** If the end-of_file is NOT at a block boundary, then - see if the new allocated chunk will span a block boundary. - If it will, then start at the new block if it will fit within - the block. This helps efficiency to have file control headers - located within a block boundry. - **/ - if( file_header.end_of_file.offset != DISK_BLOCK_SIZE - 1 ) { - if( (file_header.end_of_file.offset+size_bytes) >= DISK_BLOCK_SIZE && - size_bytes <= DISK_BLOCK_SIZE ) { - /** Free rest of block, allocate from next block **/ - file_header.end_of_file.offset++ ; - ADFI_file_free( file_index, &file_header.end_of_file, - DISK_BLOCK_SIZE - file_header.end_of_file.offset, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - block_offset->block = file_header.end_of_file.block + 1 ; - block_offset->offset = 0 ; - file_header.end_of_file.block++ ; - file_header.end_of_file.offset = size_bytes - 1 ; - ADFI_adjust_disk_pointer( &file_header.end_of_file, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - } /* end if */ - else { /** Use the remaining block **/ - block_offset->block = file_header.end_of_file.block ; - block_offset->offset = file_header.end_of_file.offset + 1 ; - file_header.end_of_file.offset += size_bytes ; - ADFI_adjust_disk_pointer( &file_header.end_of_file, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - } /* end if */ - else { /* already pointing to start of block **/ - block_offset->block = file_header.end_of_file.block + 1 ; - block_offset->offset = 0 ; - file_header.end_of_file.block++ ; - file_header.end_of_file.offset = size_bytes - 1 ; - ADFI_adjust_disk_pointer( &file_header.end_of_file, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - - - /** Write out the modified file header **/ - ADFI_write_file_header( file_index, &file_header, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - -} /* end of ADFI_file_malloc */ -/* end of file ADFI_file_malloc.c */ -/* file ADFI_fill_initial_file_header.c */ -/*********************************************************************** -ADFI fill initial file header: - To determine the file header information... - -input: const char format 'B', 'L', 'C', 'N' -input: const char os_size 'B', 'L' -input: const char *what_string UNIX "what" identifier. -output: struct FILE_HEADER *file_header The resulting file header information. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -ADF_FILE_FORMAT_NOT_RECOGNIZED -***********************************************************************/ -void ADFI_fill_initial_file_header( - const char format, - const char os_size, - const char *what_string, - struct FILE_HEADER *file_header, - int *error_return ) -{ -int i ; - -if( what_string == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_header == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (format != IEEE_BIG_FORMAT_CHAR) && (format != IEEE_LITTLE_FORMAT_CHAR) && - (format != CRAY_FORMAT_CHAR) && (format != NATIVE_FORMAT_CHAR) ) { - *error_return = ADF_FILE_FORMAT_NOT_RECOGNIZED ; - return ; - } /* end if */ - - /** Put the boundary tags in first. If we then overwrite them, we'll know **/ -strncpy( file_header->tag0, file_header_tags[0], TAG_SIZE ) ; -strncpy( file_header->tag1, file_header_tags[1], TAG_SIZE ) ; -strncpy( file_header->tag2, file_header_tags[2], TAG_SIZE ) ; -strncpy( file_header->tag3, file_header_tags[3], TAG_SIZE ) ; -strncpy( file_header->tag4, file_header_tags[4], TAG_SIZE ) ; -strncpy( file_header->tag5, file_header_tags[5], TAG_SIZE ) ; - - /** The UNIX "what" string" - blank terminated **/ -strncpy( file_header->what, what_string, WHAT_STRING_SIZE ) ; -if ( strlen(what_string) < WHAT_STRING_SIZE ) -{ - ADFI_blank_fill_string ( file_header->what, WHAT_STRING_SIZE ) ; -} - - /** File creation date/time - blank terminated **/ -ADFI_get_current_date( file_header->creation_date ) ; - - /** File modification date/time - same as creation time **/ -strncpy( file_header->modification_date, file_header->creation_date, - DATE_TIME_SIZE ) ; - -file_header->numeric_format = format ; -file_header->os_size = os_size ; - - /** Set sizeof() information for file data **/ -if( (format==ADF_this_machine_format && os_size==ADF_this_machine_os_size) || - format==NATIVE_FORMAT_CHAR ) -{ - file_header->sizeof_char = sizeof( char ) ; - file_header->sizeof_short = sizeof( short ) ; - file_header->sizeof_int = sizeof( int ) ; - file_header->sizeof_long = sizeof( long ) ; - file_header->sizeof_float = sizeof( float ) ; - file_header->sizeof_double = sizeof( double ) ; - file_header->sizeof_char_p = sizeof( char * ) ; - file_header->sizeof_short_p = sizeof( short * ) ; - file_header->sizeof_int_p = sizeof( int * ) ; - file_header->sizeof_long_p = sizeof( long * ) ; - file_header->sizeof_float_p = sizeof( float * ) ; - file_header->sizeof_double_p = sizeof( double * ) ; -} /** end if **/ -else -{ - switch( EVAL_2_BYTES( format, os_size ) ) { - case EVAL_2_BYTES( 'B', 'L' ): - i = IEEE_BIG_32_FORMAT - 1 ; - break ; - case EVAL_2_BYTES( 'L', 'L' ): - i = IEEE_LITTLE_32_FORMAT - 1 ; - break ; - case EVAL_2_BYTES( 'B', 'B' ): - i = IEEE_BIG_64_FORMAT - 1 ; - break ; - case EVAL_2_BYTES( 'L', 'B' ): - i = IEEE_LITTLE_64_FORMAT - 1 ; - break ; - case EVAL_2_BYTES( 'C', 'B' ): - i = CRAY_FORMAT - 1 ; - break ; - default: - *error_return = MACHINE_FORMAT_NOT_RECOGNIZED ; - return ; - } /* end switch */ - - file_header->sizeof_char = machine_sizes[i][ 0] ; - file_header->sizeof_short = machine_sizes[i][ 3] ; - file_header->sizeof_int = machine_sizes[i][ 5] ; - file_header->sizeof_long = machine_sizes[i][ 7] ; - file_header->sizeof_float = machine_sizes[i][ 9] ; - file_header->sizeof_double = machine_sizes[i][10] ; - file_header->sizeof_char_p = machine_sizes[i][11] ; - file_header->sizeof_short_p = machine_sizes[i][12] ; - file_header->sizeof_int_p = machine_sizes[i][12] ; - file_header->sizeof_long_p = machine_sizes[i][13] ; - file_header->sizeof_float_p = machine_sizes[i][14] ; - file_header->sizeof_double_p = machine_sizes[i][15] ; -} /** end else **/ - - /** Set root node table pointers **/ -file_header->root_node.block = ROOT_NODE_BLOCK ; -file_header->root_node.offset = ROOT_NODE_OFFSET ; -file_header->end_of_file.block = ROOT_NODE_BLOCK ; -file_header->end_of_file.offset = ROOT_NODE_OFFSET + NODE_HEADER_SIZE - 1 ; -file_header->free_chunks.block = FREE_CHUNKS_BLOCK ; -file_header->free_chunks.offset = FREE_CHUNKS_OFFSET ; -ADFI_set_blank_disk_pointer( &file_header->extra ) ; - -} /* end of ADFI_fill_initial_file_header */ -/* end of file ADFI_fill_initial_file_header.c */ -/* file ADFI_fill_initial_free_chunk_table.c */ -/*********************************************************************** -ADFI fill initial free chunk header: - To fill out a new free chunk header. - -output: struct FREE_CHUNK_TABLE *free_chunk_table Resulting header info. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -***********************************************************************/ -void ADFI_fill_initial_free_chunk_table( - struct FREE_CHUNK_TABLE *free_chunk_table, - int *error_return ) -{ - -if( free_chunk_table == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -strncpy( free_chunk_table->start_tag, free_chunk_table_start_tag, TAG_SIZE ) ; -strncpy( free_chunk_table->end_tag, free_chunk_table_end_tag, TAG_SIZE ) ; - - /** Small: First and Last Blocks **/ -ADFI_set_blank_disk_pointer( &free_chunk_table->small_first_block ) ; -ADFI_set_blank_disk_pointer( &free_chunk_table->small_last_block ) ; - - /** Medium: First and Last Blocks **/ -ADFI_set_blank_disk_pointer( &free_chunk_table->medium_first_block ) ; -ADFI_set_blank_disk_pointer( &free_chunk_table->medium_last_block ) ; - - /** large: First and Last Blocks **/ -ADFI_set_blank_disk_pointer( &free_chunk_table->large_first_block ) ; -ADFI_set_blank_disk_pointer( &free_chunk_table->large_last_block ) ; -} /* end of ADFI_fill_initial_free_chunk_table */ -/* end of file ADFI_fill_initial_free_chunk_table.c */ -/* file ADFI_fill_initial_node_header.c */ -/*********************************************************************** -ADFI fill initial node header: - To fill out a new node header. - -output: struct NODE_HEADER *node_header The resulting node header information. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -***********************************************************************/ -void ADFI_fill_initial_node_header( - struct NODE_HEADER *node_header, - int *error_return ) -{ -int i ; - -if( node_header == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -strncpy( node_header->node_start_tag, node_start_tag, TAG_SIZE ) ; -strncpy( node_header->node_end_tag, node_end_tag, TAG_SIZE ) ; - - /** Blank out the name **/ -for( i=0; iname[i] = ' ' ; - - /** Blank out the label **/ -for( i=0; ilabel[i] = ' ' ; - - /** Set number of sub nodes to zero **/ -node_header->num_sub_nodes = 0 ; -node_header->entries_for_sub_nodes = 0 ; -ADFI_set_blank_disk_pointer( &node_header->sub_node_table ) ; - - /** Blank out the Data-Type, then set to eMpTy. **/ -for( i=2; idata_type[i] = ' ' ; -node_header->data_type[0] = 'M' ; -node_header->data_type[1] = 'T' ; - - - /** Zero out number of dimensions & Set dimension values to zero **/ -node_header->number_of_dimensions = 0 ; -for( i=0; idimension_values[i] = 0 ; - - /** Set number of data chunks to zero, zero out data chunk pointer **/ -node_header->number_of_data_chunks = 0 ; -ADFI_set_blank_disk_pointer( &node_header->data_chunks ) ; -} /* end of ADFI_fill_initial_node_header */ -/* end of file ADFI_fill_initial_node_header.c */ -/* file ADFI_flush_buffers.c */ -/*********************************************************************** -ADFI Flush buffers: - -input: const unsigned int file_index The file index. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -ADF_FILE_NOT_OPENED -FWRITE_ERROR -***********************************************************************/ -void ADFI_flush_buffers( - const unsigned int file_index, - int flush_mode, - int *error_return ) -{ -char data; - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; -} /* end if */ - -*error_return = NO_ERROR ; - -if ( (long int) file_index == last_wr_file ) { - /** Flush any active write buffer, file block is set to a nonsense - value so that the buffer flags are not reset **/ - ADFI_write_file ( file_index, MAXIMUM_32_BITS, 0, 0, &data, error_return ) ; - /** Reset control flags **/ - if ( flush_mode == FLUSH_CLOSE ) - last_wr_block = last_wr_file = flush_wr_block = -2 ; -} - -if ( (long int) file_index == last_rd_file && flush_mode == FLUSH_CLOSE ) { - /** Reset control flags **/ - last_rd_block = last_rd_file = num_in_rd_block = -1 ; -} - -} /* end of ADFI_flush_buffers */ -/* end of file ADFI_flush_buffers.c */ -/* file ADFI_fseek_file.c */ -/*********************************************************************** -ADFI_fseek_file: - To position the current position for fread() or fwrite(). - Need to allow for files larger than what a long int can - represent (the offset for fseek). - -input: const unsigned int file_index File to use. -input: const unsigned long file_block Block within the file. -input: const unsigned long block_offset Offset within the block. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -ADF_FILE_NOT_OPENED -FSEEK_ERROR -***********************************************************************/ -void ADFI_fseek_file( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - int *error_return ) -{ -off_t offset ; -int iret ; - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -offset = file_block * DISK_BLOCK_SIZE + block_offset ; -iret = fseek( ADF_file[ file_index ], offset, SEEK_SET ) ; -if( iret != 0 ) { - *error_return = FSEEK_ERROR ; - return ; - } /* end if */ -} /* end of ADFI_fseek_file */ -/* end of file ADFI_fseek_file.c */ -/* file ADFI_get_current_date.c */ -/*********************************************************************** -ADFI get current date: - Returns the current date and time in a blank-filled character array. - -output: char date[] Current date/time in an array blank-filled - to DATE_TIME_SIZE. Array must be allocated - to at least DATE_TIME_SIZE. No null added. - -***********************************************************************/ -void ADFI_get_current_date( - char date[] ) -{ -time_t ct ; -int i_len ; -char *current_time_p ; - - - /** get the current time **/ -ct = time( (time_t *)NULL ) ; -current_time_p = ctime( &ct ) ; - - /** remove '\n' from ctime format **/ -i_len = strcspn ( current_time_p, "\n" ) ; -strcpy( date, current_time_p ) ; -date[i_len] = '\0' ; - - /** blank fill **/ -ADFI_blank_fill_string ( date, DATE_TIME_SIZE ) ; - -} /* end of ADFI_get_current_date */ -/* end of file ADFI_get_current_date.c */ -/* file ADFI_get_direct_children_ids.c */ -/*********************************************************************** -ADFI get direct children ids: - -Get Children ids of a Node. Return the ids of children nodes directly -associated with a parent node (no links are followed). The ids of the -children are NOT guaranteed to be returned in any particular order. -If it is desired to follow potential links for the node ID, then -call ADFI_chase_link() and pass the resultant link ID to this function. -NOTE: link nodes do not have direct children. - - -ADFI_get_direct_children_ids( ID, num_ids, ids, error_return ) -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *node_block_offset Block & offset in file. -output: int *num_ids The number of ids returned. -output: double **ids An allocated array of ids (free this space). -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -MEMORY_ALLOCATION_FAILED -FILE_INDEX_OUT_OF_RANGE -BLOCK_OFFSET_OUT_OF_RANGE -ADF_FILE_NOT_OPENED -ADF_DISK_TAG_ERROR -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_get_direct_children_ids( - const unsigned int file_index, - const struct DISK_POINTER *node_block_offset, - int *num_ids, - double **ids, - int *error_return ) -{ -int i ; -struct DISK_POINTER sub_node_block_offset ; -struct NODE_HEADER node ; -struct SUB_NODE_TABLE_ENTRY sub_node_table_entry ; - -*error_return = NO_ERROR ; - -if( num_ids == NULL || ids == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -*num_ids = 0 ; -*ids = NULL ; - -ADFI_read_node_header( file_index, node_block_offset, &node, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Check for zero children, return if 0 **/ -if( node.num_sub_nodes == 0 ) { - return ; - } /* end if */ - -*ids = (double *) malloc ( node.num_sub_nodes * sizeof(double) ) ; -if( *ids == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - return ; - } /* end if */ - - /** point to the first child **/ -sub_node_block_offset.block = node.sub_node_table.block ; -sub_node_block_offset.offset = node.sub_node_table.offset + - (TAG_SIZE + DISK_POINTER_SIZE ) ; - - /** Return the ids for all the children **/ -*num_ids = node.num_sub_nodes ; -for( i=0; i< *num_ids; i++ ) { - ADFI_adjust_disk_pointer( &sub_node_block_offset, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Read one sub-node table entry **/ - ADFI_read_sub_node_table_entry( file_index, &sub_node_block_offset, - &sub_node_table_entry, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Get the ID from the sub-node table **/ - ADFI_file_block_offset_2_ID( file_index, - sub_node_table_entry.child_location.block, - sub_node_table_entry.child_location.offset, &(*ids)[i], - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Increment the disk-pointer **/ - sub_node_block_offset.offset += (ADF_NAME_LENGTH + DISK_POINTER_SIZE) ; - } /* end for */ -} -/* end of file ADFI_get_direct_children_ids.c */ -/* file ADFI_get_file_index_from_name.c */ -/*********************************************************************** -ADFI get file index from name: - -Searches file list for given name. Returns file index and Root ID -if name is found in list. - -input: const char *file_name Name of file -output: int *found 1 = name found, 0 = not found -output: unsigned int *file_index File-index -output: double *ID ID of files root node -output: int *error_return Error return -***********************************************************************/ -void ADFI_get_file_index_from_name( - const char *file_name, - int *found, - unsigned int *file_index, - double *ID, - int *error_return ) -{ -double root_ID ; -int i ; - - -*error_return = NO_ERROR ; -*found = 0; - -if( (file_index == NULL) || (ID == NULL) || (found == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_name == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -for( i=0; i 12) ) { - *error_return = BAD_NUMBER_OF_DIMENSIONS ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -offset = 0 ; -accumlated_size = 1 ; -for( i=0; (unsigned)i>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -Machine Numeric Formats: -***IEEE_LITTLE ( The backwards Big Endian ) -I4: Byte0 Byte1 Byte2 Byte3 - LSB---------------------MSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: 23-bit mantissa, 8-bit exponent, sign-bit - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: 52-bit mantissa, 11-bit exponent, sign-bit - -Note: To convert between these two formats the order of the bytes is reversed -since by definition the Big endian starts at the LSB and goes to the MSB where -the little goes form the MSB to the LSB of the word. -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_little_endian_32_swap_64( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -if ( delta_to_bytes == delta_from_bytes ) { - memcpy( to_data, from_data, delta_from_bytes ) ; - } /* end if */ -else if ( delta_from_bytes < delta_to_bytes ) { - switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - case EVAL_2_BYTES( 'I', '8' ): - if( (from_data[3] & 0x80) == 0x80 ) { /* Negative number */ - to_data[7] = 0xff ; - to_data[6] = 0xff ; - to_data[5] = 0xff ; - to_data[4] = 0xff ; - } /* end if */ - else { - to_data[7] = 0x00 ; - to_data[6] = 0x00 ; - to_data[5] = 0x00 ; - to_data[4] = 0x00 ; - } /* end else */ - to_data[3] = from_data[3] ; - to_data[2] = from_data[2] ; - to_data[1] = from_data[1] ; - to_data[0] = from_data[0] ; - break ; - default: - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ - } /* end else if */ -else { - switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - case EVAL_2_BYTES( 'I', '8' ): - to_data[3] = from_data[3] ; - to_data[2] = from_data[2] ; - to_data[1] = from_data[1] ; - to_data[0] = from_data[0] ; - break ; - default: - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ - } /* end else */ - -} /* end of ADFI_little_endian_32_swap_64 */ -/* end of file ADFI_little_endian_32_swap_64.c */ -/* file ADFI_little_endian_to_cray.c */ -/*********************************************************************** -ADFI little endian to cray: - -input: const char from_format Format to convert from. 'B','L','C','N' -input: const char from_os_size Format to convert from. 'B','L' -input: const char to_format Format to convert to. -input: const char to_os_size Format to convert to. 'B','L' -input: const char data_type[2] The type of data to convert. - MT I4 I8 U4 U8 R4 R8 X4 X8 C1 B1 -input: const unsigned long delta_from_bytes Number of from_bytes used. -input: const unsigned long delta_to_bytes Number of to_bytes used. -input: const char *from_data The data to convert from. -output: char *to_data The resulting data. -output: int *error_return Error return. - - Recognized data types: - Machine representations - Type Notation IEEE_BIG IEEE_LITTLE Cray - 32 64 32 64 - No data MT - Integer 32 I4 I4 I4 I4 I4 I8 - Integer 64 I8 -- I8 -- I8 I8 - Unsigned 32 U4 I4 I4 I4 I4 I8 - Unsigned 64 U8 -- I8 -- I8 I8 - Real 32 R4 R4 R4 R4 R4 R8 - Real 64 R8 R8 R8 R8 R8 R8 - Complex 64 X4 R4R4 R4R4 R4R4 R4R4 R8R8 - Complex 128 X8 R8R8 R8R8 R8R8 R8R8 R8R8 - Character (unsigned byte) C1 C1 C1 C1 C1 C1 - Byte (unsigned byte) B1 C1 C1 C1 C1 C1 - -Machine Numeric Formats: -***IEEE_BIG (SGI-Iris Assembly Language Programmer's Guide, pages 1-2, 6-3) -I4: Byte0 Byte1 Byte2 Byte3 - MSB---------------------LSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: sign-bit, 8-bit exponent, 23-bit mantissa - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -***Cray (Cray CFT77 Reference Manual, pages G-1 G-2) -I8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - MSB-----------------------------------------------------LSB -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, exponent-sign, 14-bit exponent, 48-bit mantissa -Note: Exponent sign: 1 in this bits indicates a positive exponent sign, - thus bit 62 is the inverse of bit 61 (the sign in the exponent). - The exception to this is a zero, in which all 64 bits are zero! - The interpreation of the floating-point number is: - >>> .mantissia(fraction) X 2^exponent. <<< - The mantissia is left justified (the leftmost bit is a 1). - This MUST be done! - -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_little_endian_to_cray( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ -int i, exp ; - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - - case EVAL_2_BYTES( 'M', 'T' ): - *error_return = NO_DATA ; - return ; - - case EVAL_2_BYTES( 'C', '1' ): - case EVAL_2_BYTES( 'B', '1' ): - to_data[0] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'I', '4' ): - if( (from_data[3] & 0x80) == 0x80 ) { /* Negative number */ - to_data[0] = 0xff ; - to_data[1] = 0xff ; - to_data[2] = 0xff ; - to_data[3] = 0xff ; - } /* end if */ - else { - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - } /* end else */ - to_data[4] = from_data[3] ; - to_data[5] = from_data[2] ; - to_data[6] = from_data[1] ; - to_data[7] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'U', '4' ): - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - to_data[4] = from_data[3] ; - to_data[5] = from_data[2] ; - to_data[6] = from_data[1] ; - to_data[7] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'I', '8' ): - if( (from_data[3] & 0x80) == 0x80 ) { /* Negative number */ - to_data[0] = 0xff ; - to_data[1] = 0xff ; - to_data[2] = 0xff ; - to_data[3] = 0xff ; - } /* end if */ - else { - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - } /* end else */ - for( i=0; i<(int)delta_from_bytes; i++ ) - to_data[8-delta_from_bytes+i] = from_data[delta_from_bytes-1-i] ; - break ; - - case EVAL_2_BYTES( 'U', '8' ): - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - for( i=0; i<(int)delta_from_bytes; i++ ) - to_data[8-delta_from_bytes+i] = from_data[delta_from_bytes-1-i] ; - break ; - - case EVAL_2_BYTES( 'R', '4' ): - for( i=0; i<8; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[3] == 0x00) && (from_data[2] == 0x00) && - (from_data[1] == 0x00) && (from_data[0] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[0] = from_data[3] & 0x80 ; - - /** Convert the exponent **/ - /** 8 bits to 14 bits. Sign extent from 8 to 14 **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = (from_data[3] & 0x3f) << 1 ; - if( (from_data[2] & 0x80) == 0x80 ) - exp += 1 ; - if( (from_data[3] & 0x40) == 0x00 ) /* set sign */ - exp -= 128 ; - exp += 2 ; - - to_data[1] = exp & 0xff ; - if( exp < 0 ) - to_data[0] |= 0x3f ; /* exponent sign 0, sign extend exponent */ - else - to_data[0] |= 0x40 ; /* exponent sign 1 */ - - /** Convert the mantissia **/ - /** 23 bits to 48 bits. Left shift 25 bits, zero fill **/ - to_data[2] = from_data[2] | 0x80 ; - to_data[3] = from_data[1] ; - to_data[4] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'R', '8' ): - for( i=0; i<8; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[7] == 0x00) && (from_data[6] == 0x00) && - (from_data[5] == 0x00) && (from_data[4] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[0] = from_data[7] & 0x80 ; - - /** Convert the exponent **/ - /** 11 bits to 14 bits. Sign extent from 11 to 14 **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = ((from_data[7] & 0x3f) << 4) + ((from_data[6]>>4)&0x0f) ; - - if( (from_data[7] & 0x40) == 0x00 ) /* set sign */ - exp -= 1024 ; - exp += 2 ; - - to_data[1] = (unsigned int)(exp & 0xff) ; - to_data[0] |= ((exp>>8) & 0x03) ; - if( exp < 0 ) - to_data[0] |= 0x3c ; /* exponent sign 0, sign extend exponent */ - else - to_data[0] |= 0x40 ; /* exponent sign 1 */ - - /** Convert the mantissia **/ - /** 52 bits to 48 bits. Use 48, drop last 4 bits **/ - to_data[2] = 0x80 | ((from_data[6]<<3)&0x78) | - ((from_data[5]>>5)&0x07) ; - for( i=3; i<8; i++ ) - to_data[i] = ((from_data[7-i+1]<<3)&0xF8) | - ((from_data[7-i]>>5)&0x07) ; -#ifdef PRINT_STUFF -printf("from:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", from_data[i] ) ; -printf("to:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", to_data[i] ) ; -printf("\n" ) ; -#endif - break ; - - case EVAL_2_BYTES( 'X', '4' ): - ADFI_little_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_little_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, &from_data[4], &to_data[8], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - case EVAL_2_BYTES( 'X', '8' ): - ADFI_little_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_little_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, &from_data[8], &to_data[8], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - default: - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ -} /* end of ADFI_little_endian_to_cray */ -/* end of file ADFI_little_endian_to_cray.c */ -/* file ADFI_open_file.c */ -/*********************************************************************** -ADFI open file: - - Track the files used by index. - Also track which files are within a given system so a close for - the system can close all related files. - -input: const char *file The filename to open. -input: const char *status The status in which to open the file. - Allowable values are: - READ_ONLY - File must exist. Writing NOT allowed. - OLD - File must exist. Reading and writing allowed. - NEW - File must not exist. - SCRATCH - New file. Filename is ignored. - UNKNOWN - OLD if file exists, else NEW is used. -input: const int top_file_index -1 if this is the top file. -output: unsigned int *file_index Returned index of the file. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -TOO_MANY_ADF_FILES_OPENED -ADF_FILE_STATUS_NOT_RECOGNIZED -FILE_OPEN_ERROR -***********************************************************************/ -void ADFI_open_file( - const char *file, - const char *status, - const int top_file_index, - unsigned int *file_index, - int *error_return ) -{ -int index ; -FILE *f_ret ; - -if( (status == NULL) || - ((file == NULL) && (ADFI_stridx_c( status, "SCRATCH" ) != 0) ) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_index == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -/* Initialize the priority satck if it has not been done */ -if (STACK_INIT==-1) ADFI_stack_control(0,0,0,INIT_STK,0,0,NULL); - -for( index=0; index= MAXIMUM_FILES ) { - *error_return = TOO_MANY_ADF_FILES_OPENED ; - return ; - } /* end if */ - -ADF_file_format[index] = UNDEFINED_FORMAT ; -ADF_file_os_size[index] = UNDEFINED_FORMAT ; - -/*** - READ_ONLY - File must exist. Writing NOT allowed. - OLD - File must exist. Reading and writing allowed. - NEW - File must not exist. - SCRATCH - New file. Filename is ignored. - UNKNOWN - OLD if file exists, else NEW is used. -***/ -#if defined(_WIN32) && !defined(__WIN32_BINARY__) - _fmode = O_BINARY ; -#endif -if( ADFI_stridx_c( status, "READ_ONLY" ) == 0 ) { -#if defined(_WIN32) && defined(__WIN32_BINARY__) - f_ret = fopen( file, "rb" ) ; /** Open for reading **/ -#else - f_ret = fopen( file, "r" ) ; /** Open for reading **/ -#endif - } /* end if */ -else if( ADFI_stridx_c( status, "OLD" ) == 0 ) { -#if defined(_WIN32) && defined(__WIN32_BINARY__) - f_ret = fopen( file, "rb+" ) ; /** Open for both reading & writing **/ -#else - f_ret = fopen( file, "r+" ) ; /** Open for both reading & writing **/ -#endif - } /* end else if */ -else if( ADFI_stridx_c( status, "NEW" ) == 0 ) { -#if defined(_WIN32) && defined(__WIN32_BINARY__) - f_ret = fopen( file, "wb+" ) ; /** open new file, or truncate old file */ -#else - f_ret = fopen( file, "w+" ) ; /** open new file, or truncate old file */ -#endif - } /* end else if */ -else if( ADFI_stridx_c( status, "SCRATCH" ) == 0 ) { - f_ret = tmpfile(); - } /* end else if */ -else if( ADFI_stridx_c( status, "UNKNOWN" ) == 0 ) { -#if defined(_WIN32) && defined(__WIN32_BINARY__) - f_ret = fopen( file, "ab+" ) ; /** open new, or use existing file **/ -#else - f_ret = fopen( file, "a+" ) ; /** open new, or use existing file **/ -#endif - } /* end else if */ -else { - *error_return = ADF_FILE_STATUS_NOT_RECOGNIZED ; - goto Error_Exit ; - } /* end else */ - -if( f_ret == NULL ) { - *error_return = FILE_OPEN_ERROR ; - goto Error_Exit ; - } /* end if */ - -file_in_use[ index ] = 1 ; -first_file_in_system[ index ] = top_file_index ; -ADF_file[ index ] = f_ret ; -file_version_update[ index ][ 0 ] = '\0' ; -*file_index = index ; -sprintf( file_open_mode[index], "%s", status ) ; -if( ADFI_stridx_c( status, "SCRATCH" ) == 0 ) { - names_of_files[index][0] = '\0' ; - } /* end if */ -else { - sprintf( names_of_files[index], "%s", file ) ; - } /* end else */ -return ; - -Error_Exit: - /** Clear this file's entry **/ -if( ADF_file[ index ] != 0 ) { - if( fclose( ADF_file[ index ] ) != 0 ) - *error_return = FILE_CLOSE_ERROR ; - } /* end if */ -file_in_use[ index ] = 0 ; -first_file_in_system[ index ] = -1 ; -ADF_file[ index ] = NULL ; -file_version_update[ index ][ 0 ] = '\0' ; - -} /* end of ADFI_open_file */ -/* end of file ADFI_open_file.c */ -/* file ADFI_read_chunk_length.c */ -/*********************************************************************** -ADFI read chunk length: - Read the header of the chunk. If it is a variable sized - chunk, then the first 2 things in is are: - Tag, and pointer to end_of_chunk-tag - If NOT variable, then determine what type of chunk it is - and return a pointer to the end_of_chunk-tag: - - If the incomming pointers are 0 0, then we are looking - at the file header. - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -output: char tag[TAG_SIZE] The tag from the chunk. -output: struct DISK_POINTER *end_of_chunk_tag End of chunk. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ - -void ADFI_read_chunk_length( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - char tag[TAG_SIZE+1], - struct DISK_POINTER *end_of_chunk_tag, - int *error_return ) -{ -char info[ TAG_SIZE + DISK_POINTER_SIZE ] ; -struct DISK_POINTER current_block_offset ; -unsigned long count ; - -if( (block_offset == NULL) || (end_of_chunk_tag == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( tag == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -end_of_chunk_tag->block = 0 ; -end_of_chunk_tag->offset = 0 ; - - /** File Header **/ -if( (block_offset->block == 0) && (block_offset->offset == 0) ) { - - /** point to end-tag **/ - end_of_chunk_tag->offset = FILE_HEADER_SIZE - TAG_SIZE ; - tag[0] = file_header_tags[0][0] ; - tag[1] = file_header_tags[0][1] ; - tag[2] = file_header_tags[0][2] ; - tag[3] = file_header_tags[0][3] ; - } /* end if */ - - /** Free-Chunk Table **/ -else if( (block_offset->block == 0) && - (block_offset->offset == FREE_CHUNKS_OFFSET) ) { - - /** point to end-tag **/ - end_of_chunk_tag->offset = - (FREE_CHUNKS_OFFSET + FREE_CHUNK_TABLE_SIZE) - TAG_SIZE ; - tag[0] = free_chunk_table_start_tag[0] ; - tag[1] = free_chunk_table_start_tag[1] ; - tag[2] = free_chunk_table_start_tag[2] ; - tag[3] = free_chunk_table_start_tag[3] ; - } /* end if */ -else { - - /** Check for 'z's in the file. This is free-data, too small - to include tags and pointers - **/ - count = 0 ; - ADFI_read_file( file_index, block_offset->block, block_offset->offset, - 1, info, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - if( info[0] == 'z' ) { - current_block_offset.block = block_offset->block ; - current_block_offset.offset = block_offset->offset ; - while( info[0] == 'z' ) { - count++ ; - current_block_offset.offset++ ; - ADFI_adjust_disk_pointer( ¤t_block_offset, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - info[0] = '\0' ; - ADFI_read_file( file_index, current_block_offset.block, - current_block_offset.offset, 1, info, error_return ) ; - if( (*error_return == FSEEK_ERROR) || (*error_return == FREAD_ERROR)){ - break ; - } /* end if */ - if( *error_return != NO_ERROR ) - return ; - } /* end while */ - end_of_chunk_tag->block = block_offset->block ; - end_of_chunk_tag->offset = block_offset->offset + count - TAG_SIZE ; - ADFI_adjust_disk_pointer( end_of_chunk_tag, error_return ) ; - tag[0] = tag[1] = tag[2] = tag[3] = 'z' ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - else { - /** Read TAG and disk_pointer **/ - ADFI_read_file( file_index, block_offset->block, block_offset->offset, - TAG_SIZE + DISK_POINTER_SIZE, info, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /* Copy the tag **/ - tag[0] = info[0] ; - tag[1] = info[1] ; - tag[2] = info[2] ; - tag[3] = info[3] ; - tag[4] = '\0' ; - - /** Check for known tags **/ - if( ADFI_stridx_c( tag, node_start_tag ) == 0 ) { /** Node **/ - end_of_chunk_tag->block = block_offset->block ; - end_of_chunk_tag->offset = block_offset->offset + - NODE_HEADER_SIZE - TAG_SIZE ; - ADFI_adjust_disk_pointer( end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - else { - - /** Convert pointers into numeric form **/ - ADFI_disk_pointer_from_ASCII_Hex( &info[TAG_SIZE], - &info[DISK_POINTER_SIZE], end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - } /* end else */ - } /* end else */ - -} /* end of ADFI_read_chunk_length */ -/* end of file ADFI_read_chunk_length.c */ -/* file ADFI_read_data_chunk.c */ -/*********************************************************************** -ADFI read data chunk: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const char *data_type The defined datatype. -input: const int data_size Size of data entity in bytes. -input: const long chunk_bytes Number of bytes in data chunk. -input: const long start_offset Starting offset into the data chunk -input: const long total_bytes Number of bytes to read in data chunk. -output: char *data Pointer to the resulting data. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_DISK_TAG_ERROR -REQUESTED_DATA_TOO_LONG -***********************************************************************/ -void ADFI_read_data_chunk( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct TOKENIZED_DATA_TYPE *tokenized_data_type, - const int data_size, - const long chunk_bytes, - const long start_offset, - const long total_bytes, - char *data, - int *error_return ) -{ -int format_compare ; -char tag[TAG_SIZE + 1] ; -struct DISK_POINTER data_start, end_of_chunk_tag ; -long chunk_total_bytes ; - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (tokenized_data_type == NULL) || (data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -if( total_bytes+start_offset > chunk_bytes ) { - *error_return = REQUESTED_DATA_TOO_LONG ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Get tag and chunk length **/ -ADFI_read_chunk_length( file_index, block_offset, tag, &end_of_chunk_tag, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; -tag[TAG_SIZE] = '\0' ; - - /** Check start-of-chunk tag **/ -if( ADFI_stridx_c( tag, data_chunk_start_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - - /** Check end-of-chunk tag **/ -ADFI_read_file( file_index, end_of_chunk_tag.block, end_of_chunk_tag.offset, - TAG_SIZE, tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -tag[TAG_SIZE] = '\0' ; - -if( ADFI_stridx_c( tag, data_chunk_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - - /** Point to the start of the data **/ -data_start.block = block_offset->block ; -data_start.offset = block_offset->offset + start_offset + - DISK_POINTER_SIZE + TAG_SIZE ; -ADFI_adjust_disk_pointer( &data_start, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** calculate the total number of data bytes **/ -chunk_total_bytes = end_of_chunk_tag.offset - data_start.offset + start_offset - + (end_of_chunk_tag.block - data_start.block) * DISK_BLOCK_SIZE ; -if( chunk_bytes > chunk_total_bytes ) { - *error_return = REQUESTED_DATA_TOO_LONG ; - return ; - } /* end if */ -else { - if( chunk_bytes < chunk_total_bytes ) - *error_return = REQUESTED_DATA_TOO_LONG ; - - /** check for need of data translation **/ - ADFI_file_and_machine_compare( file_index, tokenized_data_type, - &format_compare, error_return ); - if( *error_return != NO_ERROR ) - return ; - if( format_compare == 1 ) { - /** Read the data off of disk **/ - ADFI_read_file( file_index, data_start.block, data_start.offset, - total_bytes, data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - else { - ADFI_read_data_translated( file_index, data_start.block, - data_start.offset, tokenized_data_type, data_size, - total_bytes, data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - } /* end else */ - -} /* end of ADFI_read_data_chunk */ -/* end of file ADFI_read_data_chunk.c */ -/* file ADFI_read_data_chunk_table.c */ -/*********************************************************************** -ADFI read data chunk table: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -output: struct DATA_CHUNK_TABLE_ENTRY data_chunk_table[] Array of DC entries. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_read_data_chunk_table( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct DATA_CHUNK_TABLE_ENTRY data_chunk_table[], - int *error_return ) -{ -char tag[ TAG_SIZE + 1 ] ; -struct DISK_POINTER end_of_chunk_tag, tmp_block_offset ; -unsigned int i, number_of_bytes_to_read ; - -if( (block_offset == NULL) || (data_chunk_table == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - /** Get the tag and the length **/ -ADFI_read_chunk_length( file_index, block_offset, tag, - &end_of_chunk_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -tag[TAG_SIZE] = '\0' ; - - /** Compare the start tag **/ -if( ADFI_stridx_c( tag, data_chunk_table_start_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - -number_of_bytes_to_read = - (end_of_chunk_tag.block - block_offset->block) * DISK_BLOCK_SIZE + - (end_of_chunk_tag.offset - block_offset->offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - - /** Read the data from disk **/ -tmp_block_offset.block = block_offset->block ; -tmp_block_offset.offset = block_offset->offset + TAG_SIZE ; - -for( i=0; i number_of_data_elements ) { - chunk_size -= ( number_of_elements_read - number_of_data_elements ) ; - delta_from_bytes = chunk_size * data_size ; - delta_to_bytes = chunk_size * machine_size ; - } - ADFI_read_file( file_index, disk_pointer.block, disk_pointer.offset, - delta_from_bytes, (char *)from_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - ADFI_convert_number_format( - ADF_file_format[file_index], /* from format */ - ADF_file_os_size[file_index], /* from os size */ - ADF_this_machine_format, /* to format */ - ADF_this_machine_os_size, /* to os size */ - FROM_FILE_FORMAT, - tokenized_data_type, chunk_size, from_data, - to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - to_data += delta_to_bytes ; - disk_pointer.offset += delta_from_bytes ; - if ( disk_pointer.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &disk_pointer, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - } /* end while */ - -} /* end of ADFI_read_data_translated */ -/* end of file ADFI_read_data_translated.c */ -/* file ADFI_read_disk_block.c */ -/*********************************************************************** -ADFI read disk block: - - Possible errors: -NO_ERROR -***********************************************************************/ -void ADFI_read_disk_block() -{ -fprintf(stderr,"Subroutine ADFI_read_disk_block is not yet implemented...\n" ) ; -} /* end of ADFI_read_disk_block */ -/* end of file ADFI_read_disk_block.c */ -/* file ADFI_read_disk_pointer_from_disk.c */ -/*********************************************************************** -ADFI read disk pointer from disk: - Given a pointer to a disk pointer, read it from disk and convert - it into numeric form. - -input: const unsigned int file_index File to read from. -input: const unsigned long file_block Block within the file. -input: const unsigned long block_offset Offset within the block. -output: struct DISK_POINTER *block_and_offset Resulting disk pointer. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_read_disk_pointer_from_disk( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - struct DISK_POINTER *block_and_offset, - int *error_return ) -{ -char disk_block_offset[DISK_POINTER_SIZE] ; - -if( block_and_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( block_offset > DISK_BLOCK_SIZE ) { - *error_return = BLOCK_OFFSET_OUT_OF_RANGE ; - return ; - } /* end if */ - - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check the stack for block/offset **/ -#if 0 -if ( ADFI_stack_control(file_index, file_block, block_offset, - GET_STK, DISK_PTR_STK, - DISK_POINTER_SIZE, disk_block_offset ) != NO_ERROR ) { -#endif - - /** Get the block/offset from disk **/ - ADFI_read_file( file_index, file_block, block_offset, - DISK_POINTER_SIZE, disk_block_offset, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Set the block/offset onto the stack **/ -#if 0 - ADFI_stack_control(file_index, file_block, block_offset, - SET_STK, DISK_PTR_STK, - DISK_POINTER_SIZE, disk_block_offset ); -} /* end if */ -#endif - - /** Convert into numeric form **/ -ADFI_disk_pointer_from_ASCII_Hex( &disk_block_offset[0], &disk_block_offset[8], - block_and_offset, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -} /* end of ADFI_read_disk_pointer_from_disk */ -/* end of file ADFI_read_disk_pointer_from_disk.c */ -/* file ADFI_read_file.c */ -/*********************************************************************** -ADFI read file: - Read a number of bytes from an open ADF file from a given - file, block, and offset. Buffering is done in an attempt to - improve performance of repeatedly reading small pieces of - contiguous data. Note: read buffering also affects the - write function, i.e, all writes must reset the read buffer. - -input: const unsigned int file_index File to read from. -input: const unsigned long file_block Block within the file. -input: const unsigned long block_offset Offset within the block. -input: const unsigned int data_length Length of the data to read. -input: char *data Address of the data. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -FREAD_ERROR -***********************************************************************/ -void ADFI_read_file( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - const unsigned int data_length, - char *data, - int *error_return ) -{ -int iret ; - - -if( data == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** No need to buffer large pieces of data or to take special - measures to cross block boundaries **/ - -if( data_length + block_offset > DISK_BLOCK_SIZE ) { - - /** Position the file **/ - ADFI_fseek_file( file_index, file_block, block_offset, error_return ) ; - if( *error_return != NO_ERROR ) { - return ; - } /* end if */ - - /** Read the data from disk **/ - iret = fread( data, 1, data_length, ADF_file[ file_index ] ) ; - if( iret != (int)data_length ) { - *error_return = FREAD_ERROR ; - return ; - } /* end if */ - - return; -} /* end if */ - - /** For smaller pieces of data, read a block at a time. This will improve - performance if neighboring data is requested a small piece at a time - (strided reads, file overhead). - - Some assumptions apply to the block size. With some experimenting, - 1K blocks do not offer much improvement. 4K blocks (4096 bytes) - do improve performance remarkably. This is due to the fact that the - file structure is based of 4K blocks with offsets. - **/ - -if( num_in_rd_block < DISK_BLOCK_SIZE || /*- buffer is not full -*/ - (long int) file_block != last_rd_block || /*- a different block -*/ - (long int) file_index != last_rd_file ) { /*- entirely different file -*/ - - /** buffer is not current, re-read **/ - - if ( (long int) file_block == last_wr_block && (long int) file_index == last_wr_file ) { - - /* Copy data from write buffer */ - memcpy( rd_block_buffer, wr_block_buffer, DISK_BLOCK_SIZE ); - iret = DISK_BLOCK_SIZE; - } - else { - - /** Position the file **/ - ADFI_fseek_file( file_index, file_block, 0, error_return ) ; - if( *error_return != NO_ERROR ) { - return ; - } /* end if */ - - /** Read the data from disk **/ - iret = fread( rd_block_buffer, 1, DISK_BLOCK_SIZE, ADF_file[ file_index ] ) ; - if( iret == EOF || iret == 0 ) { - *error_return = FREAD_ERROR ; - return ; - } /* end if */ - - } /* end if */ - - /** Remember buffer information **/ - last_rd_block = file_block ; - last_rd_file = file_index ; - num_in_rd_block = iret ; - -} /* end if */ - - /*read from buffer*/ -memcpy( data, &rd_block_buffer[block_offset], data_length ); - -} /* end of ADFI_read_file */ -/* end of file ADFI_read_file.c */ -/* file ADFI_read_file_header.c */ -/*********************************************************************** -ADFI read file header: - -input: const unsigned int file_index The file index. -output: struct FILE_HEADER *file_header Pointer to a file-header struct. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_read_file_header( - const unsigned int file_index, - struct FILE_HEADER *file_header, - int *error_return ) -{ -char disk_header[ FILE_HEADER_SIZE ] ; - -if( file_header == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check the stack for header **/ -if ( ADFI_stack_control(file_index, 0, 0, GET_STK, FILE_STK, - FILE_HEADER_SIZE, disk_header ) != NO_ERROR ) { - - /** Read in the header into memory **/ - ADFI_read_file( file_index, 0, 0, FILE_HEADER_SIZE, disk_header, - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Check memory tags for proper data **/ - if( strncmp( &disk_header[32], file_header_tags[0], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - - if( strncmp( &disk_header[64], file_header_tags[1], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - - if( strncmp( &disk_header[96], file_header_tags[2], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - - if( strncmp( &disk_header[102], file_header_tags[3], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - - if( strncmp( &disk_header[130], file_header_tags[4], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - - if( strncmp( &disk_header[182], file_header_tags[5], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - - /** Set the header onto the stack **/ - ADFI_stack_control(file_index, 0, 0, SET_STK, FILE_STK, - FILE_HEADER_SIZE, disk_header ); -} /* end if */ - -/** OK the memory tags look good, let's convert disk-formatted header - into memory **/ -strncpy( (char *)file_header->what, &disk_header[ 0], 32 ) ; -strncpy( (char *)file_header->tag0, &disk_header[ 32], TAG_SIZE ) ; -strncpy( (char *)file_header->creation_date, &disk_header[ 36], DATE_TIME_SIZE); -strncpy( (char *)file_header->tag1, &disk_header[ 64], TAG_SIZE ) ; -strncpy( (char *)file_header->modification_date, &disk_header[ 68], - DATE_TIME_SIZE ) ; -strncpy( (char *)file_header->tag2, &disk_header[ 96], TAG_SIZE ) ; -file_header->numeric_format = disk_header[100] ; -file_header->os_size = disk_header[101] ; -strncpy( (char *)file_header->tag3, &disk_header[102], TAG_SIZE ) ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[106], - &file_header->sizeof_char, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[108], - &file_header->sizeof_short, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[110], - &file_header->sizeof_int, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[112], - &file_header->sizeof_long, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[114], - &file_header->sizeof_float, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[116], - &file_header->sizeof_double, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[118], - &file_header->sizeof_char_p, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[120], - &file_header->sizeof_short_p, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[122], - &file_header->sizeof_int_p, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[124], - &file_header->sizeof_long_p, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[126], - &file_header->sizeof_float_p, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[128], - &file_header->sizeof_double_p, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -strncpy( file_header->tag4, &disk_header[130], TAG_SIZE ) ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_header[134], &disk_header[142], - &file_header->root_node, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_header[146], &disk_header[154], - &file_header->end_of_file, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_header[158], &disk_header[166], - &file_header->free_chunks, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_header[170], &disk_header[178], - &file_header->extra, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -strncpy( file_header->tag5, &disk_header[182], TAG_SIZE ) ; - - - /** Check memory tags for proper data **/ -if( strncmp( file_header->tag0, file_header_tags[0], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag1, file_header_tags[1], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag2, file_header_tags[2], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag3, file_header_tags[3], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag4, file_header_tags[4], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag5, file_header_tags[5], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -} /* end of ADFI_read_file_header */ -/* end of file ADFI_read_file_header.c */ -/* file ADFI_read_free_chunk.c */ -/*********************************************************************** -ADFI read free chunk: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -output: struct DISK_POINTER *end_of_chunk_tag End of free chunk tag. -output: struct DISK_POINTER *next_chunk Next free chunk in list. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_DISK_TAG_ERROR -***********************************************************************/ -void ADFI_read_free_chunk( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct FREE_CHUNK *free_chunk, - int *error_return ) -{ -char tag[TAG_SIZE + 1] ; -struct DISK_POINTER chunk_block_offset ; - -if( (block_offset == NULL) || (free_chunk == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Get the tag and the length **/ -ADFI_read_chunk_length( file_index, block_offset, tag, - &(free_chunk->end_of_chunk_tag), error_return ) ; -if( *error_return != NO_ERROR ) - return ; -tag[TAG_SIZE] = '\0' ; - - /** Compare the start tag **/ -if( ADFI_stridx_c( tag, free_chunk_start_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - - /** Set block offset to the start of the chunk **/ - -chunk_block_offset = *block_offset ; -chunk_block_offset.offset += TAG_SIZE + DISK_POINTER_SIZE ; -ADFI_adjust_disk_pointer( &chunk_block_offset, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Read the data from disk **/ - -ADFI_read_disk_pointer_from_disk( file_index, chunk_block_offset.block, - chunk_block_offset.offset, &(free_chunk->next_chunk), error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_read_file( file_index, free_chunk->end_of_chunk_tag.block, - free_chunk->end_of_chunk_tag.offset, TAG_SIZE, tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Compare the end tag **/ -if( ADFI_stridx_c( tag, free_chunk_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - -strncpy( free_chunk->start_tag, free_chunk_start_tag, 4 ) ; -strncpy( free_chunk->end_tag, free_chunk_end_tag, 4 ) ; -} /* end of ADFI_read_free_chunk */ -/* end of file ADFI_read_free_chunk.c */ -/* file ADFI_read_free_chunk_table.c */ -/*********************************************************************** -ADFI read free chunk table: - -input: const unsigned int file_index The file index. -output: struct FREE_CHUNK_TABLE *free_chunk_table Pointer to table. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_DISK_TAG_ERROR -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_read_free_chunk_table( - const unsigned int file_index, - struct FREE_CHUNK_TABLE *free_chunk_table, - int *error_return ) -{ -char disk_free_chunk_data[ FREE_CHUNK_TABLE_SIZE ] ; - -if( free_chunk_table == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check the stack for free chunk **/ -if ( ADFI_stack_control(file_index, FREE_CHUNKS_BLOCK, FREE_CHUNKS_OFFSET, - GET_STK, FREE_CHUNK_STK, FREE_CHUNK_TABLE_SIZE, - disk_free_chunk_data ) != NO_ERROR ) { - - /** Read the free-chunk table off of disk **/ - ADFI_read_file( file_index, FREE_CHUNKS_BLOCK, FREE_CHUNKS_OFFSET, - FREE_CHUNK_TABLE_SIZE, disk_free_chunk_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Check disk tags **/ - if( ADFI_stridx_c( &disk_free_chunk_data[0], free_chunk_table_start_tag ) != - 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end of */ - - if( ADFI_stridx_c( &disk_free_chunk_data[FREE_CHUNK_TABLE_SIZE - TAG_SIZE], - free_chunk_table_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end of */ - - /** Set the free chunk onto the stack **/ - ADFI_stack_control(file_index, FREE_CHUNKS_BLOCK, FREE_CHUNKS_OFFSET, - SET_STK, FREE_CHUNK_STK, FREE_CHUNK_TABLE_SIZE, - disk_free_chunk_data ); -} /* end if */ - - /** Convert into memory **/ -strncpy( (char *)free_chunk_table->start_tag, &disk_free_chunk_data[ 0], - TAG_SIZE ) ; -strncpy( (char *)free_chunk_table->end_tag, - &disk_free_chunk_data[ FREE_CHUNK_TABLE_SIZE - TAG_SIZE ], TAG_SIZE ) ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_free_chunk_data[ TAG_SIZE], - &disk_free_chunk_data[DISK_POINTER_SIZE], - &free_chunk_table->small_first_block, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_free_chunk_data[16], - &disk_free_chunk_data[24], &free_chunk_table->small_last_block, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_free_chunk_data[28], - &disk_free_chunk_data[36], &free_chunk_table->medium_first_block, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_free_chunk_data[40], - &disk_free_chunk_data[48], &free_chunk_table->medium_last_block, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_free_chunk_data[52], - &disk_free_chunk_data[60], &free_chunk_table->large_first_block, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_free_chunk_data[64], - &disk_free_chunk_data[72], &free_chunk_table->large_last_block, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Check memory tags **/ -if( ADFI_stridx_c( free_chunk_table->start_tag, free_chunk_table_start_tag ) - != 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end of */ - -if( ADFI_stridx_c( free_chunk_table->end_tag, free_chunk_table_end_tag ) - != 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end of */ - -} /* end of ADFI_read_free_chunk_table */ -/* end of file ADFI_read_free_chunk_table.c */ -/* file ADFI_read_node_header.c */ -/*********************************************************************** -ADFI read node header: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -output: struct NODE_HEADER *node_header Pointer to node header. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_DISK_TAG_ERROR -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_read_node_header( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct NODE_HEADER *node_header, - int *error_return ) -{ -char disk_node_data[ NODE_HEADER_SIZE ] ; -int i ; - -if( (block_offset == NULL) || (node_header == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check the stack for header **/ -if ( ADFI_stack_control(file_index, block_offset->block, block_offset->offset, - GET_STK, NODE_STK, NODE_HEADER_SIZE, - disk_node_data ) != NO_ERROR ) { - - /** Get the node header from disk **/ - ADFI_read_file( file_index, block_offset->block, block_offset->offset, - NODE_HEADER_SIZE, disk_node_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Check disk tags **/ - if( ADFI_stridx_c( &disk_node_data[0], node_start_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end of */ - - if( ADFI_stridx_c( &disk_node_data[ NODE_HEADER_SIZE - TAG_SIZE ], - node_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - - /** Set the header onto the stack **/ - ADFI_stack_control(file_index, block_offset->block, block_offset->offset, - SET_STK, NODE_STK, NODE_HEADER_SIZE, disk_node_data ); -} /* end if */ - - /** Convert into memory **/ -strncpy( (char *)node_header->node_start_tag, &disk_node_data[ 0], TAG_SIZE ) ; -strncpy( (char *)node_header->node_end_tag, - &disk_node_data[ NODE_HEADER_SIZE - TAG_SIZE], TAG_SIZE ) ; - -strncpy( (char *)node_header->name, &disk_node_data[ TAG_SIZE], - ADF_NAME_LENGTH ) ; -strncpy( (char *)node_header->label, &disk_node_data[ 36], ADF_LABEL_LENGTH ) ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, MAXIMUM_32_BITS, 8, &disk_node_data[ 68], - &node_header->num_sub_nodes, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, MAXIMUM_32_BITS, 8, &disk_node_data[ 76], - &node_header->entries_for_sub_nodes, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_node_data[84], &disk_node_data[92], - &node_header->sub_node_table, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -strncpy( (char *)node_header->data_type, &disk_node_data[ 96], - ADF_DATA_TYPE_LENGTH ) ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 12, 2, &disk_node_data[128], - &node_header->number_of_dimensions, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -for( i=0; idimension_values[i], - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end for */ - -ADFI_ASCII_Hex_2_unsigned_int( 0, 65535, 4, &disk_node_data[226], - &node_header->number_of_data_chunks, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_node_data[230], &disk_node_data[238], - &node_header->data_chunks, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Check memory tags **/ -if( ADFI_stridx_c( node_header->node_start_tag, node_start_tag ) != 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end of */ - -if( ADFI_stridx_c( node_header->node_end_tag, node_end_tag ) != 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end of */ - -} /* end of ADFI_read_node_header */ -/* end of file ADFI_read_node_header.c */ -/* file ADFI_read_sub_node_table.c */ -/*********************************************************************** -ADFI read sub node table: - - At this point, reading of the ENTIRE table is required. - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -output: struct SUB_NODE_TABLE_ENTRY sub_node_table[] Array of SN entries. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_read_sub_node_table( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct SUB_NODE_TABLE_ENTRY sub_node_table[], - int *error_return ) -{ -char tag[TAG_SIZE + 1] ; -struct DISK_POINTER end_of_chunk_tag, current_child ; -unsigned int number_of_children, i ; - -if( (block_offset == NULL) || (sub_node_table == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Get tag and length **/ -ADFI_read_chunk_length( file_index, block_offset, tag, - &end_of_chunk_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -tag[TAG_SIZE] = '\0' ; - - /** calculate the number of chuldren in the sub-node table **/ -number_of_children = ( - (end_of_chunk_tag.block - block_offset->block) * DISK_BLOCK_SIZE + - (end_of_chunk_tag.offset - block_offset->offset) ) / - (DISK_POINTER_SIZE + ADF_NAME_LENGTH) ; - -current_child.block = block_offset->block ; -current_child.offset = block_offset->offset + TAG_SIZE + DISK_POINTER_SIZE ; -ADFI_adjust_disk_pointer( ¤t_child, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Read and convert the variable-length table into memory **/ -for( i=0; iblock, block_offset->offset, - GET_STK, SUBNODE_STK, ADF_NAME_LENGTH + DISK_POINTER_SIZE, - sub_node_entry_disk_data ) != NO_ERROR ) { - - /** Read the entry from disk **/ - ADFI_read_file( file_index, block_offset->block, block_offset->offset, - ADF_NAME_LENGTH + DISK_POINTER_SIZE, sub_node_entry_disk_data, - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Set the subnode onto the stack **/ - ADFI_stack_control(file_index, block_offset->block, block_offset->offset, - SET_STK, SUBNODE_STK, ADF_NAME_LENGTH + DISK_POINTER_SIZE, - sub_node_entry_disk_data ); -} /* end if */ - - /** Copy the name **/ -strncpy( sub_node_table_entry->child_name, &sub_node_entry_disk_data[0], - ADF_NAME_LENGTH ) ; - - /** Convert the disk-pointer **/ -ADFI_disk_pointer_from_ASCII_Hex( &sub_node_entry_disk_data[ ADF_NAME_LENGTH ], - &sub_node_entry_disk_data[ ADF_NAME_LENGTH + 8 ], - &sub_node_table_entry->child_location, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -} /* end of ADFI_read_sub_node_table_entry */ -/* end of file ADFI_read_sub_node_table_entry.c */ -/* file ADFI_remember_file_format.c */ -/********************************************************************** -ADFI remember file format: - Track the file format used: - -input: const int file_index Index for the file. -input: const char numeric_format Format for the file. -input: const char os_size operating system size for the file. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -FILE_INDEX_OUT_OF_RANGE -**********************************************************************/ -void ADFI_remember_file_format( - const int file_index, - const char numeric_format, - const char os_size, - int *error_return ) -{ -if( (file_index < 0) || (file_index > MAXIMUM_FILES) ) { - *error_return = FILE_INDEX_OUT_OF_RANGE ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; -ADF_file_format[file_index] = numeric_format ; -ADF_file_os_size[file_index] = os_size ; -} -/* end of file ADFI_remember_file_format.c */ -/* file ADFI_remember_version_update.c */ -/*********************************************************************** -ADFI remember version update: - Stores the what-string (which contains the file version number) so - that it can be written after the first successful update. After the - file has been updated once, the remembered what-string is "forgotten". - -input: const int file_index File index to write to. -input: const char *what_string What string to remember (contains version) -output: int *error_return Error return. - - Possible errors: -FILE_INDEX_OUT_OF_RANGE -NULL_STRING_POINTER -STRING_LENGTH_ZERO -***********************************************************************/ -void ADFI_remember_version_update( - const int file_index, - const char *what_string, - int *error_return ) -{ - -*error_return = NO_ERROR ; - -if( (file_index < 0) || (file_index > MAXIMUM_FILES) ) { - *error_return = FILE_INDEX_OUT_OF_RANGE ; - return ; - } /* end if */ - -if( what_string == NULL ) { - *error_return = NULL_STRING_POINTER ; - return; - } /* end if */ - -if( what_string[0] == '\0' ) { - *error_return = STRING_LENGTH_ZERO ; - return; - } /* end if */ - -if( strlen( what_string ) > WHAT_STRING_SIZE ) { - *error_return = STRING_LENGTH_TOO_BIG ; - return ; - } /* end if */ - -strcpy( file_version_update[ file_index ], what_string ) ; - -} /* end of ADFI_remember_version_update */ -/* end of file ADFI_remember_version_update.c */ -/* file ADFI_set_blank_disk_pointer.c */ -/********************************************************************** -ADFI_set_blank_disk_pointer: - Set the block and offset to the defined "blank", or unused values. - -output: struct DISK_POINTER *block_offset Block & offset in the file. - - Possible errors: -None allowed -**********************************************************************/ -void ADFI_set_blank_disk_pointer( - struct DISK_POINTER *block_offset ) -{ -block_offset->block = BLANK_FILE_BLOCK ; -block_offset->offset = BLANK_BLOCK_OFFSET ; -} /* end of ADFI_set_blank_disk_pointer */ -/* end of file ADFI_set_blank_disk_pointer.c */ -/* file ADFI_stack_control.c */ -/*********************************************************************** -ADFI stack control: - -input: const unsigned int file_index The file index. -input: const unsigned long file_block Block within the file. -input: const unsigned long block_offset Offset within the block. -input: const int stack_mode Control mode: INIT, GET or SET -input; const int stack_type Type of stack entry to process: FILE, NODE, etc.. -input: const unsigned int data_length Length of the data to buffer. -input/output: char *stack_data The character string buffered, is input for - mode SET and output for mode GET. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -PRISTK_NOT_FOUND - Note: errors are only important for GET mode since you must then go ahead - and read the data fom the file. The stack is only meant to speed things - up, not stop the process !!! -***********************************************************************/ -int ADFI_stack_control( const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - const int stack_mode, - const int stack_type, - const unsigned long data_length, - char *stack_data ) -{ -int i; -int low_priority; -int insert_index; -int found; - -if( stack_data == NULL && (stack_mode == GET_STK || stack_mode == SET_STK) ) { - return NULL_STRING_POINTER ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 && stack_mode != INIT_STK ) { - return ADF_FILE_NOT_OPENED ; - } /* end if */ - -/* Process depending on the mode */ - - switch( stack_mode ) { - case INIT_STK: - case CLEAR_STK: - case CLEAR_STK_TYPE: - /* Clear all entries with current file_index and or type, - if file_index is 0 then clear all the entries!! */ - for (i=0; i 0 ) free(PRISTK[i].stack_data); - PRISTK[i].file_index = -1; - PRISTK[i].file_block = 0; - PRISTK[i].block_offset = 0; - PRISTK[i].stack_type = -1; - PRISTK[i].priority_level = -1; - } /* end for */ - if ( stack_mode == INIT_STK ) STACK_INIT = 1; - /* just in case link or linked-to node deleted */ - last_link_ID = 0.0; - break ; - case GET_STK: - /* Try and find the entry in the current stack by matching the - file index, block and offset, if found copy data else if - not return with an error. */ - for (i=0; i= 0 ) { - /* Existing entry so lower its priority, if it is the lowest - then save its index for possible replacement. */ - if ( PRISTK[i].priority_level > low_priority ) { - low_priority = PRISTK[i].priority_level; - insert_index = i; - } /* end if */ - PRISTK[i].priority_level++; - } /* end else if */ - else if ( found == 'f' ) { - /* An empty entry set pointer for possible insertion */ - low_priority = MAX_STACK * MAX_STACK; - insert_index = i; - found = 'e'; - } /* end else if */ - } /* end for */ - /* If the item was already on the stack then we are done */ - if ( found == 't' ) return NO_ERROR; - /* Insert the data onto the stack at the index_insert location. */ - i = insert_index; - if ( PRISTK[i].priority_level > 0 ) free(PRISTK[i].stack_data); - PRISTK[i].stack_data = ( char * ) malloc(data_length*sizeof(char)); - if ( PRISTK[i].stack_data == NULL ) { - /* Error allocating memory buffer so clear stack and punt */ - PRISTK[i].file_index = -1; - PRISTK[i].file_block = 0; - PRISTK[i].block_offset = 0; - PRISTK[i].stack_type = -1; - PRISTK[i].priority_level = -1; - return NO_ERROR; - } /* end if */ - strncpy( PRISTK[i].stack_data, stack_data, data_length ); - PRISTK[i].file_index = file_index; - PRISTK[i].file_block = file_block; - PRISTK[i].block_offset = block_offset; - PRISTK[i].stack_type = stack_type; - PRISTK[i].priority_level = 1; - break ; - } /* end switch */ - - return NO_ERROR; - -} /* end of ADFI_stack_control */ -/* end of file ADFI_stack_control.c */ -/* file ADFI_stridx_c.c */ -/********************************************************************** -ADFI stridx c: - To find the location of a substring within a string. This - routine is case InSeNsItIvE!!! - - It is NOT assumed that the substring is already upper-case!!! - -input: const char *str The string to search in. -input: const char *substr The substring to search for. -output: int return-value The position in str where substr was found. - -1 if substr was not found. - - Possible errors: -none: Errors are not allowed. -***********************************************************************/ -int ADFI_stridx_c( - const char *str, - const char *substr ) -{ -int i, j, k ; - -if( str == NULL || substr == NULL || substr[0] == '\0' ) { - return -1 ; /* not found - nothing to check */ -} - -for( i=0; str[i] != '\0'; i++ ) { - for( j=i, k=0; TO_UPPER( str[j] ) == TO_UPPER( substr[k] ); j++ ) { - if( substr[++k] == '\0' ) - return i ; /* the substring was found */ - } /* end for */ - } /* end for */ -return -1 ; /* the substring was not found */ -} /* end of ADFI_stridx_c */ -/* end of file ADFI_stridx_c.c */ -/* file ADFI_string_2_C_string.c */ -/********************************************************************** -ADFI string to C string: - Create a C string of the maximum length (+1 for null) which is - null terminated and has no trailing blanks. - -input: const char *string Input string. -input: const int string_length Length of input string to use. -output: char *c_string Returned C string. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -**********************************************************************/ -void ADFI_string_2_C_string( - const char *string, - const int string_length, - char *c_string, - int *error_return ) -{ -int i, iend ; - -if( (string == NULL) || (c_string == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Skip and trailing blanks **/ -for( iend=string_length-1; iend>=0; iend-- ) { - if( string[ iend ] != ' ' ) { - break ; - } /* end if */ - } /* end for */ - - /** Copy the non-trailing blank portion of the string **/ -for( i=0; i<=iend; i++ ) - c_string[i] = string[i] ; - - /** NULL terminate the C string **/ -c_string[i] = '\0' ; -} /* end of ADFI_string_2_C_string */ -/* end of file ADFI_string_2_C_string.c */ -/* file ADFI_unsigned_int_2_ASCII_Hex.c */ -/*********************************************************************** -ADFI unsigned int to ASCII hex: - Convert an unsigned int to an ASCII-Hex string. - -input: const unsigned int number The integer number to convert to ASCII. -input: const unsigned int minimum The expected minimum number in the int. -input: const unsigned int maximum The expected maximum number in the int. -input: const unsigned int string_length The length of the returned string. -output: char string[] The string. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NUMBER_LESS_THAN_MINIMUM -NUMBER_GREATER_THAN_MAXIMUM -STRING_LENGTH_ZERO -STRING_LENGTH_TOO_BIG -***********************************************************************/ -void ADFI_unsigned_int_2_ASCII_Hex( - const unsigned int number, - const unsigned int minimum, - const unsigned int maximum, - const unsigned int string_length, - char string[], - int *error_return ) -{ -unsigned int i, /** Index from 0 to string_length - 1 **/ - ir, /** Index from string_length - 1 to 0 **/ - j, /** Temoprary integer variable **/ - num ; /** Working value of ther number **/ - -if( string == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( number < minimum ) { - *error_return = NUMBER_LESS_THAN_MINIMUM ; - return ; - } /* end if */ - -if( number > maximum ) { - *error_return = NUMBER_GREATER_THAN_MAXIMUM ; - return ; - } /* end if */ - -if( string_length == 0 ) { - *error_return = STRING_LENGTH_ZERO ; - return ; - } /* end if */ - -if( string_length > 8 ) { - *error_return = STRING_LENGTH_TOO_BIG ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Convert the number using power-of-2 table **/ -num = number ; -for( i=0, ir=string_length - 1; i= pows[ ir ] ) { - j = num / pows[ ir ] ; - num = num - j * pows[ ir ] ; - } /* end if */ - else - j = 0 ; - string[i] = ASCII_Hex[ j ] ; - } /* end for */ -} /* end of ADFI_unsignedlong_2_ASCII_Hex */ -/* end of file ADFI_unsigned_int_2_ASCII_Hex.c */ -/* file ADFI_write_data_chunk.c */ -/*********************************************************************** -ADFI write data chunk: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const struct TOKENIZED_DATA_TYPE *tokenized_data_type Array. -input: const int data_size Size of data entity in bytes. -input: const long chunk_bytes Number of bytes in data chunk. -input: const long start_offset Starting offset into the data chunk -input: const long total_bytes Number of bytes to write in data chunk. -input: const char *data Pointer to the data. If 0, zero data. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_write_data_chunk( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - const struct TOKENIZED_DATA_TYPE *tokenized_data_type, - const int data_size, - const long chunk_bytes, - const long start_offset, - const long total_bytes, - const char *data, - int *error_return ) -{ -int format_compare ; -struct DISK_POINTER current_location, end_of_chunk_tag ; - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( tokenized_data_type == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -if( total_bytes+start_offset > chunk_bytes ) { - *error_return = REQUESTED_DATA_TOO_LONG ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Write the tag **/ -ADFI_write_file( file_index, block_offset->block, block_offset->offset, - TAG_SIZE, data_chunk_start_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Calculate the end-of-chunk-tag pointer **/ -end_of_chunk_tag.block = block_offset->block ; -end_of_chunk_tag.offset = block_offset->offset + TAG_SIZE + - DISK_POINTER_SIZE + chunk_bytes ; -ADFI_adjust_disk_pointer( &end_of_chunk_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Adjust location and write end-of-chunk pointer **/ -current_location.block = block_offset->block ; -current_location.offset = block_offset->offset + TAG_SIZE ; -ADFI_adjust_disk_pointer( ¤t_location, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_write_disk_pointer_2_disk( file_index, current_location.block, - current_location.offset, &end_of_chunk_tag, error_return ) ; - -current_location.offset += start_offset + DISK_POINTER_SIZE ; -ADFI_adjust_disk_pointer( ¤t_location, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** write the data **/ -if( data == NULL ) { /** Zero out the file data **/ - - /** If the data-pointer is NULL, write zeros to the file **/ - - /** Initialize the block of zeros **/ - if( block_of_00_initialized == FALSE ) { - int i ; - for( i=0; i DISK_BLOCK_SIZE ) { - long t_bytes = total_bytes ; - - /** If the number of bytes to write is larger than the block of - zeros we have, write out a series of zero blocks... - **/ - - /** write out the remainder of this block **/ - ADFI_write_file( file_index, current_location.block, - current_location.offset, DISK_BLOCK_SIZE - current_location.offset + 1, - block_of_00, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - current_location.block++ ; - current_location.offset = 0 ; - t_bytes -= (DISK_BLOCK_SIZE - current_location.offset + 1) ; - - /** Write blocks of zeros, then a partial block **/ - while( t_bytes > 0 ) { - ADFI_write_file( file_index, current_location.block, - current_location.offset, MIN( DISK_BLOCK_SIZE, t_bytes), - block_of_00, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - t_bytes -= (MIN( DISK_BLOCK_SIZE, t_bytes)) ; - } /* end while */ - - } /* end if */ - else { - - /** Write a partial block of zeros to disk **/ - ADFI_write_file( file_index, current_location.block, - current_location.offset, total_bytes, block_of_00, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - } /* end if */ -else { - - /** check for need of data translation **/ - ADFI_file_and_machine_compare( file_index, tokenized_data_type, - &format_compare, error_return ); - if( *error_return != NO_ERROR ) - return ; - if( format_compare == 1 ) { - /** Write the data to disk **/ - ADFI_write_file( file_index, current_location.block, - current_location.offset, total_bytes, data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - else { - ADFI_write_data_translated( file_index, current_location.block, - current_location.offset, tokenized_data_type, data_size, - total_bytes, data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - } /* end else */ - - /** Write the ending tag to disk **/ -ADFI_write_file( file_index, end_of_chunk_tag.block, end_of_chunk_tag.offset, - TAG_SIZE, data_chunk_end_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -} /* end of ADFI_write_data_chunk */ -/* end of file ADFI_write_data_chunk.c */ -/* file ADFI_write_data_chunk_table.c */ -/*********************************************************************** -ADFI write data chunk table: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const int number_of_data_chunks Number of entries to write. -output: struct DATA_CHUNK_TABLE_ENTRY data_chunk_table[] Array of entries. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_write_data_chunk_table( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - const int number_of_data_chunks, - struct DATA_CHUNK_TABLE_ENTRY data_chunk_table[], - int *error_return ) -{ -struct DISK_POINTER disk_pointer, end_of_chunk_tag ; -int i ; - -if( (block_offset == NULL) || (data_chunk_table == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Write Starting boundary tag **/ -disk_pointer.block = block_offset->block ; -disk_pointer.offset = block_offset->offset ; -ADFI_write_file( file_index, disk_pointer.block, disk_pointer.offset, - TAG_SIZE, data_chunk_table_start_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -disk_pointer.offset += TAG_SIZE ; -ADFI_adjust_disk_pointer( &disk_pointer, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Calculate the end-of-chunk-tag location **/ -end_of_chunk_tag.block = disk_pointer.block ; -end_of_chunk_tag.offset = disk_pointer.offset + DISK_POINTER_SIZE + - number_of_data_chunks * 2 * DISK_POINTER_SIZE ; -ADFI_adjust_disk_pointer( &end_of_chunk_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_write_disk_pointer_2_disk( file_index, disk_pointer.block, - disk_pointer.offset, &end_of_chunk_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Write data chunk table entries **/ -disk_pointer.offset += DISK_POINTER_SIZE ; -for( i=0; i number_of_data_elements ) { - chunk_size -= ( number_of_elements_written - number_of_data_elements ) ; - delta_to_bytes = chunk_size * data_size ; - delta_from_bytes = chunk_size * machine_size ; - } - ADFI_convert_number_format( - ADF_this_machine_format, /* from format */ - ADF_this_machine_os_size, /* from os size */ - ADF_file_format[file_index], /* to format */ - ADF_file_os_size[file_index], /* to os size */ - TO_FILE_FORMAT, - tokenized_data_type, chunk_size, from_data, - to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - ADFI_write_file( file_index, disk_pointer.block, disk_pointer.offset, - delta_to_bytes, (char *)to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - from_data += delta_from_bytes ; - disk_pointer.offset += delta_to_bytes ; - if ( disk_pointer.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &disk_pointer, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - } /* end while */ - -} /* end of ADFI_write_data_translated */ -/* end of file ADFI_write_data_translated.c */ -/* file ADFI_write_disk_block.c */ -/*********************************************************************** -ADFI write disk block: -***********************************************************************/ -void ADFI_write_disk_block() -{ -fprintf(stderr,"Subroutine ADFI_write_disk_block is not yet implemented...\n" ) ; -} /* end of ADFI_write_disk_block */ -/* end of file ADFI_write_disk_block.c */ -/* file ADFI_write_disk_pointer_2_disk.c */ -/*********************************************************************** -ADFI write disk pointer 2 disk: - Given a pointer to a disk pointer, convert it to ASCII Hex - and write it to disk. - -input: const unsigned int file_index File to write to. -input: const unsigned long file_block Block within the file. -input: const unsigned long block_offset Offset within the block. -input: const struct DISK_POINTER *block_and_offset Disk pointer. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_write_disk_pointer_2_disk( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - const struct DISK_POINTER *block_and_offset, - int *error_return ) -{ -char disk_block_offset[DISK_POINTER_SIZE] ; - -if( block_and_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Convert into ASCII_Hex form **/ -ADFI_disk_pointer_2_ASCII_Hex( block_and_offset, &disk_block_offset[0], - &disk_block_offset[8], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Put the block/offset to disk **/ -ADFI_write_file( file_index, file_block, block_offset, - DISK_POINTER_SIZE, disk_block_offset, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Set the block/offset onto the stack **/ -#if 0 -ADFI_stack_control(file_index, file_block, block_offset, - SET_STK, DISK_PTR_STK, DISK_POINTER_SIZE, - disk_block_offset ); -#endif - -} /* end of ADFI_write_disk_pointer_2_disk */ -/* end of file ADFI_write_disk_pointer_2_disk.c */ -/* file ADFI_write_file.c */ -/*********************************************************************** -ADFI write file: - Write a number of bytes to an ADF file, given the file, - block, and block offset. - -input: const unsigned int file_index File to write to. -input: const unsigned long file_block Block within the file. -input: const unsigned long block_offset Offset within the block. -input: const unsigned int data_length Length of the data to write. -input: const char *data Address of the data. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -FWRITE_ERROR -***********************************************************************/ -void ADFI_write_file( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - const unsigned int data_length, - const char *data, - int *error_return ) -{ -int iret, end_block ; - -if( data == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** If the read buffer overlaps the buffer then reset it to make - sure its currrent **/ - -end_block = file_block+(block_offset+data_length)/DISK_BLOCK_SIZE+1; -if ( last_rd_file == (long int) file_index && last_rd_block >= (long int) file_block && - last_rd_block <= (long int) end_block ) - last_rd_block = last_rd_file = num_in_rd_block = -1 ; - - /** Check to see if we need to flush the write buffer. this happens if we - are writing a large chunk or the write moves out of the current block. - If the data length is zero then just flush the buffer and return. - Note that the ADF_modification_date routine will flush the buffer - after any write operations !! **/ - -if( ( (unsigned long int) data_length + block_offset > DISK_BLOCK_SIZE || - last_wr_block != (long int) file_block || last_wr_file != (long int) file_index || - data_length == 0 ) && flush_wr_block > 0 ) { - - /** Position the file **/ - ADFI_fseek_file( last_wr_file, last_wr_block, 0, error_return ) ; - if( *error_return != NO_ERROR ) { - return ; - } /* end if */ - - /** write the buffer **/ - iret=fwrite( wr_block_buffer, 1, DISK_BLOCK_SIZE, ADF_file[last_wr_file] ); - flush_wr_block = -2 ; /** Make sure we don't flush twice due to error **/ - if( iret != DISK_BLOCK_SIZE ) { - *error_return = FWRITE_ERROR ; - return ; - } /* end if */ - - /** If the write buffer overlaps the buffer then reset it to make - sure its currrent, set flush buffer flag to false. **/ - if ( last_wr_file == (long int) file_index && last_wr_block >= (long int) file_block && - last_wr_block <= (long int) end_block ) - last_wr_block = last_wr_file = -2 ; - -} /* end if */ -if ( data_length == 0 ) return; /** Just a buffer flush **/ - - /** No need to buffer large pieces of data or to take special - measures to cross block boundaries **/ - -if( data_length + block_offset > DISK_BLOCK_SIZE ) { - - /** Position the file **/ - ADFI_fseek_file( file_index, file_block, block_offset, error_return ) ; - if( *error_return != NO_ERROR ) { - return ; - } /* end if */ - - /** write the data **/ - iret = fwrite( data, 1, data_length, ADF_file[ file_index ] ) ; - if( iret != (int) data_length ) { - *error_return = FWRITE_ERROR ; - return ; - } /* end if */ - - return; -} /* end if */ - - /** For smaller pieces of data, write a block at a time. This will improve - performance if neighboring data is writen a small piece at a time - (strided reads, file overhead). - - Some assumptions apply to the block size. With some experimenting, - 1K blocks do not offer much improvement. 4K blocks (4096 bytes) - do improve performance remarkably. This is due to the fact that the - file structure is based of 4K blocks with offsets. Also the CRAY - loves 4K block writes!! - **/ - -if( (long int) file_block != last_wr_block || /*- a different block -*/ - (long int) file_index != last_wr_file ) { /*- entirely different file -*/ - - /** buffer is not current, re-read **/ - - if ( (long int) file_block == last_rd_block && (long int) file_index == last_rd_file ) { - - /* Copy data from read buffer */ - memcpy( wr_block_buffer, rd_block_buffer, DISK_BLOCK_SIZE ); - iret = num_in_rd_block; - } - else { - - /** Position the file **/ - ADFI_fseek_file( file_index, file_block, 0, error_return ) ; - if( *error_return != NO_ERROR ) { - return ; - } /* end if */ - - /** Read the data from disk **/ - iret=fread( wr_block_buffer, 1, DISK_BLOCK_SIZE, ADF_file[file_index] ) ; - if( iret == EOF || iret < DISK_BLOCK_SIZE ) { - if ( iret < 0 ) iret = 0; - memset( &wr_block_buffer[iret], (size_t) ' ', DISK_BLOCK_SIZE-iret ); - } /* end if */ - - } /* end if */ - - /** Remember buffer information **/ - last_wr_block = file_block ; - last_wr_file = file_index ; - -} /* end if */ - - /** Write into the buffer and set flush buffer flag **/ -memcpy( &wr_block_buffer[block_offset], data, data_length ); -flush_wr_block = 1 ; - -} /* end of ADFI_write_file */ -/* end of file ADFI_write_file.c */ -/* file ADFI_write_file_header.c */ -/*********************************************************************** -ADFI write file header: - To take information in the FILE_HEADER structure and format it - for disk, and write it out. -input: const int file_index File index to write to. -input: const FILE_HEADER *file_header The file header structure. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_MEMORY_TAG_ERROR -ADF_DISK_TAG_ERROR -***********************************************************************/ -void ADFI_write_file_header( - const int file_index, - const struct FILE_HEADER *file_header, - int *error_return ) -{ -char disk_header[ FILE_HEADER_SIZE ] ; - -if( file_header == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check memory tags for proper data **/ -if( strncmp( file_header->tag0, file_header_tags[0], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag1, file_header_tags[1], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag2, file_header_tags[2], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag3, file_header_tags[3], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag4, file_header_tags[4], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag5, file_header_tags[5], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -/** OK the memory tags look good, let's format the file header information - into the disk format and write it out. -**/ -strncpy( &disk_header[ 0], (char *)file_header->what, WHAT_STRING_SIZE ) ; -strncpy( &disk_header[ 32], (char *)file_header->tag0, TAG_SIZE ) ; -strncpy( &disk_header[ 36], (char *)file_header->creation_date, DATE_TIME_SIZE); -strncpy( &disk_header[ 64], (char *)file_header->tag1, TAG_SIZE ) ; -strncpy( &disk_header[ 68], (char *)file_header->modification_date, - DATE_TIME_SIZE ) ; -strncpy( &disk_header[ 96], (char *)file_header->tag2, TAG_SIZE ) ; -disk_header[100] = file_header->numeric_format ; -disk_header[101] = file_header->os_size ; -strncpy( &disk_header[102], (char *)file_header->tag3, TAG_SIZE ) ; - -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_char, 0, 255, 2, - &disk_header[106], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_short, 0, 255, 2, - &disk_header[108], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_int, 0, 255, 2, - &disk_header[110], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_long, 0, 255, 2, - &disk_header[112], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_float, 0, 255, 2, - &disk_header[114], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_double, 0, 255, 2, - &disk_header[116], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_char_p, 0, 255, 2, - &disk_header[118], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_short_p, 0, 255, 2, - &disk_header[120], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_int_p, 0, 255, 2, - &disk_header[122], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_long_p, 0, 255, 2, - &disk_header[124], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_float_p, 0, 255, 2, - &disk_header[126], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_double_p, 0, 255, 2, - &disk_header[128], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -strncpy( &disk_header[130], file_header->tag4, TAG_SIZE ) ; - -ADFI_disk_pointer_2_ASCII_Hex( &file_header->root_node, &disk_header[134], - &disk_header[142], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &file_header->end_of_file, &disk_header[146], - &disk_header[154], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &file_header->free_chunks, &disk_header[158], - &disk_header[166], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &file_header->extra, &disk_header[170], - &disk_header[178], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -strncpy( &disk_header[182], file_header->tag5, TAG_SIZE ) ; - - /** Now write the disk header out... **/ -ADFI_write_file( file_index, 0, 0, FILE_HEADER_SIZE, disk_header, - error_return ) ; - /** Set the header onto the stack **/ -ADFI_stack_control(file_index, 0, 0, SET_STK, FILE_STK, - FILE_HEADER_SIZE, disk_header ); -} /* end of ADFI_write_file_header */ -/* end of file ADFI_write_file_header.c */ -/* file ADFI_write_free_chunk.c */ -/*********************************************************************** -ADFI write free chunk: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const struct FREE_CHUNK *free_chunk Pointer to free-chunk. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_write_free_chunk( - const int file_index, - const struct DISK_POINTER *block_offset, - const struct FREE_CHUNK *free_chunk, - int *error_return ) -{ -unsigned int i ; -struct DISK_POINTER current_location ; - -if( (block_offset == NULL) || (free_chunk == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Initialize the block of 'X's **/ -if( block_of_XX_initialized == FALSE ) { - for( i=0; istart_tag, free_chunk_start_tag, TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( free_chunk->end_tag, free_chunk_end_tag, TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - - /** Write start TAG **/ -ADFI_write_file( file_index, block_offset->block, block_offset->offset, - TAG_SIZE, free_chunk->start_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Write disk pointers **/ -current_location.block = block_offset->block ; -current_location.offset = block_offset->offset + TAG_SIZE ; -ADFI_adjust_disk_pointer( ¤t_location, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_write_disk_pointer_2_disk( file_index, current_location.block, - current_location.offset, - &free_chunk->end_of_chunk_tag, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -current_location.offset += DISK_POINTER_SIZE ; -ADFI_adjust_disk_pointer( ¤t_location, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_write_disk_pointer_2_disk( file_index, current_location.block, - current_location.offset, - &free_chunk->next_chunk, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Write out a bunch of 'x's in the free chunk's empty space **/ -current_location.offset += DISK_POINTER_SIZE ; -ADFI_adjust_disk_pointer( ¤t_location, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Fill in partial end of a block **/ -if( (current_location.block != free_chunk->end_of_chunk_tag.block) && - (current_location.offset != 0 ) ) { - ADFI_write_file( file_index, current_location.block, - current_location.offset, DISK_BLOCK_SIZE - current_location.offset, - block_of_XX, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - current_location.block++ ; - current_location.offset = 0 ; - } /* end if */ - - /** Fill in intermediate whole blocks **/ -while( current_location.block < free_chunk->end_of_chunk_tag.block ) { - ADFI_write_file( file_index, current_location.block, - 0, DISK_BLOCK_SIZE, block_of_XX, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - current_location.block++ ; - } /* end if */ - - /** Fill in partial block to end-of-free-chunk **/ -if( current_location.offset < free_chunk->end_of_chunk_tag.offset ) { - ADFI_write_file( file_index, current_location.block, - current_location.offset, - free_chunk->end_of_chunk_tag.offset - current_location.offset, - block_of_XX, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - - /** Now (finally) write out the free_chunk-end_tag **/ -ADFI_write_file( file_index, current_location.block, - free_chunk->end_of_chunk_tag.offset, TAG_SIZE, free_chunk->end_tag, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -} /* end of ADFI_write_free_chunk */ -/* end of file ADFI_write_free_chunk.c */ -/* file ADFI_write_free_chunk_table.c */ -/*********************************************************************** -ADFI write free chunk table: - To take information in the FREE_CHUNK_TABLE structure and format it - for disk, and write it out. -input: const int file_index File index to write to. -input: const FREE_CHUNK_TABLE *free_chunk_table The free_chunk header struct. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_write_free_chunk_table( - const int file_index, - const struct FREE_CHUNK_TABLE *free_chunk_table, - int *error_return ) -{ -char disk_free_chunk_data[ FREE_CHUNK_TABLE_SIZE ] ; - -if( free_chunk_table == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check memory tags for proper data **/ -if( strncmp( free_chunk_table->start_tag, free_chunk_table_start_tag, - TAG_SIZE ) != 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( free_chunk_table->end_tag, free_chunk_table_end_tag, - TAG_SIZE ) != 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -/** OK the memory tags look good, let's format the free_chunk header - information into the disk format and write it out. -**/ -strncpy( &disk_free_chunk_data[ 0], (char *)free_chunk_table->start_tag, - TAG_SIZE ) ; - -ADFI_disk_pointer_2_ASCII_Hex( &free_chunk_table->small_first_block, - &disk_free_chunk_data[TAG_SIZE], - &disk_free_chunk_data[DISK_POINTER_SIZE], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &free_chunk_table->small_last_block, - &disk_free_chunk_data[16], &disk_free_chunk_data[24], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &free_chunk_table->medium_first_block, - &disk_free_chunk_data[28], &disk_free_chunk_data[36], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &free_chunk_table->medium_last_block, - &disk_free_chunk_data[40], &disk_free_chunk_data[48], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &free_chunk_table->large_first_block, - &disk_free_chunk_data[52], &disk_free_chunk_data[60], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &free_chunk_table->large_last_block, - &disk_free_chunk_data[64], &disk_free_chunk_data[72], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -strncpy( &disk_free_chunk_data[ 76], (char *)free_chunk_table->end_tag, - TAG_SIZE ) ; - - /** Now write the free_chunk header out to disk... **/ -ADFI_write_file( file_index, FREE_CHUNKS_BLOCK, FREE_CHUNKS_OFFSET, - FREE_CHUNK_TABLE_SIZE, disk_free_chunk_data, error_return ) ; - /** Set the free chunk onto the stack **/ -ADFI_stack_control(file_index, FREE_CHUNKS_BLOCK, FREE_CHUNKS_OFFSET, - SET_STK, FREE_CHUNK_STK, FREE_CHUNK_TABLE_SIZE, - disk_free_chunk_data ); -} /* end of ADFI_write_free_chunk_table */ -/* end of file ADFI_write_free_chunk_table.c */ -/* file ADFI_write_modification_date.c */ -/*********************************************************************** -ADFI write modification date: - Writes the current date/time into the modification date field of - the file header. Also updates the file version (what string) - in the header if the file version global variable has been set - - after writing, file version global variable is unset so that it is - only written once. - -input: const int file_index File index to write to. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -FWRITE_ERROR -***********************************************************************/ -void ADFI_write_modification_date( - const int file_index, - int *error_return ) -{ -int i_block_offset ; -char mod_date[DATE_TIME_SIZE] ; - - -*error_return = NO_ERROR ; - -ADFI_get_current_date( mod_date ) ; - - /** block offset depends on the location the of modification date - in the FILE_HEADER structure **/ -i_block_offset = WHAT_STRING_SIZE + TAG_SIZE + DATE_TIME_SIZE + TAG_SIZE ; -ADFI_write_file( file_index, 0, i_block_offset, DATE_TIME_SIZE, mod_date, - error_return ) ; -if( *error_return != NO_ERROR ) { - return; - } /* end if */ - - /** Flush the write buffer to ensure the file is current!! **/ -ADFI_flush_buffers( file_index, FLUSH, error_return ); -if( *error_return != NO_ERROR ) { - return; - } /* end if */ - -if( file_version_update[ file_index ][ 0 ] != '\0' ) -{ - i_block_offset = 0 ; /* what-string is first field in header */ - ADFI_write_file( file_index, 0, i_block_offset, WHAT_STRING_SIZE, - file_version_update[ file_index ], error_return ) ; - -/** reset the version to default so that it only gets updated once **/ - file_version_update[ file_index ][ 0 ] = '\0' ; - if( *error_return != NO_ERROR ) { - return; - } /* end if */ - } /* end if */ - -} /* end of ADFI_write_modification_date */ -/* end of file ADFI_write_modification_date.c */ -/* file ADFI_write_node_header.c */ -/*********************************************************************** -ADFI write node header: - To take information in the NODE_HEADER structure and format it - for disk, and write it out. -input: const int file_index File index to write to. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const NODE_HEADER *node_header The node header structure. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_write_node_header( - const int file_index, - const struct DISK_POINTER *block_offset, - const struct NODE_HEADER *node_header, - int *error_return ) -{ -int i ; -char disk_node_data[ NODE_HEADER_SIZE ] ; - -if( (block_offset == NULL) || (node_header == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -/** Check memory tags for proper data **/ -if( strncmp( node_header->node_start_tag, node_start_tag, TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( node_header->node_end_tag, node_end_tag, TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -/** OK the memory tags look good, let's format the node header information - into the disk format and write it out. -**/ -strncpy( &disk_node_data[ 0], (char *)node_header->node_start_tag, TAG_SIZE ) ; -strncpy( &disk_node_data[ TAG_SIZE], (char *)node_header->name, - ADF_NAME_LENGTH ); -strncpy( &disk_node_data[ 36], (char *)node_header->label, ADF_LABEL_LENGTH ) ; - -ADFI_unsigned_int_2_ASCII_Hex( node_header->num_sub_nodes, 0, - MAXIMUM_32_BITS, 8, &disk_node_data[ 68], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_unsigned_int_2_ASCII_Hex( node_header->entries_for_sub_nodes, 0, - MAXIMUM_32_BITS, 8, &disk_node_data[ 76], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &node_header->sub_node_table, - &disk_node_data[84], &disk_node_data[92], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -strncpy( &disk_node_data[ 96], (char *)node_header->data_type, - ADF_DATA_TYPE_LENGTH ) ; - -ADFI_unsigned_int_2_ASCII_Hex( node_header->number_of_dimensions, 0, - 12, 2, &disk_node_data[128], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -for( i=0; idimension_values[i], 0, - MAXIMUM_32_BITS, 8, &disk_node_data[130+(i*8)], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end for */ - -ADFI_unsigned_int_2_ASCII_Hex( node_header->number_of_data_chunks, 0, - 65535, 4, &disk_node_data[226], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &node_header->data_chunks, - &disk_node_data[230], &disk_node_data[238], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -strncpy( &disk_node_data[242], (char *)node_header->node_end_tag, TAG_SIZE ) ; - - /** Now write the node-header out to disk... **/ -ADFI_write_file( file_index, block_offset->block, block_offset->offset, - NODE_HEADER_SIZE, disk_node_data, error_return ) ; - /** Set the header onto the stack **/ -ADFI_stack_control(file_index, block_offset->block, block_offset->offset, - SET_STK, NODE_STK, NODE_HEADER_SIZE, disk_node_data ); -} /* end of ADFI_write_node_header */ -/* end of file ADFI_write_node_header.c */ -/* file ADFI_write_sub_node_table.c */ -/*********************************************************************** -ADFI write sub node table: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const int number_of_sub_nodes Number of sub-node entries. -input: struct SUB_NODE_TABLE_ENTRY sub_node_table[] Array of sub-node entries. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_write_sub_node_table( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - const int number_of_sub_nodes, - struct SUB_NODE_TABLE_ENTRY sub_node_table[], - int *error_return ) -{ -int i ; -struct DISK_POINTER end_of_chunk_tag, current_child ; - -if( (block_offset == NULL) || (sub_node_table == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** calculate the end-of-chunk tag pointer **/ -end_of_chunk_tag.block = block_offset->block ; -end_of_chunk_tag.offset = block_offset->offset + TAG_SIZE + DISK_POINTER_SIZE + - number_of_sub_nodes * (ADF_NAME_LENGTH + DISK_POINTER_SIZE) ; -ADFI_adjust_disk_pointer( &end_of_chunk_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Write start TAG **/ -ADFI_write_file( file_index, block_offset->block, block_offset->offset, - TAG_SIZE, sub_node_start_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Write disk pointer **/ -current_child.block = block_offset->block ; -current_child.offset = block_offset->offset + TAG_SIZE ; -ADFI_adjust_disk_pointer( ¤t_child, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_write_disk_pointer_2_disk( file_index, current_child.block, - current_child.offset, &end_of_chunk_tag, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Format and write out the table entries **/ -current_child.offset += DISK_POINTER_SIZE ; -for( i=0; ichild_name, - ADF_NAME_LENGTH ) ; -ADFI_disk_pointer_2_ASCII_Hex( &sub_node_table_entry->child_location, - &sub_node_entry_disk_data[ ADF_NAME_LENGTH ], - &sub_node_entry_disk_data[ ADF_NAME_LENGTH + 8 ], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Now write it out to disk **/ -ADFI_write_file( file_index, block_offset->block, block_offset->offset, - ADF_NAME_LENGTH + DISK_POINTER_SIZE, - sub_node_entry_disk_data, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Set the subnode onto the stack **/ -ADFI_stack_control(file_index, block_offset->block, block_offset->offset, - SET_STK, SUBNODE_STK, ADF_NAME_LENGTH + DISK_POINTER_SIZE, - sub_node_entry_disk_data ); - -} /* end of ADFI_write_sub_node_table_entry */ -/* end of file ADFI_write_sub_node_table_entry.c */ -/* file ADFI_strtok.c */ -/*********************************************************************** -ADFI get string token: This routine simulates strtok except it returns the -current postion in the string tobe used later. Thas avoids the problem of -trying using strtok in a recrusive subroutine call which does not work! - -input/output: *string - the string to parse tokens from. - returns string with token replaced by nil. -input/output: *string_pos - the string position to begin parsing should - be placed at the beginning of the string. - returns postion after last token to continue - string parsing. Token may change from last call. -input: *token - The token to search for. -function return: - a pointer to the desired substring. - A NULL returns indicates the end of the string. - -***********************************************************************/ -char *ADFI_strtok( - char *string, - char **string_pos, - char *token ) -{ - char *tmp_ptr ; - char *sub_string ; - int string_len ; - - if ( string_pos == NULL ) return NULL ; - if( token == NULL || string == NULL || *string_pos == NULL ) return NULL ; - - /* Get the length left in the string */ - - string_len = strlen ( *string_pos ) ; - if ( string_len == 0 ) return NULL ; - - /* Find the first character in the string which does not match the token */ - tmp_ptr = *string_pos ; - while ( string_len > 0 ) { - if ( tmp_ptr[0] == token[0] ) { - tmp_ptr++ ; - string_len-- ; - } - else { - break ; - } /* end if */ - } /* end while */ - if ( string_len == 0 ) return NULL ; - - /* Set the begining fof the sub string */ - sub_string = tmp_ptr ; - - /* Find the next token or the end of the string */ - - while ( string_len > 0 ) { - if ( tmp_ptr[0] != token[0] ) { - tmp_ptr++ ; - string_len-- ; - } - else { - tmp_ptr[0] = '\0' ; - break ; - } /* end if */ - } /* end while */ - - /* Set location for the next search */ - - if ( string_len > 0 ) - *string_pos = &tmp_ptr[1] ; - else - *string_pos = NULL ; - - return sub_string ; - -} /* end of ADFI_strtok */ -/* end of file ADFI_strtok.c */ -/* end of combine 2.0 */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/Make/files b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/Make/files deleted file mode 100644 index 1d19a3db9e..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/Make/files +++ /dev/null @@ -1,5 +0,0 @@ -ADF_fortran_2_c.c -ADF_interface.c -ADF_internals.c - -LIB = $(FOAM_LIBBIN)/libadf diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/Make/options b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/Make/options deleted file mode 100644 index 8797e717b1..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/Make/options +++ /dev/null @@ -1,6 +0,0 @@ -EXE_INC = \ - -I.. - -EXE_LIBS = \ - -ladf - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/Makefile b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/Makefile deleted file mode 100644 index fa1706d3ce..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -include ../../config/Makeflags.sys - -OBJ_DIR = $(BUILD_HOME)/libccmio/libadf -TARGET_SO_NAME = adf -SOURCES = $(wildcard *.cpp) - -INCLUDE_PATH := \ - -I$(STAR_HOME)/base/src\ - -I$(STAR_HOME)/libccmio - -# Because .cpp files #include .c files, need to -# allow dependency cache to deal with removed .c files -%.c: - @echo '# Ignoring missing $@' -include $(STAR_HOME)/config/Makefile.shared_object -include $(STAR_HOME)/config/Makefile.objects diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/Makefile.adf b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/Makefile.adf deleted file mode 100644 index a97755fa35..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/Makefile.adf +++ /dev/null @@ -1,174 +0,0 @@ -############################################################################# -# Makefile for building: libadf.so.5.01.000 -# Generated by qmake (1.07a) (Qt 3.3.2) on: Wed Aug 9 13:52:08 2006 -# Project: adf.pro -# Template: lib -# Command: $(QMAKE) -spec /home/hunt2/mattijs/OpenFOAM/mattijs-1.3.1/applications/utilities/ccm24ToFoam/libccmio-2.6.1/libadf/..//config/linux64_2.4-x86-glibc_2.2.5 "RELEASEMODE=" "LIBMODE=dynamic" "PROFILEMODE=" "CC=gcc" "CXX=g++" -o Makefile.adf adf.pro -############################################################################# - -####### Compiler, tools and options - -CC = gcc -CXX = g++ -LEX = flex -YACC = yacc -CFLAGS = -m64 -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wall -W -g -fPIC -DLINUX64_2_4_X86_GLIBC_2_2_5 -CXXFLAGS = -m64 -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fexceptions -Wall -W -g -fPIC -DLINUX64_2_4_X86_GLIBC_2_2_5 -LEXFLAGS = -YACCFLAGS= -d -INCPATH = -I/home/hunt2/mattijs/OpenFOAM/mattijs-1.3.1/applications/utilities/ccm24ToFoam/libccmio-2.6.1/config/linux64_2.4-x86-glibc_2.2.5 -I. -I.. -I..//include -LINK = g++ -LFLAGS = -shared -Wl,-soname,libadf.so.5 -Wl,-rpath,/home/hunt2/mattijs/OpenFOAM/mattijs-1.3.1/applications/utilities/ccm24ToFoam/libccmio-2.6.1/lib/linux64_2.4-x86-glibc_2.2.5/debug-shared -LIBS = $(SUBLIBS) -AR = ar cqs -RANLIB = -MOC = $(QTDIR)/bin/moc -UIC = $(QTDIR)/bin/uic -QMAKE = ../config/linux64_2.4-x86-glibc_2.2.5/qmake -TAR = tar -cf -GZIP = gzip -9f -COPY = cp -f -p -COPY_FILE= $(COPY) -COPY_DIR = $(COPY) -r -INSTALL_FILE= $(COPY_FILE) -INSTALL_DIR = $(COPY_DIR) -DEL_FILE = rm -f -SYMLINK = ln -sf -DEL_DIR = rmdir -MOVE = mv -f -CHK_DIR_EXISTS= test -d -MKDIR = mkdir -p - -####### Output directory - -OBJECTS_DIR = ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ - -####### Files - -HEADERS = ADF.h \ - ADF_internals.h -SOURCES = ADF_fortran_2_c.c \ - ADF_interface.c \ - ADF_internals.c -OBJECTS = ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ADF_fortran_2_c.o \ - ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ADF_interface.o \ - ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ADF_internals.o -FORMS = -UICDECLS = -UICIMPLS = -SRCMOC = -OBJMOC = -DIST = ../config/config.pro \ - ../config/ccm.pro \ - version.pro \ - adf.pro -QMAKE_TARGET = adf -DESTDIR = ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/ -TARGET = libadf.so.5.01.000 -TARGETA = ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/libadf.a -TARGETD = libadf.so.5.01.000 -TARGET0 = libadf.so -TARGET1 = libadf.so.5 -TARGET2 = libadf.so.5.01 - -first: all -####### Implicit rules - -.SUFFIXES: .c .o .cpp .cc .cxx .C - -.cpp.o: - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< - -.cc.o: - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< - -.cxx.o: - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< - -.C.o: - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< - -.c.o: - $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< - -####### Build rules - -all: Makefile.adf ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET) - -../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP) - test -d ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/ || mkdir -p ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/ - -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) - $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP) - -ln -s $(TARGET) $(TARGET0) - -ln -s $(TARGET) $(TARGET1) - -ln -s $(TARGET) $(TARGET2) - -$(DEL_FILE) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET) - -$(DEL_FILE) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET0) - -$(DEL_FILE) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET1) - -$(DEL_FILE) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET2) - -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/ - - - -staticlib: $(TARGETA) - -$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP) - -$(DEL_FILE) $(TARGETA) - $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) - -mocables: $(SRCMOC) -uicables: $(UICDECLS) $(UICIMPLS) - -$(MOC): - ( cd $(QTDIR)/src/moc && $(MAKE) ) - -Makefile.adf: adf.pro /home/hunt2/mattijs/OpenFOAM/mattijs-1.3.1/applications/utilities/ccm24ToFoam/libccmio-2.6.1/config/linux64_2.4-x86-glibc_2.2.5/qmake.conf ../config/config.pro \ - ../config/ccm.pro \ - version.pro - $(QMAKE) -spec /home/hunt2/mattijs/OpenFOAM/mattijs-1.3.1/applications/utilities/ccm24ToFoam/libccmio-2.6.1/libadf/..//config/linux64_2.4-x86-glibc_2.2.5 "RELEASEMODE=" "LIBMODE=dynamic" "PROFILEMODE=" "CC=gcc" "CXX=g++" -o Makefile.adf adf.pro -qmake: - @$(QMAKE) -spec /home/hunt2/mattijs/OpenFOAM/mattijs-1.3.1/applications/utilities/ccm24ToFoam/libccmio-2.6.1/libadf/..//config/linux64_2.4-x86-glibc_2.2.5 "RELEASEMODE=" "LIBMODE=dynamic" "PROFILEMODE=" "CC=gcc" "CXX=g++" -o Makefile.adf adf.pro - -dist: - @mkdir -p ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/adf && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/adf/ && ( cd `dirname ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/adf` && $(TAR) adf.tar adf && $(GZIP) adf.tar ) && $(MOVE) `dirname ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/adf`/adf.tar.gz . && $(DEL_FILE) -r ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/adf - -mocclean: -uiclean: - -yaccclean: -lexclean: -clean: - -$(DEL_FILE) $(OBJECTS) - -$(DEL_FILE) *~ core *.core - - -####### Sub-libraries - -distclean: clean - -$(DEL_FILE) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET) $(TARGET) - -$(DEL_FILE) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET0) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET1) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET2) $(TARGETA) - - -FORCE: - -####### Compile - -../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ADF_fortran_2_c.o: ADF_fortran_2_c.c - $(CC) -c $(CFLAGS) $(INCPATH) -o ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ADF_fortran_2_c.o ADF_fortran_2_c.c - -../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ADF_interface.o: ADF_interface.c ADF.h \ - ADF_internals.h \ - ADF_fbind.h - $(CC) -c $(CFLAGS) $(INCPATH) -o ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ADF_interface.o ADF_interface.c - -../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ADF_internals.o: ADF_internals.c ADF.h \ - ADF_internals.h \ - ADF_fbind.h - $(CC) -c $(CFLAGS) $(INCPATH) -o ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ADF_internals.o ADF_internals.c - -####### Install - -install: - -uninstall: - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/Makefile.qmake b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/Makefile.qmake deleted file mode 100644 index 98d665f3c1..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/Makefile.qmake +++ /dev/null @@ -1,4 +0,0 @@ -PATHTOSRC = ../ -PROJECT = adf - -include ../config/Makefile.main diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/adf.pro b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/adf.pro deleted file mode 100644 index fec7a6897d..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/adf.pro +++ /dev/null @@ -1,20 +0,0 @@ -TEMPLATE = lib -windows-vc.net:TEMPLATE = vclib -windows-vc.net:config += release -TARGET = adf -PATHTOSRC = ../ - -include($$PATHTOSRC/config/ccm.pro) -include(version.pro) - -HEADERS += \ - ADF.h \ - ADF_internals.h - -SOURCES += \ - ADF_fortran_2_c.c \ - ADF_interface.c \ - ADF_internals.c - -windows-x86:dll:QMAKE_LFLAGS_RELEASE -= $$QMAKE_LFLAGS_RELEASE -windows-vc.net:DEFINES += WINDOWS_X86 diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/make.version.sc b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/make.version.sc deleted file mode 100755 index fe60662d0e..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/make.version.sc +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -grep "@(#)ADF Library Version" | cut -f2 -d"=" | cut -f1 -d">" | awk '{ major = index("ABCDEFGHIJKLMNOPQRSTUVWXYZ",substr($4,1,1)); if (major == 0) index("abcdefghijklmnopqrstuvwxyz",substr($4,1,1)); minor = substr($4,2,2); revision = 0; printf "VERSION=%d.%02d.%03d\n", major, minor, revision; }' diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/makefile.win b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/makefile.win deleted file mode 100644 index 41c5123ace..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/makefile.win +++ /dev/null @@ -1,20 +0,0 @@ -# Microsoft NMAKE File - -# Module specific variables -MODNAM=adf - -# Extra cpp options -CPPDEFS=$(CPPDEFS) /D_WIN32 /DWINNT /DADFLIB - -# Lib path -LIBDIRS= - -# Link dependencies -LINK_DEPS= - -# Build a static lib rather than a dll -STATICLIB=1 - -# End of module specific variables - -!INCLUDE "$(DEV_HOME)\star\config\makelib.win" diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/patch/ADF_internals.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/patch/ADF_internals.c deleted file mode 100644 index 1b7fcac37c..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/patch/ADF_internals.c +++ /dev/null @@ -1,8298 +0,0 @@ -/* created by combine 2.0 */ -/* file ADFI_AAA_var.c */ -/*** -File: ADF_internals.c - ---------------------------------------------------------------------- - BOEING - ---------------------------------------------------------------------- - Project: CGNS - Author: Tom Dickens 234-1024 tpd6908@yak.ca.boeing.com - Date: 3/2/1995 - Purpose: Provide the underlying support for the ADF-Core. - ---------------------------------------------------------------------- - ---------------------------------------------------------------------- -Notes: Integer numbers are stored on disk as ASCII-hex numbers. - 2 bytes gives a number from 0 to 255, - 4 bytes 0 to 65,535, - 8 bytes 0 to 4,294,967,295, - and 12 bytes from 0 to 281,474,976,710,655. - -Pointers are 12 bytes. - 8 bytes pointing to a 4096-byte chunk on disk, - and 4 bytes is an offset into that chunk. -This gives a maximum file size of 17,592,186,048,512 bytes (17.5 Tera bytes). - - ---------------------------------------------------------------------- - The tables below detail the format of the information which - makes up the ADF file. - - There are 7 different, unique types of data "chunks" used. - Three of these are of fixed length, and the other four are - variable in length. - - With the exception of numeric data (user's data), all information - in an ADF file is written in ASCII. - - Uniquely-defined boundary-tags are used to surround all "chunks" - of information. These tags are checked to confirm "chunk" type - and also to ensure data integrity. - ---------------------------------------------------------------------- - 186 Physical disk-First block -bytes start end description range / format - 32 0 31 "what" description "@(#)ADF Database Version AXXxxx>" - 4 32 35 "AdF0" boundary tag Tag - 28 36 63 Creation date/time "Wed Apr 19 09:33:25 1995 " - 4 64 67 "AdF1" boundary tag Tag - 28 68 95 Modification date/time "Wed Apr 19 09:33:29 1995 " - 4 96 99 "AdF2" boundary tag Tag - 1 100 100 Numeric format ['B', 'L', 'C', 'N'] - 1 101 101 Duplicate of numeric format ['B', 'L', 'C', 'N'] - 4 102 105 "AdF3" boundary tag Tag - 2 106 107 sizeof( char ) 0 to 255 - 2 108 109 sizeof( short ) 0 to 255 - 2 110 111 sizeof( int ) 0 to 255 - 2 112 113 sizeof( long ) 0 to 255 - 2 114 115 sizeof( float ) 0 to 255 - 2 116 117 sizeof( double ) 0 to 255 - 2 118 119 sizeof( char * ) 0 to 255 - 2 120 121 sizeof( short * ) 0 to 255 - 2 122 123 sizeof( int *) 0 to 255 - 2 124 125 sizeof( long * ) 0 to 255 - 2 126 127 sizeof( float *) 0 to 255 - 2 128 129 sizeof( double *) 0 to 255 - 4 130 133 "AdF4" boundary tag Tag - 12 134 145 Root-node header pointer Disk chunk, chunk offset. - 12 146 157 End-of-File pointer Disk chunk, chunk offset. - 12 158 169 Free-Chunk table pointer Disk chunk, chunk offset. - 12 170 181 Extra pointer Disk chunk, chunk offset. - 4 182 185 "AdF5" boundary tag Tag - - - 80 Free-Chunk table -bytes start end description range / format - 4 0 3 "fCbt" boundary tag Tag - 12 4 15 First small block pointer Disk chunk, chunk offset. - 12 16 27 Last small block pointer Disk chunk, chunk offset. - 12 28 39 First medium block pointer Disk chunk, chunk offset. - 12 40 51 Last medium block pointer Disk chunk, chunk offset. - 12 52 63 First large block pointer Disk chunk, chunk offset. - 12 64 75 Last large block pointer Disk chunk, chunk offset. - 4 76 79 "fcte" boundarg tag Tag - - - Variable: min 32 Free Chunk -bytes start end description range / format - 4 0 3 "FreE" boundary tag Tag - 12 4 15 Pointer to End-of-Chunk-Tag - 12 16 27 Pointer to Next-Chunk in list - 0 28 - more free space - 4 28 31 "EndC" boundarg tag Tag - -Note: There can occur other free space "gas" in the file which are smaller - than the 32-bytes needed to have tags and pointers. The convention - in these cases is to just fill the entire free space with the letter - z, lower-case. - - 246 Node header -bytes start end description range / format - 4 0 3 "NoDe" boundary tag Tag - 32 4 35 Name Text: Blank filled - 32 36 67 Label Text: Blank filled - 8 68 75 Number of sub-nodes 0 to 4,294,967,295 - 8 76 83 Entries for sub-nodes 0 to 4,294,967,295 - 12 84 95 Pointer to sub-node table Disk chunk, chunk offset. - 32 96 127 Data-type Text: Blank filled - 2 128 129 Number of dimensions 0 to 12 - 8 130 137 Dimension value 0 0 to 4,294,967,295 - 8 138 145 Dimension value 1 0 to 4,294,967,295 - 8 146 153 Dimension value 2 0 to 4,294,967,295 - 8 154 161 Dimension value 3 0 to 4,294,967,295 - 8 162 169 Dimension value 4 0 to 4,294,967,295 - 8 170 177 Dimension value 5 0 to 4,294,967,295 - 8 178 185 Dimension value 6 0 to 4,294,967,295 - 8 186 193 Dimension value 7 0 to 4,294,967,295 - 8 194 201 Dimension value 8 0 to 4,294,967,295 - 8 202 209 Dimension value 9 0 to 4,294,967,295 - 8 210 217 Dimension value 10 0 to 4,294,967,295 - 8 218 225 Dimension value 11 0 to 4,294,967,295 - 4 226 229 Number of data chunks 0 to 65,535 - 12 230 241 Pointer to data chunk (or table) Disk chunk, chunk offset. - 4 242 245 "TaiL" boundary tag Tag - - - Variable: min 64 Sub-node table -bytes start end description range / format - 4 0 3 "SNTb" boundary tag Tag - 12 4 15 Pointer to End-of-Table-Tag - 32 16 47 Child's name Text: Blank filled - 12 48 59 Pointer to child Disk chunk, chunk offset. - 32 - - Child's name Text: Blank filled - 12 - - Pointer to child Disk chunk, chunk offset. - 32 - - Child's name Text: Blank filled - 12 - - Pointer to child Disk chunk, chunk offset. - 32 - - Child's name Text: Blank filled - 12 - - Pointer to child Disk chunk, chunk offset. - 32 - - Child's name Text: Blank filled - 12 - - Pointer to child Disk chunk, chunk offset. - 32 - - Child's name Text: Blank filled - 12 - - Pointer to child Disk chunk, chunk offset. - 4 60 63 "snTE" boundary tag Tag - - - Variable: min 44 Data-chunk table -bytes start end description range / format - 4 0 3 "DCtb" boundary tag Tag - 12 4 15 Pointer to End-of-Table-Tag - 12 16 27 Pointer to data start Disk chunk, chunk offset. - 12 28 39 Pointer to data end Disk chunk, chunk offset. - 12 - - Pointer to data start Disk chunk, chunk offset. - 12 - - Pointer to data end Disk chunk, chunk offset. - 12 - - Pointer to data start Disk chunk, chunk offset. - 12 - - Pointer to data end Disk chunk, chunk offset. - 12 - - Pointer to data start Disk chunk, chunk offset. - 12 - - Pointer to data end Disk chunk, chunk offset. - 4 40 43 "dcTE" boundarg tag Tag - - - Variable: min 32 Data-chunks -(Minimum is 32 bytes, which cooresponds to the size required for a free-chunk) -bytes start end description range / format - 4 0 3 "DaTa" boundary tag Tag - 12 4 15 Pointer to End-of-Data-Tag - 16 16 27 The data - 4 28 31 "dEnD" boundarg tag Tag - -**/ -/*********************************************************************** - Includes -***********************************************************************/ -#include -#include -#include -#include -#include -#include -#ifdef _WIN32 -#include -#else -#include -#include -#endif -#include "ADF.h" -#include "ADF_internals.h" - -/*********************************************************************** - Global variables: - file_in_use: Used to track the files currently in use. - 0 if file is NOT in use. - 1 if file IS in use. - first_file_in_system: If a file is opened which is a sub-tree - of a parent ADF structure, first_file_in_system is the index - of the top parent file. - ADF_FILE: The system-returned file descriptor of an opened file. - names_of_files: Names of opened files. - file_open_mode: The mode the file was opened in. - file_version_update: If library file version is greater than - file version, library file version (what-string) is temporarily - stored in this array to update to the file. The file only - needs its version updated once while open, so don't expect the - version to persist until file closing. Otherwise, the first - byte in the string is null ('\0'). -***********************************************************************/ -static unsigned char file_in_use[ MAXIMUM_FILES] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 - } ; - - /** We need to track the top file in a system so that when the - system is closed, all files associated with it can also be closed. - **/ -static int first_file_in_system[MAXIMUM_FILES] ; -static FILE *ADF_file[MAXIMUM_FILES] ; -static char names_of_files[MAXIMUM_FILES][ADF_FILENAME_LENGTH] ; -static char file_open_mode[MAXIMUM_FILES][10] ; -static char file_version_update[MAXIMUM_FILES][WHAT_STRING_SIZE+1]; - - /** Track the format of this machine as well as the format - of eack of the files. This is used for reading and - writing numeric data associated with the nodes, which may - include numeric-format translations. - **/ -static char ADF_file_format[MAXIMUM_FILES] ; -static char ADF_file_os_size[MAXIMUM_FILES] ; -static char ADF_this_machine_format = UNDEFINED_FORMAT_CHAR ; -static char ADF_this_machine_os_size = UNDEFINED_FORMAT_CHAR ; - - /** we need a block of "zz"-bytes for dead-space **/ -static char block_of_ZZ[ SMALLEST_CHUNK_SIZE ] ; -static int block_of_ZZ_initialized = FALSE ; - /** we need a block of "xx"-bytes for free-blocks **/ -static char block_of_XX[ DISK_BLOCK_SIZE ] ; -static int block_of_XX_initialized = FALSE ; - /** we need a block of null-bytes for disk conditioning **/ -static char block_of_00[ DISK_BLOCK_SIZE ] ; -static int block_of_00_initialized = FALSE ; - - /** read/write conversion buffer **/ -#define CONVERSION_BUFF_SIZE 100000 -static unsigned char from_to_data[ CONVERSION_BUFF_SIZE ] ; - - /** read/write buffering variables **/ -static char rd_block_buffer[DISK_BLOCK_SIZE] ; -static long last_rd_block = -1 ; -static long last_rd_file = -1 ; -static long num_in_rd_block = -1 ; -static char wr_block_buffer[DISK_BLOCK_SIZE] ; -static long last_wr_block = -2 ; -static long last_wr_file = -2 ; -static int flush_wr_block = -2 ; -enum { FLUSH, FLUSH_CLOSE }; - - /** Assumed machine variable sizes for the currently supported - machines. For ordering of data see the Figure_Machine_Format - function. Note that when openning a new file not in the machine - format these are the sizes used!! **/ -enum { TO_FILE_FORMAT, FROM_FILE_FORMAT } ; -#define NUMBER_KNOWN_MACHINES 5 -static size_t machine_sizes[NUMBER_KNOWN_MACHINES][16] = { - /* IEEE BIG 32 */ 1, 1, 1, 2, 2, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, - /* IEEE SML 32 */ 1, 1, 1, 2, 2, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, - /* IEEE BIG 64 */ 1, 1, 1, 2, 2, 4, 4, 8, 8, 4, 8, 8, 8, 8, 8, 8, - /* IEEE SML 64 */ 1, 1, 1, 2, 2, 4, 4, 8, 8, 4, 8, 8, 8, 8, 8, 8, - /* CRAY 64 */ 1, 1, 1, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 } ; - -/*********************************************************************** - pows: Powers of 16, from 16^0 to 16^7 - ASCII_Hex: Hex numbers from 0 to 15. -***********************************************************************/ -static const unsigned int pows[8] = { /** Powers of 16 **/ - 1, 16, 256, 4096, 65536, 1048576, 16777216, 268435456 } ; -static const char ASCII_Hex[16] = { - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' } ; - -/*********************************************************************** - Priority Stack Buffer is used to buffer some of the overhead of - reading small blocks of file control information like the node - header by saving the data into a memory buffer. The buffer has - a priority value associated with it and is used to determine - which entry to replace when the stack is full!! Each stack entry - could be as large as 274 bytes since the stack data could be for - a node where NODE_HEADER_SIZE = 246. -***********************************************************************/ -#define MAX_STACK 50 -static struct { - int file_index; - unsigned int file_block; - unsigned int block_offset; - int stack_type; - char *stack_data; - int priority_level; -} PRISTK[MAX_STACK] ; -static int STACK_INIT=-1; -/* Define stack types */ -enum { FILE_STK=1, NODE_STK, DISK_PTR_STK, FREE_CHUNK_STK, SUBNODE_STK }; -/* Define stack control modes */ -enum { INIT_STK, CLEAR_STK, CLEAR_STK_TYPE, DEL_STK_ENTRY, GET_STK, SET_STK }; -/*********************************************************************** - Defined macros -***********************************************************************/ -#define EVAL_2_BYTES( C0, C1 ) (((C0)<<8)+((C1))) -#define EVAL_4_BYTES( C0, C1, C2, C3 ) (((C0)<<24)+((C1)<<16)+((C2)<<8)+((C3))) -/* end of file ADFI_AAA_var.c */ -/* file ADFI_ASCII_Hex_2_unsigned_int.c */ -/*********************************************************************** -ADFI ASCII Hex to unsigned int: - Convert a number of ASCII-HEX into an unsigned integer. - -input: const unsigned int minimum Expected minimum number. -input: const unsigned int maximum Expected maximum number. -input: const unsigned int string_length Length (bytes) of the input string. -input: const char string[] The input string. -output: unsigned int *number The resulting number. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -STRING_LENGTH_ZERO -STRING_LENGTH_TOO_BIG -STRING_NOT_A_HEX_STRING -NUMBER_LESS_THAN_MINIMUM -NUMBER_GREATER_THAN_MAXIMUM -***********************************************************************/ -void ADFI_ASCII_Hex_2_unsigned_int( - const unsigned int minimum, - const unsigned int maximum, - const unsigned int string_length, - const char string[], - unsigned int *number, - int *error_return ) -{ -unsigned int i, /** Index from 0 to string_length - 1 **/ - ir, /** Index from string_length - 1 to 0 **/ - j, /** Temoprary integer variable **/ - num ; /** Working value of ther number **/ - -if( string == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( string_length == 0 ) { - *error_return = STRING_LENGTH_ZERO ; - return ; - } /* end if */ - -if( number == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( string_length > 8 ) { - *error_return = STRING_LENGTH_TOO_BIG ; - return ; - } /* end if */ - -if( minimum > maximum ) { - *error_return = MINIMUM_GT_MAXIMUM ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Convert the ASCII-Hex string into decimal **/ -num = 0 ; -for( i=0, ir=string_length - 1; i maximum ) { - *error_return = NUMBER_GREATER_THAN_MAXIMUM ; - return ; - } /* end if */ - - /** Return the number **/ -*number = num ; -} /* end of ADFI_ASCII_Hex_2_unsigned_int */ -/* end of file ADFI_ASCII_Hex_2_unsigned_int.c */ -/* file ADFI_Abort.c */ -/*********************************************************************** -ADFI Abort: - Do any cleanup and then shut the application down. - -input: const int error_code Error which caused the Abort. -output: -none- Hey, we ain't coming back... -***********************************************************************/ -void ADFI_Abort( - const int error_code ) -{ -printf("ADF Aborted: Exiting\n" ) ; -exit( error_code ) ; -} /* end of ADFI_Abort */ -/* end of file ADFI_Abort.c */ -/* file ADFI_ID_2_file_block_offset.c */ -/*********************************************************************** -ADFI ID to file block and offset: - - The ID is a combination of the file-index, the block within the - file, and an offset within the block. - - the file index is an unsigned 16-bit int. - block pointer is a 32-bit unsigned int. - block offset is a 16-bit unsigned int. - -input: const double ID Given ADF ID. -output: unsigned int *file_index File index from the ID. -output: unsigned long *file_block File block from the ID. -output: unsigned long *block_offset Block offset from the ID. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -FILE_INDEX_OUT_OF_RANGE -BLOCK_OFFSET_OUT_OF_RANGE -***********************************************************************/ -void ADFI_ID_2_file_block_offset( - const double ID, - unsigned int *file_index, - unsigned long *file_block, - unsigned long *block_offset, - int *error_return ) -{ -unsigned char * cc; - -if( (file_index == NULL) || (file_block == NULL) || (block_offset == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( ID == 0.0 ) { - *error_return = NODE_ID_ZERO ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; -cc = (unsigned char *) &ID; -#ifdef PRINT_STUFF -printf("In ADFI_ID_2_file_block_offset: ID=%lf\n",ID); -printf("cc[0-7] = %02X %02X %02X %02X %02X %02X %02X %02X \n", - cc[0], cc[1], cc[2], cc[3], - cc[4], cc[5], cc[6], cc[7] ) ; -#endif - /** Unmap the bytes from the character **/ -if ( ADF_this_machine_format == IEEE_BIG_FORMAT_CHAR ) { - *file_index = cc[1] + ((cc[0]<<8) & 0x003f) ; - *file_block = cc[2] + (cc[3]<<8) + - (cc[4]<<16) + (cc[5]<<24) ; - *block_offset = cc[6] + (cc[7]<<8) ; - } /* end if */ -else if ( ADF_this_machine_format == IEEE_LITTLE_FORMAT_CHAR ) { - *file_index = cc[6] + ((cc[7]<<8) & 0x003f) ; - *file_block = cc[2] + (cc[3]<<8) + - (cc[4]<<16) + (cc[5]<<24) ; - *block_offset = cc[0] + (cc[1]<<8) ; - } /* end else if */ -else { - *file_index = cc[0] + (cc[1]<<8) ; - *file_block = cc[2] + (cc[3]<<8) + - (cc[4]<<16) + (cc[5]<<24) ; - *block_offset = cc[6] + (cc[7]<<8) ; - } /* end else */ - -#ifdef PRINT_STUFF - printf("*file_index=%d, *file_block=%d, *block_offset=%d\n", - *file_index, *file_block, *block_offset); -#endif - -if( *file_index >= MAXIMUM_FILES ) { - *error_return = FILE_INDEX_OUT_OF_RANGE ; - return ; - } /* end if */ - -if( *block_offset >= DISK_BLOCK_SIZE ) { - *error_return = BLOCK_OFFSET_OUT_OF_RANGE ; - return ; - } /* end if */ -} /* end of ADFI_ID_2_file_block_offset */ -/* end of file ADFI_ID_2_file_block_offset.c */ -/* file ADFI_add_2_sub_node_table.c */ -/*********************************************************************** -ADFI add 2 sub node table: - Add a child to a parent's sub-node table. - -input: const int file_index Index of ADF file. -input: const struct DISK_POINTER *parent Location of the parent -input: const struct DISK_POINTER *child Location of the child. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -SUB_NODE_TABLE_ENTRIES_BAD -MEMORY_ALLOCATION_FAILED -***********************************************************************/ -void ADFI_add_2_sub_node_table( - const int file_index, - const struct DISK_POINTER *parent, - const struct DISK_POINTER *child, - int *error_return ) -{ -struct NODE_HEADER parent_node, child_node ; -struct SUB_NODE_TABLE_ENTRY *sub_node_table ; -struct DISK_POINTER tmp_disk_ptr ; -unsigned int old_num_entries ; -int i ; - -if( (parent == NULL) || (child == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Get node_header for the node (parent) **/ -ADFI_read_node_header( file_index, parent, &parent_node, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Get node_header for the node (child) **/ -ADFI_read_node_header( file_index, child, &child_node, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Check current length of sub-node_table, add space if needed **/ -if( parent_node.entries_for_sub_nodes <= parent_node.num_sub_nodes ) { - old_num_entries = parent_node.entries_for_sub_nodes ; - - /** Increase the table space (double it) **/ - if( parent_node.entries_for_sub_nodes == 0 ) - parent_node.entries_for_sub_nodes = LIST_CHUNK ; - else - parent_node.entries_for_sub_nodes = (unsigned int) ( - (float) parent_node.entries_for_sub_nodes * LIST_CHUNK_GROW_FACTOR ) ; - - if( parent_node.entries_for_sub_nodes <= parent_node.num_sub_nodes ) { - *error_return = SUB_NODE_TABLE_ENTRIES_BAD ; - return ; - } /* end if */ - - /** Allocate memory for the required table space in memory **/ - sub_node_table = (struct SUB_NODE_TABLE_ENTRY *) - malloc( parent_node.entries_for_sub_nodes * - sizeof( *sub_node_table ) ) ; - if( sub_node_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - return ; - } /* end if */ - - /** If sub-node table exists, get it **/ - if( old_num_entries > 0 ) { - ADFI_read_sub_node_table( file_index, &parent_node.sub_node_table, - sub_node_table, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - - /** Blank out the new part of the sub-node_table **/ - for( i=parent_node.num_sub_nodes; i<(int) parent_node.entries_for_sub_nodes; - i++ ) { - strncpy( sub_node_table[i].child_name, - /* " ", ADF_NAME_LENGTH ) ; */ - "unused entry in sub-node-table ", ADF_NAME_LENGTH ) ; - sub_node_table[i].child_location.block = 0 ; - sub_node_table[i].child_location.offset = DISK_BLOCK_SIZE ; - } /* end for */ - - /** Allocate memory for the required table space on disk **/ - if( parent_node.num_sub_nodes > 0 ) { /* delete old table from file */ - ADFI_delete_sub_node_table( file_index, &parent_node.sub_node_table, - old_num_entries, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - - ADFI_file_malloc( file_index, TAG_SIZE + DISK_POINTER_SIZE + TAG_SIZE + - parent_node.entries_for_sub_nodes * (ADF_NAME_LENGTH + DISK_POINTER_SIZE), - &tmp_disk_ptr, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - parent_node.sub_node_table.block = tmp_disk_ptr.block ; - parent_node.sub_node_table.offset = tmp_disk_ptr.offset ; - - /** Write out modified sub_node_table **/ - ADFI_write_sub_node_table( file_index, &parent_node.sub_node_table, - parent_node.entries_for_sub_nodes, - (struct SUB_NODE_TABLE_ENTRY *)sub_node_table, error_return ) ; - free( sub_node_table ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - - /** Insert new entry in sub-node table **/ -tmp_disk_ptr.block = parent_node.sub_node_table.block ; -tmp_disk_ptr.offset = parent_node.sub_node_table.offset + - TAG_SIZE + DISK_POINTER_SIZE + - parent_node.num_sub_nodes * (ADF_NAME_LENGTH + DISK_POINTER_SIZE) ; - -ADFI_adjust_disk_pointer( &tmp_disk_ptr, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Write the child's name **/ -ADFI_write_file( file_index, tmp_disk_ptr.block, tmp_disk_ptr.offset, - ADF_NAME_LENGTH, child_node.name, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Write out new sub_node_table entry **/ -tmp_disk_ptr.offset += ADF_NAME_LENGTH ; -ADFI_adjust_disk_pointer( &tmp_disk_ptr, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_write_disk_pointer_2_disk( file_index, tmp_disk_ptr.block, - tmp_disk_ptr.offset, child, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Write out modified parent node-header **/ -parent_node.num_sub_nodes++ ; -ADFI_write_node_header( file_index, parent, &parent_node, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -} /* end of ADFI_add_2_sub_node_table */ -/* end of file ADFI_add_2_sub_node_table.c */ -/* file ADFI_adjust_disk_pointer.c */ -/*********************************************************************** -ADFI adjust disk pointer: - Adjust the disk pointer so that the offset is in a legal - range; from 0 and < DISK_BLOCK_SIZE. - -input: const struct DISK_POINTER *block_offset -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -BLOCK_OFFSET_OUT_OF_RANGE -***********************************************************************/ -void ADFI_adjust_disk_pointer( - struct DISK_POINTER *block_offset, - int *error_return ) -{ -struct DISK_POINTER temp ; - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -temp.block = block_offset->block ; - - /** Do this incrementally to avoid numerical oddities... **/ -while( block_offset->offset >= DISK_BLOCK_SIZE ) { - block_offset->block = block_offset->block + 1 ; - if( block_offset->block < temp.block ) { /* Check for roll-over */ - *error_return = BLOCK_OFFSET_OUT_OF_RANGE ; - return ; - } /* end if */ - temp.block = block_offset->block ; - block_offset->offset = block_offset->offset - DISK_BLOCK_SIZE ; - } /* end while */ - -} /* end of ADFI_adjust_disk_pointer */ -/* end of file ADFI_adjust_disk_pointer.c */ -/* file ADFI_big_endian_32_swap_64.c */ -/*********************************************************************** -ADFI big endian 32 swap 64: - -input: const char from_format Format to convert from. 'B','L','C','N' -input: const char from_os_size Format to convert from. 'B','L' -input: const char to_format Format to convert to. -input: const char to_os_size Format to convert to. 'B','L' -input: const char data_type[2] The type of data to convert. - MT I4 I8 U4 U8 R4 R8 X4 X8 C1 B1 -input: const unsigned long delta_from_bytes Number of from_bytes used. -input: const unsigned long delta_to_bytes Number of to_bytes used. -input: const char *from_data The data to convert from. -output: char *to_data The resulting data. -output: int *error_return Error return. - - Recognized data types: - Machine representations - Type Notation IEEE_BIG IEEE_LITTLE Cray - 32 64 32 64 - No data MT - Integer 32 I4 I4 I4 I4 I4 I8 - Integer 64 I8 -- I8 -- I8 I8 - Unsigned 32 U4 I4 I4 I4 I4 I8 - Unsigned 64 U8 -- I8 -- I8 I8 - Real 32 R4 R4 R4 R4 R4 R8 - Real 64 R8 R8 R8 R8 R8 R8 - Complex 64 X4 R4R4 R4R4 R4R4 R4R4 R8R8 - Complex 128 X8 R8R8 R8R8 R8R8 R8R8 R8R8 - Character (unsigned byte) C1 C1 C1 C1 C1 C1 - Byte (unsigned byte) B1 C1 C1 C1 C1 C1 - -Machine Numeric Formats: -***IEEE_BIG (SGI-Iris Assembly Language Programmer's Guide, pages 1-2, 6-3) -I4: Byte0 Byte1 Byte2 Byte3 - MSB---------------------LSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: sign-bit, 8-bit exponent, 23-bit mantissa - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -Machine Numeric Formats: -***IEEE_LITTLE ( The backwards Big Endian ) -I4: Byte0 Byte1 Byte2 Byte3 - LSB---------------------MSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: 23-bit mantissa, 8-bit exponent, sign-bit - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: 52-bit mantissa, 11-bit exponent, sign-bit - -Note: To convert between these two formats the order of the bytes is reversed -since by definition the Big endian starts at the LSB and goes to the MSB where -the little goes form the MSB to the LSB of the word. -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_big_endian_32_swap_64( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -if ( delta_to_bytes == delta_from_bytes ) { - memcpy( to_data, from_data, delta_from_bytes ) ; - } /* end if */ -else if ( delta_from_bytes < delta_to_bytes ) { - switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - case EVAL_2_BYTES( 'I', '8' ): - if( (from_data[0] & 0x80) == 0x80 ) { /* Negative number */ - to_data[0] = 0xff ; - to_data[1] = 0xff ; - to_data[2] = 0xff ; - to_data[3] = 0xff ; - } /* end if */ - else { - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - } /* end else */ - to_data[4] = from_data[0] ; - to_data[5] = from_data[1] ; - to_data[6] = from_data[2] ; - to_data[7] = from_data[3] ; - break ; - default: - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ - } /* end else if */ -else { - switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - case EVAL_2_BYTES( 'I', '8' ): - to_data[0] = from_data[4] ; - to_data[1] = from_data[5] ; - to_data[2] = from_data[6] ; - to_data[3] = from_data[7] ; - break ; - default: - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ - } /* end else */ - -} /* end of ADFI_big_endian_32_swap_64 */ -/* end of file ADFI_big_endian_32_swap_64.c */ -/* file ADFI_big_endian_to_cray.c */ -/*********************************************************************** -ADFI big endian to cray: - -input: const char from_format Format to convert from. 'B','L','C','N' -input: const char from_os_size Format to convert from. 'B','L' -input: const char to_format Format to convert to. -input: const char to_os_size Format to convert to. 'B','L' -input: const char data_type[2] The type of data to convert. - MT I4 I8 U4 U8 R4 R8 X4 X8 C1 B1 -input: const unsigned long delta_from_bytes Number of from_bytes used. -input: const unsigned long delta_to_bytes Number of to_bytes used. -input: const char *from_data The data to convert from. -output: char *to_data The resulting data. -output: int *error_return Error return. - - Recognized data types: - Machine representations - Type Notation IEEE_BIG IEEE_LITTLE Cray - 32 64 32 64 - No data MT - Integer 32 I4 I4 I4 I4 I4 I8 - Integer 64 I8 -- I8 -- I8 I8 - Unsigned 32 U4 I4 I4 I4 I4 I8 - Unsigned 64 U8 -- I8 -- I8 I8 - Real 32 R4 R4 R4 R4 R4 R8 - Real 64 R8 R8 R8 R8 R8 R8 - Complex 64 X4 R4R4 R4R4 R4R4 R4R4 R8R8 - Complex 128 X8 R8R8 R8R8 R8R8 R8R8 R8R8 - Character (unsigned byte) C1 C1 C1 C1 C1 C1 - Byte (unsigned byte) B1 C1 C1 C1 C1 C1 - -Machine Numeric Formats: -***IEEE_BIG (SGI-Iris Assembly Language Programmer's Guide, pages 1-2, 6-3) -I4: Byte0 Byte1 Byte2 Byte3 - MSB---------------------LSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: sign-bit, 8-bit exponent, 23-bit mantissa - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -***Cray (Cray CFT77 Reference Manual, pages G-1 G-2) -I8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - MSB-----------------------------------------------------LSB -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, exponent-sign, 14-bit exponent, 48-bit mantissa -Note: Exponent sign: 1 in this bits indicates a positive exponent sign, - thus bit 62 is the inverse of bit 61 (the sign in the exponent). - The exception to this is a zero, in which all 64 bits are zero! - The interpreation of the floating-point number is: - >>> .mantissia(fraction) X 2^exponent. <<< - The mantissia is left justified (the leftmost bit is a 1). - This MUST be done! - -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_big_endian_to_cray( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ -int i, exp ; - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - - case EVAL_2_BYTES( 'M', 'T' ): - *error_return = NO_DATA ; - return ; - - case EVAL_2_BYTES( 'C', '1' ): - case EVAL_2_BYTES( 'B', '1' ): - to_data[0] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'I', '4' ): - if( (from_data[0] & 0x80) == 0x80 ) { /* Negative number */ - to_data[0] = 0xff ; - to_data[1] = 0xff ; - to_data[2] = 0xff ; - to_data[3] = 0xff ; - } /* end if */ - else { - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - } /* end else */ - to_data[4] = from_data[0] ; - to_data[5] = from_data[1] ; - to_data[6] = from_data[2] ; - to_data[7] = from_data[3] ; - break ; - - case EVAL_2_BYTES( 'U', '4' ): - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - to_data[4] = from_data[0] ; - to_data[5] = from_data[1] ; - to_data[6] = from_data[2] ; - to_data[7] = from_data[3] ; - break ; - - case EVAL_2_BYTES( 'I', '8' ): - if( (from_data[0] & 0x80) == 0x80 ) { /* Negative number */ - to_data[0] = 0xff ; - to_data[1] = 0xff ; - to_data[2] = 0xff ; - to_data[3] = 0xff ; - } /* end if */ - else { - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - } /* end else */ - for( i=0; i<(int)delta_from_bytes; i++ ) - to_data[8-delta_from_bytes+i] = from_data[i] ; - break ; - - case EVAL_2_BYTES( 'U', '8' ): - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - for( i=0; i<(int)delta_from_bytes; i++ ) - to_data[8-delta_from_bytes+i] = from_data[i] ; - break ; - - case EVAL_2_BYTES( 'R', '4' ): - for( i=0; i<8; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[0] == 0x00) && (from_data[1] == 0x00) && - (from_data[2] == 0x00) && (from_data[3] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[0] = from_data[0] & 0x80 ; - - /** Convert the exponent **/ - /** 8 bits to 14 bits. Sign extent from 8 to 14 **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = (from_data[0] & 0x3f) << 1 ; - if( (from_data[1] & 0x80) == 0x80 ) - exp += 1 ; - if( (from_data[0] & 0x40) == 0x00 ) /* set sign */ - exp -= 128 ; - exp += 2 ; - - to_data[1] = exp & 0xff ; - if( exp < 0 ) - to_data[0] |= 0x3f ; /* exponent sign 0, sign extend exponent */ - else - to_data[0] |= 0x40 ; /* exponent sign 1 */ - - /** Convert the mantissia **/ - /** 23 bits to 48 bits. Left shift 25 bits, zero fill **/ - to_data[2] = from_data[1] | 0x80 ; - to_data[3] = from_data[2] ; - to_data[4] = from_data[3] ; - break ; - - case EVAL_2_BYTES( 'R', '8' ): - for( i=0; i<8; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[0] == 0x00) && (from_data[1] == 0x00) && - (from_data[2] == 0x00) && (from_data[3] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[0] = from_data[0] & 0x80 ; - - /** Convert the exponent **/ - /** 11 bits to 14 bits. Sign extent from 11 to 14 **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = ((from_data[0] & 0x3f) << 4) + ((from_data[1]>>4)&0x0f) ; - - if( (from_data[0] & 0x40) == 0x00 ) /* set sign */ - exp -= 1024 ; - exp += 2 ; - - to_data[1] = (unsigned int)(exp & 0xff) ; - to_data[0] |= ((exp>>8) & 0x03) ; - if( exp < 0 ) - to_data[0] |= 0x3c ; /* exponent sign 0, sign extend exponent */ - else - to_data[0] |= 0x40 ; /* exponent sign 1 */ - - /** Convert the mantissia **/ - /** 52 bits to 48 bits. Use 48, drop last 4 bits **/ - to_data[2] = 0x80 | ((from_data[1]<<3)&0x78) | - ((from_data[2]>>5)&0x07) ; - for( i=3; i<8; i++ ) - to_data[i] = ((from_data[i-1]<<3)&0xF8) | - ((from_data[i]>>5)&0x07) ; -#ifdef PRINT_STUFF -printf("from:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", from_data[i] ) ; -printf("to:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", to_data[i] ) ; -printf("\n" ) ; -#endif - break ; - - case EVAL_2_BYTES( 'X', '4' ): - ADFI_big_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_big_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, &from_data[4], &to_data[8], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - case EVAL_2_BYTES( 'X', '8' ): - ADFI_big_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_big_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, &from_data[8], &to_data[8], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - default: - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ -} /* end of ADFI_big_endian_to_cray */ -/* end of file ADFI_big_endian_to_cray.c */ -/* file ADFI_big_little_endian_swap.c */ -/*********************************************************************** -ADFI big little endian swap: - -input: const char from_format Format to convert from. 'B','L','C','N' -input: const char from_os_size Format to convert from. 'B','L' -input: const char to_format Format to convert to. -input: const char to_os_size Format to convert to. 'B','L' -input: const char data_type[2] The type of data to convert. - MT I4 I8 U4 U8 R4 R8 X4 X8 C1 B1 -input: const unsigned long delta_from_bytes Number of from_bytes used. -input: const unsigned long delta_to_bytes Number of to_bytes used. -input: const char *from_data The data to convert from. -output: char *to_data The resulting data. -output: int *error_return Error return. - - Recognized data types: - Machine representations - Type Notation IEEE_BIG IEEE_LITTLE Cray - 32 64 32 64 - No data MT - Integer 32 I4 I4 I4 I4 I4 I8 - Integer 64 I8 -- I8 -- I8 I8 - Unsigned 32 U4 I4 I4 I4 I4 I8 - Unsigned 64 U8 -- I8 -- I8 I8 - Real 32 R4 R4 R4 R4 R4 R8 - Real 64 R8 R8 R8 R8 R8 R8 - Complex 64 X4 R4R4 R4R4 R4R4 R4R4 R8R8 - Complex 128 X8 R8R8 R8R8 R8R8 R8R8 R8R8 - Character (unsigned byte) C1 C1 C1 C1 C1 C1 - Byte (unsigned byte) B1 C1 C1 C1 C1 C1 - -Machine Numeric Formats: -***IEEE_BIG (SGI-Iris Assembly Language Programmer's Guide, pages 1-2, 6-3) -I4: Byte0 Byte1 Byte2 Byte3 - MSB---------------------LSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: sign-bit, 8-bit exponent, 23-bit mantissa - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -Machine Numeric Formats: -***IEEE_LITTLE ( The backwards Big Endian ) -I4: Byte0 Byte1 Byte2 Byte3 - LSB---------------------MSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: 23-bit mantissa, 8-bit exponent, sign-bit - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: 52-bit mantissa, 11-bit exponent, sign-bit - -Note: To convert between these two formats the order of the bytes is reversed -since by definition the Big endian starts at the LSB and goes to the MSB where -the little goes form the MSB to the LSB of the word. -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_big_little_endian_swap( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ -int i ; - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -if ( from_os_size != to_os_size || delta_to_bytes != delta_from_bytes ) { - *error_return = DATA_TYPE_NOT_SUPPORTED ; - return ; -} /** end if **/ - -*error_return = NO_ERROR ; - -for ( i=0; i<(int)delta_from_bytes; i++ ) - to_data[i] = from_data[delta_from_bytes-1-i] ; - -} /* end of ADFI_big_little_endian_swap */ -/* end of file ADFI_big_little_endian_swap.c */ -/* file ADFI_blank_fill_string.c */ -/*********************************************************************** -ADFI blank fill string: - -input/output: char *str The string to fill with blanks. -input: const int length The total length of the string to fill. -***********************************************************************/ -void ADFI_blank_fill_string( - char *str, - const int length ) -{ -int i ; -for( i=strlen( str ); iblock, - &block_offset->offset, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Get node_header for the node **/ - ADFI_read_node_header( *file_index, block_offset, node_header, - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - if( (node_header->data_type[0] == 'L') && - (node_header->data_type[1] == 'K')) { - - /** node is a link get file and path data **/ - ADF_Get_Link_Path( Link_ID, link_file, link_path, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - if( link_file[0] != '\0' ) { /* A filename is specified, open it. **/ - - /** Link_ID = root-node of the new file. - note: the file could already be opened, and may be the - current file! **/ - - ADFI_get_file_index_from_name( link_file, &found, &link_file_index, - &Link_ID, error_return ) ; - if( ! found ) { /** Not found; try to open it **/ - if (access(link_file,2)) /* check for read-only mode */ - status = "READ_ONLY"; - else /* open in same mode as current file */ - status = (char *) file_open_mode[*file_index] ; - if ( ADFI_stridx_c(status, "READ_ONLY" ) != 0 ) status="OLD" ; - ADF_Database_Open( link_file, status, "", &Link_ID, - error_return ) ; - if( *error_return != NO_ERROR ) { - *error_return = LINKED_TO_FILE_NOT_THERE ; - return ; - } /* end if */ - } /* end else */ - } /* end if */ - else { /* filename NOT specified */ - } /* end else */ - - /** Get the node ID of the link to node (may be other links) **/ - ADF_Get_Node_ID( Link_ID, link_path, &temp_ID, error_return ) ; - if( *error_return == CHILD_NOT_OF_GIVEN_PARENT ) - *error_return = LINK_TARGET_NOT_THERE ; /* A better error message */ - if( *error_return != NO_ERROR ) - return ; - - Link_ID = temp_ID ; - if( ++link_depth > ADF_MAXIMUM_LINK_DEPTH ) { - *error_return = LINKS_TOO_DEEP ; - return ; - } /* end if */ - } /* end if */ - else { /** node is NOT a link **/ - done = TRUE ; - } /* end else */ - } /* end while */ - -*LID = Link_ID ; - -} /* end of ADFI_chase_link */ -/* end of file ADFI_chase_link.c */ -/* file ADFI_check_4_child_name.c */ -/*********************************************************************** -ADFI check 4 child name: - -input: const int file_index Index of ADF file. -input: const struct DISK_POINTER *parent Location of the parent -input: const char *name The name of the new child. -output: int *found 0 if NOT found, else 1. -output: struct DISK_POINTER *sub_node_entry_location -output: struct SUB_NODE_TABLE_ENTRY *sub_node_entry -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -MEMORY_ALLOCATION_FAILED -***********************************************************************/ -void ADFI_check_4_child_name( - const int file_index, - const struct DISK_POINTER *parent, - const char *name, - int *found, - struct DISK_POINTER *sub_node_entry_location, - struct SUB_NODE_TABLE_ENTRY *sub_node_entry, - int *error_return ) -{ -struct NODE_HEADER parent_node ; -struct SUB_NODE_TABLE_ENTRY *sub_node_table ; -int i ; - -if( (parent == NULL) || (found == NULL) || (sub_node_entry_location == NULL) || - (sub_node_entry == NULL ) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( name == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; -*found = 0 ; /* default to NOT found */ - - /** Get node_header for the node **/ -ADFI_read_node_header( file_index, parent, &parent_node, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Check for valid node name **/ - - /** If parent has no children, the new name MUST be NOT found **/ -if( parent_node.num_sub_nodes == 0 ) { - *found = 0 ; - return ; - } /* end if */ - - /** Allocate memory for the required table space in memory **/ -sub_node_table = (struct SUB_NODE_TABLE_ENTRY *) - malloc( parent_node.entries_for_sub_nodes * - sizeof( *sub_node_table ) ) ; -if( sub_node_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - return ; - } /* end if */ - -if( parent_node.entries_for_sub_nodes > 0 ) { - ADFI_read_sub_node_table( file_index, &parent_node.sub_node_table, - sub_node_table, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - - /** Check all names for our new name **/ -for( i=0; i<(int)parent_node.num_sub_nodes; i++ ) { - ADFI_compare_node_names( sub_node_table[i].child_name, name, - found, error_return ) ; - if( *error_return != NO_ERROR ) - break ; - if( *found == 1 ) { /* name was found, save off addresses */ - sub_node_entry_location->block = parent_node.sub_node_table.block ; - sub_node_entry_location->offset = parent_node.sub_node_table.offset + - TAG_SIZE + DISK_POINTER_SIZE + - (ADF_NAME_LENGTH + DISK_POINTER_SIZE) * i ; - - ADFI_adjust_disk_pointer( sub_node_entry_location, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Also save off the child's name **/ - strncpy( sub_node_entry->child_name, sub_node_table[i].child_name, - ADF_NAME_LENGTH ) ; - sub_node_entry->child_location.block = - sub_node_table[i].child_location.block ; - sub_node_entry->child_location.offset = - sub_node_table[i].child_location.offset ; - - /** Get out of the for loop **/ - break ; - } /* end if */ - } /* end for */ - -free( sub_node_table ) ; -} /* end of ADFI_check_4_child_name */ -/* end of file ADFI_check_4_child_name.c */ -/* file ADFI_check_string_length.c */ -/*********************************************************************** -ADFI check string length: - Check a character string for: - being a NULL pointer, - being too long, - being zero length. - -input: const char *str The input string. -input: const int max_length Maximum allowable length of the string. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -STRING_LENGTH_ZERO -STRING_LENGTH_TOO_BIG -***********************************************************************/ -void ADFI_check_string_length( - const char *str, - const int max_length, - int *error_return ) -{ -int str_length, i ; - -if( str == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -str_length = strlen( str ) ; -if( str_length == 0 ) { - *error_return = STRING_LENGTH_ZERO ; - return ; - } /* end if */ - -if( (int) strlen( str ) > max_length ) { - *error_return = STRING_LENGTH_TOO_BIG ; - return ; - } /* end if */ - - /** Check for blank string **/ -*error_return = STRING_LENGTH_ZERO ; -for( i=0; i>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -Machine Numeric Formats: -***IEEE_LITTLE ( The backwards Big Endian ) -I4: Byte0 Byte1 Byte2 Byte3 - LSB---------------------MSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: 23-bit mantissa, 8-bit exponent, sign-bit - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: 52-bit mantissa, 11-bit exponent, sign-bit - -***Cray (Cray CFT77 Reference Manual, pages G-1 G-2) -I8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - MSB-----------------------------------------------------LSB -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, exponent-sign, 14-bit exponent, 48-bit mantissa -Note: Exponent sign: 1 in this bits indicates a positive exponent sign, - thus bit 62 is the inverse of bit 61 (the sign in the exponent). - The exception to this is a zero, in which all 64 bits are zero! - The interpreation of the floating-point number is: - >>> .mantissia(fraction) X 2^exponent. <<< - The mantissia is left justified (the leftmost bit is a 1). - This MUST be done! - -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_convert_number_format( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const int convert_dir, - const struct TOKENIZED_DATA_TYPE *tokenized_data_type, - const unsigned int length, - unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ -unsigned char temp_data[16] ; -char data_type[2] ; -int current_token ; -int array_size ; -int l, s ; -unsigned long delta_from_bytes, delta_to_bytes ; - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( length == 0 ) { - *error_return = NUMBER_LESS_THAN_MINIMUM ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -switch( EVAL_4_BYTES( from_format, to_format, from_os_size, to_os_size ) ) { - case EVAL_4_BYTES( 'B', 'B', 'B', 'B' ): - case EVAL_4_BYTES( 'C', 'C', 'B', 'B' ): - case EVAL_4_BYTES( 'L', 'L', 'B', 'B' ): - case EVAL_4_BYTES( 'B', 'B', 'L', 'L' ): - case EVAL_4_BYTES( 'C', 'C', 'L', 'L' ): - case EVAL_4_BYTES( 'L', 'L', 'L', 'L' ): - *error_return = CONVERSION_FORMATS_EQUAL ; - return ; - } /* end switch */ - -*error_return = NO_ERROR ; - - /** loop over each element **/ -for ( l=0; l<(int)length; l++ ) { - current_token = -1 ; - while( tokenized_data_type[ ++current_token ].type[0] != 0 ) { - data_type[0] = tokenized_data_type[ current_token ].type[0] ; - data_type[1] = tokenized_data_type[ current_token ].type[1] ; - array_size = tokenized_data_type[ current_token ].length ; - if ( convert_dir == FROM_FILE_FORMAT ) { - delta_from_bytes=tokenized_data_type[ current_token ].file_type_size ; - delta_to_bytes =tokenized_data_type[ current_token ].machine_type_size ; - } /** end if **/ - else { - delta_to_bytes =tokenized_data_type[ current_token ].file_type_size ; - delta_from_bytes=tokenized_data_type[ current_token ].machine_type_size ; - } /** end else **/ - - for ( s=0; s 12) ) { - *error_return = BAD_NUMBER_OF_DIMENSIONS ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Chek the inputs **/ -for( i=0; i=1 **/ - if( dims[i] < 1 ) { - *error_return = BAD_DIMENSION_VALUE ; - return ; - } /* end if */ - - /** Check starting values >=1 and <= dims **/ - if( (dim_start[i] < 1) || (dim_start[i] > (int) dims[i]) ) { - *error_return = START_OUT_OF_DEFINED_RANGE ; - return ; - } /* end if */ - - /** Check ending values >=1 and <= dims and >= dim_start **/ - if( (dim_end[i] < 1) || (dim_end[i] > (int) dims[i]) ) { - *error_return = END_OUT_OF_DEFINED_RANGE ; - return ; - } /* end if */ - if( dim_end[i] < dim_start[i] ) { - *error_return = MINIMUM_GT_MAXIMUM ; - return ; - } /* end if */ - - /** Check stride >= 1 **/ - if( dim_stride[i] < 1 ) { - *error_return = BAD_STRIDE_VALUE ; - return ; - } /* end if */ - } /* end for */ - -total = 1 ; -offset = 0 ; -accumlated_size = 1 ; -for( i=0; i>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -***Cray (Cray CFT77 Reference Manual, pages G-1 G-2) -I8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - MSB-----------------------------------------------------LSB -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, exponent-sign, 14-bit exponent, 48-bit mantissa -Note: Exponent sign: 1 in this bits indicates a positive exponent sign, - thus bit 62 is the inverse of bit 61 (the sign in the exponent). - The exception to this is a zero, in which all 64 bits are zero! - The interpreation of the floating-point number is: - >>> .mantissia(fraction) X 2^exponent. <<< - The mantissia is left justified (the leftmost bit is a 1). - This MUST be done! - -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_cray_to_big_endian( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ -int i, exp ; - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - case EVAL_2_BYTES( 'M', 'T' ): - *error_return = NO_DATA ; - return ; - - case EVAL_2_BYTES( 'C', '1' ): - case EVAL_2_BYTES( 'B', '1' ): - to_data[0] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'I', '4' ): - case EVAL_2_BYTES( 'U', '4' ): - to_data[0] = from_data[4] ; - to_data[1] = from_data[5] ; - to_data[2] = from_data[6] ; - to_data[3] = from_data[7] ; - break ; - - case EVAL_2_BYTES( 'I', '8' ): - case EVAL_2_BYTES( 'U', '8' ): - for( i=0; i<(int) delta_to_bytes; i++ ) - to_data[i] = from_data[8-delta_to_bytes+i] ; - break ; - - case EVAL_2_BYTES( 'R', '4' ): - for( i=0; i<4; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[0] == 0x00) && (from_data[1] == 0x00) && - (from_data[2] == 0x00) && (from_data[3] == 0x00) && - (from_data[4] == 0x00) && (from_data[5] == 0x00) && - (from_data[6] == 0x00) && (from_data[7] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[0] = from_data[0] & 0x80 ; - - /** Convert the exponent **/ - /** 14 bits to 8 bits. Sign extent from 8 to 14 **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = from_data[1] + ((from_data[0]&0x3f)<<8) ; - if( (from_data[0] & 0x40) == 0x00 ) /* set sign */ - exp -= 16384 ; - exp -= 2 ; - - if( exp >= 128 ) { - *error_return = NUMERIC_OVERFLOW ; - return ; - } /* end if */ - else if ( exp < -128 ) { - for( i=0; i<4; i++ ) to_data[i] = 0x00 ; /* underflow set to 0 */ - break; - } /* end else */ - - to_data[0] |= ((exp&0x7F) >> 1) ; - if( (exp & 0x01) == 0x01 ) /* LSBit of the exponent */ - to_data[1] |= 0x80 ; - - if( exp >= 0 ) /* Set exponent sign */ - to_data[0] |= 0x40 ; - - /** Convert the mantissia **/ - /** 48 bits to 23 bits, skip the first '1' (2.fract) **/ - to_data[1] |= (from_data[2] & 0x7f) ; - to_data[2] = from_data[3] ; - to_data[3] = from_data[4] ; - break ; - - case EVAL_2_BYTES( 'R', '8' ): - for( i=0; i<8; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[0] == 0x00) && (from_data[1] == 0x00) && - (from_data[2] == 0x00) && (from_data[3] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[0] = from_data[0] & 0x80 ; - - /** Convert the exponent **/ - /** 14 bits to 11 bits **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = from_data[1] + ((from_data[0]&0x3f)<<8) ; - /* set sign if exponent is non-zero */ - if( (exp != 0) && ((from_data[0] & 0x40) == 0x00) ) - exp -= 16384 ; - exp -= 2 ; - - if( exp >= 1024 ) { - *error_return = NUMERIC_OVERFLOW ; - return ; - } /* end if */ - else if ( exp < -1024 ) { - for( i=0; i<4; i++ ) to_data[i] = 0x00 ; /* underflow set to 0 */ - break; - } /* end else */ - - to_data[0] |= ((exp & 0x03F0) >> 4) ; - to_data[1] |= ((exp & 0x000F) << 4) ; - - if( exp >= 0 ) /* Set exponent sign */ - to_data[0] |= 0x40 ; - - /** Convert the mantissia **/ - /** 48 bits to 52 bits, skip the first '1' (2.fract) **/ - to_data[1] |= ((from_data[2] & 0x78) >> 3) ; - for( i=2; i<7; i++ ) - to_data[i] = ((from_data[i] & 0x07) << 5) | - ((from_data[i+1] & 0xf8) >> 3) ; - to_data[7] = ((from_data[7] & 0x07) << 5) ; - -#ifdef PRINT_STUFF -printf("from:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", from_data[i] ) ; -printf("to:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", to_data[i] ) ; -printf("\n" ) ; -#endif - break ; - - case EVAL_2_BYTES( 'X', '4' ): - ADFI_cray_to_big_endian( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_cray_to_big_endian( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, &from_data[8], &to_data[4], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - case EVAL_2_BYTES( 'X', '8' ): - ADFI_cray_to_big_endian( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_cray_to_big_endian( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, &from_data[8], &to_data[8], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - default: - *error_return = INVALID_DATA_TYPE ; - return ; - - } /* end switch */ -} /* end of ADFI_cray_to_big_endian */ -/* end of file ADFI_cray_to_big_endian.c */ -/* file ADFI_cray_to_little_endian.c */ -/*********************************************************************** -ADFI cray to little endian: - -input: const char from_format Format to convert from. 'B','L','C','N' -input: const char from_os_size Format to convert from. 'B','L' -input: const char to_format Format to convert to. -input: const char to_os_size Format to convert to. 'B','L' -input: const char data_type[2] The type of data to convert. - MT I4 I8 U4 U8 R4 R8 X4 X8 C1 B1 -input: const unsigned long delta_from_bytes Number of from_bytes used. -input: const unsigned long delta_to_bytes Number of to_bytes used. -input: const char *from_data The data to convert from. -output: char *to_data The resulting data. -output: int *error_return Error return. - - Recognized data types: - Machine representations - Type Notation IEEE_BIG IEEE_L Cray - No data MT - Integer 32 I4 I4 I4 I4 I4 I8 - Integer 64 I8 -- I8 -- I8 I8 - Unsigned 32 U4 I4 I4 I4 I4 I8 - Unsigned 64 U8 -- I8 -- I8 I8 - Real 32 R4 R4 R4 R4 R4 R8 - Real 64 R8 R8 R8 R8 R8 R8 - Complex 64 X4 R4R4 R4R4 R4R4 R4R4 R8R8 - Complex 128 X8 R8R8 R8R8 R8R8 R8R8 R8R8 - Character (unsigned byte) C1 C1 C1 C1 C1 C1 - Byte (unsigned byte) B1 C1 C1 C1 C1 C1 - -Machine Numeric Formats: -***IEEE_BIG (SGI-Iris Assembly Language Programmer's Guide, pages 1-2, 6-3) -I4: Byte0 Byte1 Byte2 Byte3 - MSB---------------------LSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: sign-bit, 8-bit exponent, 23-bit mantissa - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -***Cray (Cray CFT77 Reference Manual, pages G-1 G-2) -I8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - MSB-----------------------------------------------------LSB -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, exponent-sign, 14-bit exponent, 48-bit mantissa -Note: Exponent sign: 1 in this bits indicates a positive exponent sign, - thus bit 62 is the inverse of bit 61 (the sign in the exponent). - The exception to this is a zero, in which all 64 bits are zero! - The interpreation of the floating-point number is: - >>> .mantissia(fraction) X 2^exponent. <<< - The mantissia is left justified (the leftmost bit is a 1). - This MUST be done! - -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_cray_to_little_endian( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ -int i, exp ; - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - case EVAL_2_BYTES( 'M', 'T' ): - *error_return = NO_DATA ; - return ; - - case EVAL_2_BYTES( 'C', '1' ): - case EVAL_2_BYTES( 'B', '1' ): - to_data[0] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'I', '4' ): - case EVAL_2_BYTES( 'U', '4' ): - to_data[3] = from_data[4] ; - to_data[2] = from_data[5] ; - to_data[1] = from_data[6] ; - to_data[0] = from_data[7] ; - break ; - - case EVAL_2_BYTES( 'I', '8' ): - case EVAL_2_BYTES( 'U', '8' ): - for( i=0; i<(int) delta_to_bytes; i++ ) - to_data[delta_to_bytes-1-i] = from_data[8-delta_to_bytes+i] ; - break ; - - case EVAL_2_BYTES( 'R', '4' ): - for( i=0; i<4; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[0] == 0x00) && (from_data[1] == 0x00) && - (from_data[2] == 0x00) && (from_data[3] == 0x00) && - (from_data[4] == 0x00) && (from_data[5] == 0x00) && - (from_data[6] == 0x00) && (from_data[7] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[3] = from_data[0] & 0x80 ; - - /** Convert the exponent **/ - /** 14 bits to 8 bits. Sign extent from 8 to 14 **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = from_data[1] + ((from_data[0]&0x3f)<<8) ; - if( (from_data[0] & 0x40) == 0x00 ) /* set sign */ - exp -= 16384 ; - exp -= 2 ; - - if( exp >= 128 ) { - *error_return = NUMERIC_OVERFLOW ; - return ; - } /* end if */ - else if ( exp < -128 ) { - for( i=0; i<4; i++ ) to_data[i] = 0x00 ; /* underflow set to 0 */ - break; - } /* end else */ - - to_data[3] |= ((exp&0x7F) >> 1) ; - if( (exp & 0x01) == 0x01 ) /* LSBit of the exponent */ - to_data[2] |= 0x80 ; - - if( exp >= 0 ) /* Set exponent sign */ - to_data[3] |= 0x40 ; - - /** Convert the mantissia **/ - /** 48 bits to 23 bits, skip the first '1' (2.fract) **/ - to_data[2] |= (from_data[2] & 0x7f) ; - to_data[1] = from_data[3] ; - to_data[0] = from_data[4] ; - break ; - - case EVAL_2_BYTES( 'R', '8' ): - for( i=0; i<8; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[0] == 0x00) && (from_data[1] == 0x00) && - (from_data[2] == 0x00) && (from_data[3] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[7] = from_data[0] & 0x80 ; - - /** Convert the exponent **/ - /** 14 bits to 11 bits **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = from_data[1] + ((from_data[0]&0x3f)<<8) ; - /* set sign if exponent is non-zero */ - if( (exp != 0) && ((from_data[0] & 0x40) == 0x00) ) - exp -= 16384 ; - exp -= 2 ; - - if( exp >= 1024 ) { - *error_return = NUMERIC_OVERFLOW ; - return ; - } /* end if */ - else if ( exp < -1024 ) { - for( i=0; i<4; i++ ) to_data[i] = 0x00 ; /* underflow set to 0 */ - break; - } /* end else */ - - to_data[7] |= ((exp & 0x03F0) >> 4) ; - to_data[6] |= ((exp & 0x000F) << 4) ; - - if( exp >= 0 ) /* Set exponent sign */ - to_data[7] |= 0x40 ; - - /** Convert the mantissia **/ - /** 48 bits to 52 bits, skip the first '1' (2.fract) **/ - to_data[6] |= ((from_data[2] & 0x78) >> 3) ; - for( i=2; i<7; i++ ) - to_data[7-i] = ((from_data[i] & 0x07) << 5) | - ((from_data[i+1] & 0xf8) >> 3) ; - to_data[0] = ((from_data[7] & 0x07) << 5) ; - -#ifdef PRINT_STUFF -printf("from:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", from_data[i] ) ; -printf("to:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", to_data[i] ) ; -printf("\n" ) ; -#endif - break ; - - case EVAL_2_BYTES( 'X', '4' ): - ADFI_cray_to_little_endian( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_cray_to_little_endian( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, &from_data[8], &to_data[4], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - case EVAL_2_BYTES( 'X', '8' ): - ADFI_cray_to_little_endian( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_cray_to_little_endian( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, &from_data[8], &to_data[8], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - default: - *error_return = INVALID_DATA_TYPE ; - return ; - - } /* end switch */ -} /* end of ADFI_cray_to_little_endian */ -/* end of file ADFI_cray_to_little_endian.c */ -/* file ADFI_delete_data.c */ -/*********************************************************************** -ADFI delete data: - -Deletes all data from the file for a node. - -input: const int file_index The file index. -input: const struct NODE_HEADER Node header information. -output: int *error_return Error return. -***********************************************************************/ -void ADFI_delete_data( - const int file_index, - const struct NODE_HEADER *node_header, - int *error_return ) -{ -struct DATA_CHUNK_TABLE_ENTRY *data_chunk_table ; -int i ; - -*error_return = NO_ERROR ; - -if( node_header == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -switch( node_header->number_of_data_chunks ) { -case 0 : /** No data to free, do nothing **/ - return ; - -case 1 : /** A single data-chunk to free, so free it **/ - ADFI_file_free( file_index, &node_header->data_chunks, 0, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - -default : /** Multiple data-chunks to free. Free them, - and also the data_chunk table **/ - /** Allocate memory for the required table space in memory **/ - data_chunk_table = (struct DATA_CHUNK_TABLE_ENTRY *) - malloc( node_header->number_of_data_chunks * sizeof( *data_chunk_table ) ) ; - if( data_chunk_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - return ; - } /* end if */ - - /** Read in the table **/ - ADFI_read_data_chunk_table( file_index, &node_header->data_chunks, - data_chunk_table, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Free each entry in the table **/ - for( i=0; i<(int)node_header->number_of_data_chunks; i++ ) { - ADFI_file_free( file_index, &data_chunk_table[i].start, - 0, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end for */ - free( data_chunk_table ) ; - ADFI_file_free( file_index, &node_header->data_chunks, 0, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - }/* end switch */ - -/** Clear all disk entries off the priority stack for file **/ -ADFI_stack_control(file_index, 0, 0, CLEAR_STK_TYPE, DISK_PTR_STK, - 0, NULL ) ; - -} /* end of ADFI_delete_data */ -/* end of file ADFI_delete_data.c */ -/* file ADFI_delete_from_sub_node_table.c */ -/*********************************************************************** -ADFI delete from sub node table: - Delete a child from a parent's sub-node table. - -input: const int file_index Index of ADF file. -input: const struct DISK_POINTER *parent Location of the parent -input: const struct DISK_POINTER *child Location of the child. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_delete_from_sub_node_table( - const int file_index, - const struct DISK_POINTER *parent, - const struct DISK_POINTER *child, - int *error_return ) -{ - -int i, found ; -struct NODE_HEADER parent_node ; -struct SUB_NODE_TABLE_ENTRY *sub_node_table ; - -if( (parent == NULL) || (child == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -ADFI_read_node_header( file_index, parent, &parent_node, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -sub_node_table = (struct SUB_NODE_TABLE_ENTRY *) - malloc( parent_node.entries_for_sub_nodes * - sizeof( struct SUB_NODE_TABLE_ENTRY ) ) ; -if( sub_node_table == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - return ; - } /* end if */ - -ADFI_read_sub_node_table( file_index, &parent_node.sub_node_table, - sub_node_table, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Find the child in the parent's sub-node table **/ -for( i=0, found = -1 ; i<(int)parent_node.num_sub_nodes ; i++ ) { - if( child->block == sub_node_table[i].child_location.block && - child->offset == sub_node_table[i].child_location.offset ) { - found = i ; - break ; - } /* end if */ -} /* end for */ - -if( found == -1 ) { - *error_return = SUB_NODE_TABLE_ENTRIES_BAD ; - return ; -} - - /** Move the rest of the table up to fill the hole **/ -for( i=found ; i<(int) (parent_node.num_sub_nodes-1) ; i++ ) { - sub_node_table[i].child_location.block = - sub_node_table[i+1].child_location.block ; - sub_node_table[i].child_location.offset = - sub_node_table[i+1].child_location.offset ; - strncpy ( sub_node_table[i].child_name, sub_node_table[i+1].child_name, - ADF_NAME_LENGTH ) ; - } /* end for */ - -i = parent_node.num_sub_nodes - 1 ; -sub_node_table[i].child_location.block = 0 ; -sub_node_table[i].child_location.offset = 0 ; -strncpy ( sub_node_table[i].child_name, - "unused entry in sub-node-table ", ADF_NAME_LENGTH ) ; - - /** Re-write the parent's sub-node table **/ - -ADFI_write_sub_node_table( file_index, &parent_node.sub_node_table, - parent_node.entries_for_sub_nodes, - sub_node_table, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Update the sub-node count and write the parent's node-header **/ -parent_node.num_sub_nodes -= 1; -ADFI_write_node_header( file_index, parent, &parent_node, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -/** Clear all subnode/disk entries off the priority stack for file **/ -ADFI_stack_control(file_index, 0, 0, CLEAR_STK_TYPE, SUBNODE_STK, - 0, NULL ) ; -ADFI_stack_control(file_index, 0, 0, CLEAR_STK_TYPE, DISK_PTR_STK, - 0, NULL ) ; - -free(sub_node_table); - -} /* end of ADFI_delete_from_sub_node_table */ -/* end of file ADFI_delete_from_sub_node_table.c */ -/* file ADFI_delete_sub_node_table.c */ -/*********************************************************************** -ADFI delete sub node table: - Deletes a sub-node table from the file. - -input: const int file_index Index of ADF file. -input: const struct DISK_POINTER *block_offset The block & offset of - the sub node table. -input: const unsigned int size_sub_node_table Current size of the sub - node table (usually node_header.entries_for_sub_nodes). - If zero, then no action performed. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -FREE_OF_ROOT_NODE -ADF_DISK_TAG_ERROR -FREE_OF_FREE_CHUNK_TABLE -***********************************************************************/ -void ADFI_delete_sub_node_table( - const int file_index, - const struct DISK_POINTER *block_offset, - const unsigned int size_sub_node_table, - int *error_return ) -{ -unsigned int num_bytes ; - - -*error_return = NO_ERROR ; - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -if( size_sub_node_table == 0 ) - return ; /* assume nothing to delete */ - -/* calculate size */ -num_bytes = TAG_SIZE + TAG_SIZE + DISK_POINTER_SIZE + - size_sub_node_table * (ADF_NAME_LENGTH + DISK_POINTER_SIZE); - -ADFI_file_free( file_index, block_offset, num_bytes, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -/** Clear all subnode/disk entries off the priority stack for file **/ -ADFI_stack_control(file_index, 0, 0, CLEAR_STK_TYPE, SUBNODE_STK, - 0, NULL ) ; -ADFI_stack_control(file_index, 0, 0, CLEAR_STK_TYPE, DISK_PTR_STK, - 0, NULL ) ; - -} /* end of ADFI_delete_sub_node_table */ -/* end of file ADFI_delete_sub_node_table.c */ -/* file ADFI_disk_pointer_2_ASCII_Hex.c */ -/*********************************************************************** -ADFI disk pointer to ASCII Hex: - Convert a disk pointer into an ASCII-Hex representation (for disk). - -input: const struct DISK_POINTER *block_offset Disk-pointer struct. -output: char block[8] ASCII block number. -output: char offset[4] ASCII offset number. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -***********************************************************************/ -void ADFI_disk_pointer_2_ASCII_Hex( - const struct DISK_POINTER *block_offset, - char block[8], - char offset[4], - int *error_return ) -{ - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (block == NULL) || (offset == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Convert into ASCII-Hex form **/ -ADFI_unsigned_int_2_ASCII_Hex( block_offset->block, 0, MAXIMUM_32_BITS, - 8, block, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_unsigned_int_2_ASCII_Hex( block_offset->offset, 0, DISK_BLOCK_SIZE, - 4, offset, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -} /* end of ADFI_disk_pointer_2_ASCII_Hex */ -/* end of file ADFI_disk_pointer_2_ASCII_Hex.c */ -/* file ADFI_disk_pointer_from_ASCII_Hex.c */ -/*********************************************************************** -ADFI disk pointer from ASCII Hex: - Convert an ASCII-Hex representation into a disk-pointer (for memory). - -input: const char block[8] ASCII block number. -input: const char offset[4] ASCII offset number. -output: struct DISK_POINTER *block_offset Disk-pointer struct. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -***********************************************************************/ -void ADFI_disk_pointer_from_ASCII_Hex( - const char block[8], - const char offset[4], - struct DISK_POINTER *block_offset, - int *error_return ) -{ -unsigned int tmp ; - -if( (block == NULL) || (offset == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Convert into numeric form **/ -ADFI_ASCII_Hex_2_unsigned_int( 0, MAXIMUM_32_BITS, 8, block, - &tmp, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -block_offset->block = tmp ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, DISK_BLOCK_SIZE, 4, offset, - &tmp, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -block_offset->offset = tmp ; -} /* end of ADFI_disk_pointer_from_ASCII_Hex */ -/* end of file ADFI_disk_pointer_from_ASCII_Hex.c */ -/* file ADFI_evaluate_datatype.c */ -/*********************************************************************** -ADFI evaluate datatype: - -input: const int file_index The file index (0 to MAXIMUM_FILES). -input: const char *data_type. Data-type string. -output: int *file_bytes. Number of bytes used by the data type. -output: int *machine_ bytes. Number of bytes used by the data type. -output: struct TOKENIZED_DATA_TYPE *tokenized_data_type Array. -output: char *file_format The format of this file. -output: char *machine_format The format of this machine. -output: int error_return. Error return. - - Recognized data types: - Type Notation - No data MT - Integer 32 I4 - Integer 64 I8 - Unsigned 32 U4 - Unsigned 64 U8 - Real 32 R4 - Real 64 R8 - Complex 64 X4 - Complex 128 X8 - Character (unsigned byte) C1 - Link (same as C1) LK - Byte (unsigned byte) B1 - A structure is represented as the string "I4,I4,R8". - An array of 25 integers is "I4[25]". - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -DATA_TYPE_TOO_LONG -INVALID_DATA_TYPE -***********************************************************************/ -void ADFI_evaluate_datatype( - const int file_index, - const char data_type[], - int *file_bytes, - int *machine_bytes, - struct TOKENIZED_DATA_TYPE *tokenized_data_type, - char *file_format, - char *machine_format, - int *error_return ) -{ -int str_position = 0 ; -int current_token = 0 ; -int i, str_len, size_file, size_machine ; -char data_type_string[ADF_DATA_TYPE_LENGTH + 1 ] ; -struct FILE_HEADER file_header ; - -if( (file_format == NULL) || (machine_format == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (file_bytes == NULL) || (machine_bytes == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -*file_bytes = 0 ; -*machine_bytes = 0 ; -*error_return = NO_ERROR ; - - /** Return the file & machine's format info **/ -if( file_index >= MAXIMUM_FILES ) { - *error_return = FILE_INDEX_OUT_OF_RANGE ; - return ; - } /* end if */ -*file_format = ADF_file_format[file_index] ; -*machine_format = ADF_this_machine_format ; - - /** Convert blank-filled datatype into C string **/ -ADFI_string_2_C_string( data_type, ADF_DATA_TYPE_LENGTH, data_type_string, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Upper_CASE the data-type string **/ -str_len = strlen( data_type_string ) ; -if ( str_len == 0 ) { - *error_return = STRING_LENGTH_ZERO ; - return ; -} /** end if **/ -for( i=0; i= '0') && - (data_type_string[ str_position ] <= '9') ) { - array_size = array_size * 10 + - (data_type_string[ str_position ] - '0') ; - str_position += 1 ; - } /* end while */ - if( data_type_string[ str_position ] != ']' ) { - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end if */ - str_position += 1 ; - /** Check for comma between types **/ - if( data_type_string[ str_position ] == ',' ) { - str_position += 1 ; - } /* end if */ - *file_bytes = *file_bytes + size_file * array_size ; - *machine_bytes = *machine_bytes + size_machine * array_size ; - tokenized_data_type[ current_token++ ].length = array_size ; - } - break ; - - case ',' : - str_position += 1 ; - *file_bytes = *file_bytes + size_file ; - *machine_bytes = *machine_bytes + size_machine ; - break ; - - default : /** Error condition **/ - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ - } /* end while */ -tokenized_data_type[ current_token ].type[0] = 0x00 ; -tokenized_data_type[ current_token ].type[1] = 0x00 ; -tokenized_data_type[ current_token ].file_type_size = *file_bytes; -tokenized_data_type[ current_token ].machine_type_size = *machine_bytes ; -} /* end of ADFI_evaluate_datatype */ -/* end of file ADFI_evaluate_datatype.c */ -/* file ADFI_fflush_file.c */ -/*********************************************************************** -ADFI fflush file: - To flush the file output stream. - -input: const unsigned int file_index File to use. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -ADF_FILE_NOT_OPENED -FFLUSH_ERROR -***********************************************************************/ -void ADFI_fflush_file( - const unsigned int file_index, - int *error_return ) -{ - - -int iret ; - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -iret = fflush( ADF_file[ file_index ] ) ; -if( iret != 0 ) { - *error_return = FFLUSH_ERROR ; - return ; - } /* end if */ -} /* end of ADFI_fflush_file */ -/* end of file ADFI_fflush_file.c */ -/* file ADFI_figure_machine_format.c */ -/* file ADFI_figure_machine_format.c */ -/*********************************************************************** -ADFI figure machine format: - Determine if the host computer is IEEE_BIG, IEEE_LITTLE, - CRAY, or NATIVE. Once this machines format if determined, - look at the requested format. If NATIVE, use this machines - format, otherwise use the requested format. - -input: const char *format IEEE_BIG, IEEE_LITTLE, CRAY, or NATIVE. -output: const char *machine_format 'B', 'L', 'C', 'N' -output: const char *format_to_use 'B', 'L', 'C', 'N' -output: const char *os_to_use 'B', 'L' -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -***********************************************************************/ - -static unsigned char bits[NUMBER_KNOWN_MACHINES][8][8] = { - /* IEEE BIG 32 */ - /* u.i = 123456789: */ 0x07, 0x5B, 0xCD, 0x15, 0x00, 0x00, 0x00, 0x00, - /* u.i = -123456789: */ 0xF8, 0xA4, 0x32, 0xEB, 0x00, 0x00, 0x00, 0x00, - /* u.l = 1234567890L: */ 0x49, 0x96, 0x02, 0xD2, 0x00, 0x00, 0x00, 0x00, - /* u.l = -1234567890L: */ 0xB6, 0x69, 0xFD, 0x2E, 0x00, 0x00, 0x00, 0x00, - /* u.f = 12345.6789: */ 0x46, 0x40, 0xE6, 0xB7, 0x00, 0x00, 0x00, 0x00, - /* u.f = -12345.6789: */ 0xC6, 0x40, 0xE6, 0xB7, 0x00, 0x00, 0x00, 0x00, - /* u.d = 12345.6789: */ 0x40, 0xC8, 0x1C, 0xD6, 0xE6, 0x31, 0xF8, 0xA1, - /* u.d = -12345.6789: */ 0xC0, 0xC8, 0x1C, 0xD6, 0xE6, 0x31, 0xF8, 0xA1, - - /* IEEE LITTLE 32 */ - /* u.i = 123456789: */ 0x15, 0xCD, 0x5B, 0x07, 0x00, 0x00, 0x00, 0x00, - /* u.i = -123456789: */ 0xEB, 0x32, 0xA4, 0xF8, 0x00, 0x00, 0x00, 0x00, - /* u.l = 1234567890L: */ 0xD2, 0x02, 0x96, 0x49, 0x00, 0x00, 0x00, 0x00, - /* u.l = -1234567890L: */ 0x2E, 0xFD, 0x69, 0xB6, 0x00, 0x00, 0x00, 0x00, - /* u.f = 12345.6789: */ 0xB7, 0xE6, 0x40, 0x46, 0x00, 0x00, 0x00, 0x00, - /* u.f = -12345.6789: */ 0xB7, 0xE6, 0x40, 0xC6, 0x00, 0x00, 0x00, 0x00, - /* u.d = 12345.6789: */ 0xA1, 0xF8, 0x31, 0xE6, 0xD6, 0x1C, 0xC8, 0x40, - /* u.d = -12345.6789: */ 0xA1, 0xF8, 0x31, 0xE6, 0xD6, 0x1C, 0xC8, 0xC0, - - /* IEEE BIG 64 */ - /* u.i = 123456789: */ 0x07, 0x5B, 0xCD, 0x15, 0x00, 0x00, 0x00, 0x00, - /* u.i = -123456789: */ 0xF8, 0xA4, 0x32, 0xEB, 0x00, 0x00, 0x00, 0x00, - /* u.l = 1234567890L: */ 0x00, 0x00, 0x00, 0x00, 0x49, 0x96, 0x02, 0xD2, - /* u.l = -1234567890L: */ 0xFF, 0xFF, 0xFF, 0xFF, 0xB6, 0x69, 0xFD, 0x2E, - /* u.f = 12345.6789: */ 0x46, 0x40, 0xE6, 0xB7, 0x00, 0x00, 0x00, 0x00, - /* u.f = -12345.6789: */ 0xC6, 0x40, 0xE6, 0xB7, 0x00, 0x00, 0x00, 0x00, - /* u.d = 12345.6789: */ 0x40, 0xC8, 0x1C, 0xD6, 0xE6, 0x31, 0xF8, 0xA1, - /* u.d = -12345.6789: */ 0xC0, 0xC8, 0x1C, 0xD6, 0xE6, 0x31, 0xF8, 0xA1, - - /* IEEE LITTLE 64 */ - /* u.i = 123456789: */ 0x15, 0xCD, 0x5B, 0x07, 0x00, 0x00, 0x00, 0x00, - /* u.i = -123456789: */ 0xEB, 0x32, 0xA4, 0xF8, 0x00, 0x00, 0x00, 0x00, - /* u.l = 1234567890L: */ 0xD2, 0x02, 0x96, 0x49, 0x00, 0x00, 0x00, 0x00, - /* u.l = -1234567890L: */ 0x2E, 0xFD, 0x69, 0xB6, 0xFF, 0xFF, 0xFF, 0xFF, - /* u.f = 12345.6789: */ 0xB7, 0xE6, 0x40, 0x46, 0x00, 0x00, 0x00, 0x00, - /* u.f = -12345.6789: */ 0xB7, 0xE6, 0x40, 0xC6, 0x00, 0x00, 0x00, 0x00, - /* u.d = 12345.6789: */ 0xA1, 0xF8, 0x31, 0xE6, 0xD6, 0x1C, 0xC8, 0x40, - /* u.d = -12345.6789: */ 0xA1, 0xF8, 0x31, 0xE6, 0xD6, 0x1C, 0xC8, 0xC0, - - /* CRAY */ - /* u.i = 123456789: */ 0x00, 0x00, 0x00, 0x00, 0x07, 0x5B, 0xCD, 0x15, - /* u.i = -123456789: */ 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xA4, 0x32, 0xEB, - /* u.l = 1234567890L: */ 0x00, 0x00, 0x00, 0x00, 0x49, 0x96, 0x02, 0xD2, - /* u.l = -1234567890L: */ 0xFF, 0xFF, 0xFF, 0xFF, 0xB6, 0x69, 0xFD, 0x2E, - /* u.f = 12345.6789: */ 0x40, 0x0E, 0xC0, 0xE6, 0xB7, 0x31, 0x8F, 0xC5, - /* u.f = -12345.6789: */ 0xC0, 0x0E, 0xC0, 0xE6, 0xB7, 0x31, 0x8F, 0xC5, - /* u.d = 12345.6789: */ 0x40, 0x0E, 0xC0, 0xE6, 0xB7, 0x31, 0x8F, 0xC5, - /* u.d = -12345.6789: */ 0xC0, 0x0E, 0xC0, 0xE6, 0xB7, 0x31, 0x8F, 0xC5 - } ; - -void ADFI_figure_machine_format( - const char *format, - char *machine_format, - char *format_to_use, - char *os_to_use, - int *error_return ) -{ -char requested_format, requested_os, machine_os_size ; -union { int i; long l; float f; double d; unsigned char bytes[8]; } u ; -int i, k, OK ; - -if( (machine_format == NULL) || (format_to_use == NULL) || - (os_to_use == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check requested format **/ -if( format == NULL ) { - requested_format = NATIVE_FORMAT_CHAR ; - requested_os = OS_32_BIT ; - } /* end if */ -else if( (format[0] == '\0') || (format[0] == ' ') ) { - requested_format = NATIVE_FORMAT_CHAR ; - requested_os = OS_32_BIT ; - } /* end else if */ -else if( ADFI_stridx_c( IEEE_BIG_32_FORMAT_STRING, format ) == 0 ) { - requested_format = IEEE_BIG_FORMAT_CHAR ; - requested_os = OS_32_BIT ; - } /* end else if */ -else if( ADFI_stridx_c( IEEE_LITTLE_32_FORMAT_STRING, format ) == 0 ) { - requested_format = IEEE_LITTLE_FORMAT_CHAR ; - requested_os = OS_32_BIT ; - } /* end else if */ -else if( ADFI_stridx_c( IEEE_BIG_64_FORMAT_STRING, format ) == 0 ) { - requested_format = IEEE_BIG_FORMAT_CHAR ; - requested_os = OS_64_BIT ; - } /* end else if */ -else if( ADFI_stridx_c( IEEE_LITTLE_64_FORMAT_STRING, format ) == 0 ) { - requested_format = IEEE_LITTLE_FORMAT_CHAR ; - requested_os = OS_64_BIT ; - } /* end else if */ -else if( ADFI_stridx_c( CRAY_FORMAT_STRING, format ) == 0 ) { - requested_format = CRAY_FORMAT_CHAR ; - requested_os = OS_64_BIT ; - } /* end else if */ -else if( ADFI_stridx_c( NATIVE_FORMAT_STRING, format ) == 0 ) { - requested_format = NATIVE_FORMAT_CHAR ; - requested_os = OS_32_BIT ; - } /* end else if */ -else { - *error_return = ADF_FILE_FORMAT_NOT_RECOGNIZED ; - return ; - } /* end else */ - - /***** Determine this machine's numeric format *****/ - /** Check for numeric bit patterns **/ -#define ZERO_UNION() \ - for( k=0; k<8; k++ ) \ - u.bytes[k] = '\0' ; -#define CHECK_UNION(B) \ - if( (u.bytes[0] != B[0]) || (u.bytes[1] != B[1]) || \ - (u.bytes[2] != B[2]) || (u.bytes[3] != B[3]) || \ - (u.bytes[4] != B[4]) || (u.bytes[5] != B[5]) || \ - (u.bytes[6] != B[6]) || (u.bytes[7] != B[7]) ) continue ; - -OK = FALSE ; -*machine_format = NATIVE_FORMAT_CHAR ; -for( i=0; i= 8 ) machine_os_size = OS_64_BIT ; - else machine_os_size = OS_32_BIT ; - } /* end if */ - -if( ADF_this_machine_format == UNDEFINED_FORMAT_CHAR ) { - ADF_this_machine_format = *machine_format ; - ADF_this_machine_os_size = machine_os_size ; - } /* end if */ - -if( requested_format == NATIVE_FORMAT_CHAR ) { - *format_to_use = *machine_format ; - *os_to_use = machine_os_size ; - } /* end if */ -else { - *format_to_use = requested_format ; - *os_to_use = requested_os ; - } /* end if */ - -if( *machine_format == NATIVE_FORMAT_CHAR ) - *error_return = MACHINE_FORMAT_NOT_RECOGNIZED ; - -} /* end of ADFI_figure_machine_format */ -/* end of file ADFI_figure_machine_format.c */ -/* end of file ADFI_figure_machine_format.c */ -/* file ADFI_file_and_machine_compare.c */ -/*********************************************************************** -ADFI file and machine compare: - Compares file and machine formats. - -input: const int file_index The file index (0 to MAXIMUM_FILES). -output: int *compare 1 = formats compare, 0 = do not -output: int *error_return Error return - - Possible errors: -FILE_INDEX_OUT_OF_RANGE -***********************************************************************/ -void ADFI_file_and_machine_compare( - const int file_index, - const struct TOKENIZED_DATA_TYPE *tokenized_data_type, - int *compare, - int *error_return ) -{ - int machine_size, file_size, token ; - *compare = 0 ; - *error_return = NO_ERROR ; - - if( file_index < 0 || file_index >= MAXIMUM_FILES ) { - *error_return = FILE_INDEX_OUT_OF_RANGE ; - return ; - } - - if( ADF_this_machine_format == NATIVE_FORMAT_CHAR || - ADF_file_format[file_index] == NATIVE_FORMAT_CHAR ) { - struct FILE_HEADER file_header ; - /** Get file_header for the file variable sizes **/ - ADFI_read_file_header( file_index, &file_header, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - /** Make sure the sizes are the same or we are cooked!! **/ - if ( ADF_file_format[file_index] != NATIVE_FORMAT_CHAR || - file_header.sizeof_char != sizeof( char ) || - file_header.sizeof_short != sizeof( short ) || - file_header.sizeof_int != sizeof( int ) || - file_header.sizeof_long != sizeof( long ) || - file_header.sizeof_float != sizeof( float ) || - file_header.sizeof_double != sizeof( double ) || - file_header.sizeof_char_p != sizeof( char * ) || - file_header.sizeof_short_p != sizeof( short * ) || - file_header.sizeof_int_p != sizeof( int * ) || - file_header.sizeof_long_p != sizeof( long * ) || - file_header.sizeof_float_p != sizeof( float * ) || - file_header.sizeof_double_p != sizeof( double * ) ) { - *error_return = MACHINE_FILE_INCOMPATABLE ; - return ; - } /** end if **/ - } /** end if **/ - - if( ADF_file_format[file_index] == ADF_this_machine_format && - ADF_file_os_size[file_index] == ADF_this_machine_os_size ) { - *compare = 1 ; - } else if( ADF_file_format[file_index] == ADF_this_machine_format ) { - /** If the file and machine binary type are the same and only the - sizes may be different (like long is 32 or 64), then if all the - sizes are the same then no converion is necessary and ws can avoid - the conversion overhead and just do direct read/writes. **/ - if ( tokenized_data_type == NULL ) return ; - token = -1 ; - *compare = 1 ; - do { - token++ ; - machine_size = tokenized_data_type[ token ].machine_type_size ; - file_size = tokenized_data_type[ token ].file_type_size ; - if ( machine_size != file_size ) { - *compare = 0 ; - break ; - } - } while( tokenized_data_type[ token ].type[0] != 0 ) ; - } -} /* end of ADFI_file_and_machine_compare */ -/* end of file ADFI_file_and_machine_compare.c */ -/* file ADFI_file_block_offset_2_ID.c */ -/*********************************************************************** -ADFI file block and offset to ID: - Convert an ADF file, block, and offset to an ADF ID. - -input: const int file_index The file index (0 to MAXIMUM_FILES). -input: const unsigned long file_block The block within the file. -input: const unsigned long block_offset The offset within the block. -output: double *ID The resulting ADF ID. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -FILE_INDEX_OUT_OF_RANGE -BLOCK_OFFSET_OUT_OF_RANGE -***********************************************************************/ -void ADFI_file_block_offset_2_ID( - const int file_index, - const unsigned long file_block, - const unsigned long block_offset, - double *ID, - int *error_return ) -{ -double dd; -unsigned char * cc; - -if( ID == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; -if( file_index >= MAXIMUM_FILES ) { - *error_return = FILE_INDEX_OUT_OF_RANGE ; - return ; - } /* end if */ - -if( block_offset >= DISK_BLOCK_SIZE ) { - *error_return = BLOCK_OFFSET_OUT_OF_RANGE ; - return ; - } /* end if */ - - /** Map the bytes into the character variable **/ - /* Note that there were problems with some machines flushing small numbers - to zero causing problems with the encoding of ID (which is not in - its self a true number). The IEEE standard says that this is not - allowed and so should not be a problem except that you get a major - performance hit on the machine if you have it enforce the IEEE - standard. Thus I force the sign bit on the exponent to always be positive - so that the ID is a number greater than |1|. Previously on the - IEEE big endian the numbers would look like 3.132313E-311. The - new encoding changes the max number of open files to 16K from 64K */ - -cc = (unsigned char *) ⅆ -if ( ADF_this_machine_format == IEEE_BIG_FORMAT_CHAR ) { - cc[1] = (unsigned char) (file_index & 0x00ff) ; - cc[0] = (unsigned char) (64 + (( file_index >> 8) & 0x003f)) ; - - cc[2] = (unsigned char) (file_block & 0x000000ff) ; - cc[3] = (unsigned char) ((file_block >> 8) & 0x000000ff) ; - cc[4] = (unsigned char) ((file_block >> 16) & 0x000000ff) ; - cc[5] = (unsigned char) ((file_block >> 24) & 0x000000ff) ; - - cc[6] = (unsigned char) (block_offset & 0x00ff) ; - cc[7] = (unsigned char) ((block_offset >> 8) & 0x00ff) ; - } /* end if */ -else if ( ADF_this_machine_format == IEEE_LITTLE_FORMAT_CHAR ) { - cc[6] = (unsigned char) (file_index & 0x00ff) ; - cc[7] = (unsigned char) (64 + (( file_index >> 8) & 0x003f)) ; - - cc[2] = (unsigned char) (file_block & 0x000000ff) ; - cc[3] = (unsigned char) ((file_block >> 8) & 0x000000ff) ; - cc[4] = (unsigned char) ((file_block >> 16) & 0x000000ff) ; - cc[5] = (unsigned char) ((file_block >> 24) & 0x000000ff) ; - - cc[0] = (unsigned char) (block_offset & 0x00ff) ; - cc[1] = (unsigned char) ((block_offset >> 8) & 0x00ff) ; - } /* end else if */ -else { - cc[0] = (unsigned char) (file_index & 0x00ff) ; - cc[1] = (unsigned char) ((file_index >> 8) & 0x00ff) ; - - cc[2] = (unsigned char) (file_block & 0x000000ff) ; - cc[3] = (unsigned char) ((file_block >> 8) & 0x000000ff) ; - cc[4] = (unsigned char) ((file_block >> 16) & 0x000000ff) ; - cc[5] = (unsigned char) ((file_block >> 24) & 0x000000ff) ; - - cc[6] = (unsigned char) (block_offset & 0x00ff) ; - cc[7] = (unsigned char) ((block_offset >> 8) & 0x00ff) ; - } /* end else */ - -*ID = dd; -#ifdef PRINT_STUFF -printf("cc[0-7] = %02X %02X %02X %02X %02X %02X %02X %02X \n", - cc[0], cc[1], cc[2], cc[3], - cc[4], cc[5], cc[6], cc[7] ) ; -printf("In ADFI_file_block_offset_2_ID: ID=%lf\n",*ID); -#endif - -} /* end of ADFI_file_block_offset_2_ID */ -/* end of file ADFI_file_block_offset_2_ID.c */ -/* file ADFI_file_free.c */ -/*********************************************************************** -ADFI file free: - To free-up a chunk of file space. - -input: const int file_index The file index (0 to MAXIMUM_FILES). -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const long number_of_bytes Number of bytes to free. If 0, - then look at type of chunk to get size. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -FREE_OF_ROOT_NODE -ADF_DISK_TAG_ERROR -FREE_OF_FREE_CHUNK_TABLE -***********************************************************************/ -void ADFI_file_free( - const int file_index, - const struct DISK_POINTER *block_offset, - const long in_number_of_bytes, - int *error_return ) -{ -char tag[TAG_SIZE + 1] ; -struct DISK_POINTER end_of_chunk_tag ; -struct DISK_POINTER tmp_blk_ofst ; -struct FREE_CHUNK_TABLE free_chunk_table ; -struct FREE_CHUNK free_chunk ; -int i ; -long number_of_bytes = in_number_of_bytes ; - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -if( number_of_bytes == 0 ) { - - /** Check the disk tag to see what kind of disk chunk we have. - We need this to determine the length of the chunk. **/ - ADFI_read_file( file_index, block_offset->block, block_offset->offset, - TAG_SIZE, tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - tag[TAG_SIZE] = '\0' ; /* Null terminate the string */ - - end_of_chunk_tag.block = 0 ; - end_of_chunk_tag.offset = 0 ; - if( ADFI_stridx_c( tag, node_start_tag ) == 0 ) { /** This is a node **/ - if( (block_offset->block == ROOT_NODE_BLOCK) && - (block_offset->offset == ROOT_NODE_OFFSET) ) { - *error_return = FREE_OF_ROOT_NODE ; - return ; - } /* end if */ - end_of_chunk_tag.block = block_offset->block ; - end_of_chunk_tag.offset = block_offset->offset + NODE_HEADER_SIZE - - TAG_SIZE ; - if ( end_of_chunk_tag.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } - - /** Check disk boundary-tag **/ - ADFI_read_file( file_index, end_of_chunk_tag.block, - end_of_chunk_tag.offset, TAG_SIZE, tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - if( ADFI_stridx_c( tag, node_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - } /* end if */ - else if( ADFI_stridx_c( tag, free_chunk_table_start_tag ) == 0 ) { - /** Trying to free the free-chunk-table. This is BAD. **/ - *error_return = FREE_OF_FREE_CHUNK_TABLE ; - return ; - } /* end else if */ - else if( ADFI_stridx_c( tag, free_chunk_start_tag ) == 0 ) { - - /** Set a temporary block/offset to read disk pointer **/ - tmp_blk_ofst.block = block_offset->block ; - tmp_blk_ofst.offset = block_offset->offset + TAG_SIZE ; - if ( tmp_blk_ofst.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &tmp_blk_ofst, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } - /** Get the end_of_chunk-tag block/offset from disk **/ - ADFI_read_disk_pointer_from_disk( file_index, tmp_blk_ofst.block, - tmp_blk_ofst.offset, &end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Check disk boundary-tag **/ - ADFI_read_file( file_index, end_of_chunk_tag.block, - end_of_chunk_tag.offset, TAG_SIZE, tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - if( ADFI_stridx_c( tag, free_chunk_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - } /* end else if */ - else if( ADFI_stridx_c( tag, sub_node_start_tag ) == 0 ) { - - /** Set a temporary block/offset to read disk pointer **/ - tmp_blk_ofst.block = block_offset->block ; - tmp_blk_ofst.offset = block_offset->offset + TAG_SIZE ; - if ( tmp_blk_ofst.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &tmp_blk_ofst, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } - - /** Get the end_of_chunk-tag block/offset from disk **/ - ADFI_read_disk_pointer_from_disk( file_index, tmp_blk_ofst.block, - tmp_blk_ofst.offset, &end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Check disk boundary-tag **/ - ADFI_read_file( file_index, end_of_chunk_tag.block, - end_of_chunk_tag.offset, TAG_SIZE, tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - if( ADFI_stridx_c( tag, sub_node_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - } /* end else if */ - else if( ADFI_stridx_c( tag, data_chunk_table_start_tag ) == 0 ) { - - /** Set a temporary block/offset to read disk pointer **/ - tmp_blk_ofst.block = block_offset->block ; - tmp_blk_ofst.offset = block_offset->offset + TAG_SIZE ; - if ( tmp_blk_ofst.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &tmp_blk_ofst, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } - - /** Get the end_of_chunk-tag block/offset from disk **/ - ADFI_read_disk_pointer_from_disk( file_index, tmp_blk_ofst.block, - tmp_blk_ofst.offset, &end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Check disk boundary-tag **/ - ADFI_read_file( file_index, end_of_chunk_tag.block, - end_of_chunk_tag.offset, TAG_SIZE, tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - if( ADFI_stridx_c( tag, data_chunk_table_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - } /* end else if */ - else if( ADFI_stridx_c( tag, data_chunk_start_tag ) == 0 ) { - - /** Set a temporary block/offset to read disk pointer **/ - tmp_blk_ofst.block = block_offset->block ; - tmp_blk_ofst.offset = block_offset->offset + TAG_SIZE ; - if ( tmp_blk_ofst.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &tmp_blk_ofst, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } - - /** Get the end_of_chunk-tag block/offset from disk **/ - ADFI_read_disk_pointer_from_disk( file_index, tmp_blk_ofst.block, - tmp_blk_ofst.offset, &end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Check disk boundary-tag **/ - ADFI_read_file( file_index, end_of_chunk_tag.block, - end_of_chunk_tag.offset, TAG_SIZE, tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - if( ADFI_stridx_c( tag, data_chunk_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - } /* end else if */ - else { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end else */ - number_of_bytes = (end_of_chunk_tag.block - block_offset->block) * - DISK_BLOCK_SIZE + (end_of_chunk_tag.offset - block_offset->offset + - TAG_SIZE) ; - } /* end if */ -else { /** Use the number of bytes passed in **/ - end_of_chunk_tag.block = block_offset->block ; - end_of_chunk_tag.offset = block_offset->offset + number_of_bytes - TAG_SIZE ; - ADFI_adjust_disk_pointer( &end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - -if( number_of_bytes <= SMALLEST_CHUNK_SIZE ) { /** Too small, z-gas **/ - /** Initialize the block of 'Z's **/ - if( block_of_ZZ_initialized == FALSE ) { - for( i=0; iblock, block_offset->offset, - number_of_bytes, block_of_ZZ, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ -else { /** Add this chunk to the free table **/ - /** Get the free-chunk-table **/ - ADFI_read_free_chunk_table( file_index, &free_chunk_table, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - if( block_offset->block == end_of_chunk_tag.block ) { /* small or medium */ - if( (end_of_chunk_tag.offset + TAG_SIZE - block_offset->offset) <= - SMALL_CHUNK_MAXIMUM ) { /** SMALL chunk **/ - free_chunk.end_of_chunk_tag.block = end_of_chunk_tag.block ; - free_chunk.end_of_chunk_tag.offset = end_of_chunk_tag.offset ; - free_chunk.next_chunk.block = free_chunk_table.small_first_block.block; - free_chunk.next_chunk.offset = - free_chunk_table.small_first_block.offset ; - - free_chunk_table.small_first_block.block = block_offset->block ; - free_chunk_table.small_first_block.offset = block_offset->offset ; - - /** If linked-list was empty, also point to this as the last. **/ - if( free_chunk.next_chunk.offset == BLANK_BLOCK_OFFSET ) { - free_chunk_table.small_last_block.block = block_offset->block ; - free_chunk_table.small_last_block.offset = block_offset->offset ; - } /* end if */ - } /* end if */ - else { /** MEDIUM chunk **/ - free_chunk.end_of_chunk_tag.block = end_of_chunk_tag.block ; - free_chunk.end_of_chunk_tag.offset = end_of_chunk_tag.offset ; - free_chunk.next_chunk.block = - free_chunk_table.medium_first_block.block ; - free_chunk.next_chunk.offset = - free_chunk_table.medium_first_block.offset; - - free_chunk_table.medium_first_block.block = block_offset->block ; - free_chunk_table.medium_first_block.offset = block_offset->offset ; - - /** If linked-list was empty, also point to this as the last. **/ - if( free_chunk.next_chunk.offset == BLANK_BLOCK_OFFSET ) { - free_chunk_table.medium_last_block.block = block_offset->block ; - free_chunk_table.medium_last_block.offset = block_offset->offset ; - } /* end if */ - } /* end else */ - } /* end if */ - else { /** LARGE chunk **/ - free_chunk.end_of_chunk_tag.block = end_of_chunk_tag.block ; - free_chunk.end_of_chunk_tag.offset = end_of_chunk_tag.offset ; - free_chunk.next_chunk.block = free_chunk_table.large_first_block.block; - free_chunk.next_chunk.offset = - free_chunk_table.large_first_block.offset ; - - free_chunk_table.large_first_block.block = block_offset->block ; - free_chunk_table.large_first_block.offset = block_offset->offset ; - - /** If linked-list was empty, also point to this as the last. **/ - if( free_chunk.next_chunk.offset == BLANK_BLOCK_OFFSET ) { - free_chunk_table.large_last_block.block = block_offset->block ; - free_chunk_table.large_last_block.offset = block_offset->offset ; - } /* end if */ - } /* end else */ - - /** Put the free-chunk tags in place **/ - strncpy( free_chunk.start_tag, free_chunk_start_tag, TAG_SIZE ) ; - strncpy( free_chunk.end_tag, free_chunk_end_tag, TAG_SIZE ) ; - - /** Write out the free chunk **/ - ADFI_write_free_chunk( file_index, block_offset, &free_chunk, error_return ); - if( *error_return != NO_ERROR ) - return ; - /** Update the free-chunk-table **/ - ADFI_write_free_chunk_table( file_index, &free_chunk_table, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - - /** Delete the block/offset off the stack **/ - ADFI_stack_control(file_index, block_offset->block, block_offset->offset, - DEL_STK_ENTRY, 0, 0, NULL ) ; - -} /* end of ADFI_file_free */ -/* end of file ADFI_file_free.c */ -/* file ADFI_file_malloc.c */ -/*********************************************************************** -ADFI file malloc: - To allocate a chunk of disk space. - -input: const int file_index The file index (0 to MAXIMUM_FILES). -input: size_bytes The size in bytes to allocate. -output: const struct DISK_POINTER *block_offset Block & offset in the file. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_file_malloc( - const int file_index, - const long size_bytes, - struct DISK_POINTER *block_offset, - int *error_return ) -{ -struct FILE_HEADER file_header ; -struct FREE_CHUNK_TABLE free_chunk_table ; -struct DISK_POINTER disk_pointer, previous_disk_pointer ; -struct DISK_POINTER *first_free_block, *last_free_block ; -struct FREE_CHUNK free_chunk, previous_free_chunk ; -int i ; -int memory_found = FALSE ; -unsigned long size ; - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - - /** Get the free-chunk_table **/ -ADFI_read_free_chunk_table( file_index, &free_chunk_table, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Look for the needed space in the 3 free lists. - Note that all file control headers are smaller than - the SMALLEST_CHUNK_SIZE and so will be fit later into - a block at the end of the file. This greatly improves - node creation efficiency. **/ -for( i=0; i<3; i++ ) { - if( memory_found == TRUE || size_bytes <= SMALLEST_CHUNK_SIZE ) - break ; - ADFI_set_blank_disk_pointer( &previous_disk_pointer ) ; - switch( i ) { - case 0: /** SMALL CHUNKS **/ - if( size_bytes > SMALL_CHUNK_MAXIMUM ) - continue ; /** Next in the for loop **/ - first_free_block = &free_chunk_table.small_first_block ; - last_free_block = &free_chunk_table.small_last_block ; - break ; - case 1: /** MEDIUM CHUNKS **/ - if( size_bytes > MEDIUM_CHUNK_MAXIMUM ) - continue ; /** Next in the for loop **/ - first_free_block = &free_chunk_table.medium_first_block ; - last_free_block = &free_chunk_table.medium_last_block ; - break ; - case 2: /** LARGE CHUNKS **/ - first_free_block = &free_chunk_table.large_first_block ; - last_free_block = &free_chunk_table.large_last_block ; - break ; - } /* end switch */ - - disk_pointer = *first_free_block ; - while( (memory_found != TRUE) && - ((disk_pointer.block != BLANK_FILE_BLOCK) || - (disk_pointer.offset != BLANK_BLOCK_OFFSET)) ) { - ADFI_read_free_chunk( file_index, &disk_pointer, &free_chunk, - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - size = (free_chunk.end_of_chunk_tag.block - disk_pointer.block) * - DISK_BLOCK_SIZE + - (free_chunk.end_of_chunk_tag.offset - disk_pointer.offset) + - TAG_SIZE ; - if( (long int) size >= size_bytes ) { - *block_offset = disk_pointer ; - if( (previous_disk_pointer.block != BLANK_FILE_BLOCK) || - (previous_disk_pointer.offset != BLANK_BLOCK_OFFSET) ) { - - /** Link previous free-chunk to the next free-chunk, - removing this free-chunk from the list - **/ - ADFI_read_free_chunk( file_index, &previous_disk_pointer, - &previous_free_chunk, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - previous_free_chunk.next_chunk = free_chunk.next_chunk ; - ADFI_write_free_chunk( file_index, &previous_disk_pointer, - &previous_free_chunk, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - else { - - /** Free-chunk was the first one, change entry in the free-chunk-header **/ - *first_free_block = free_chunk.next_chunk ; - ADFI_write_free_chunk_table( file_index, &free_chunk_table, - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - - if((last_free_block->block == disk_pointer.block) && - (last_free_block->offset == disk_pointer.offset)){ - if( (previous_disk_pointer.block != BLANK_FILE_BLOCK) || - (previous_disk_pointer.offset != BLANK_BLOCK_OFFSET) ) { - *last_free_block = previous_disk_pointer ; - } /* end if */ - else { - ADFI_set_blank_disk_pointer( last_free_block ) ; - } /* end else */ - ADFI_write_free_chunk_table( file_index, &free_chunk_table, - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - - size -= size_bytes ; - if ( size > 0 ) { - disk_pointer.offset += size_bytes ; - ADFI_adjust_disk_pointer( &disk_pointer, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - ADFI_file_free( file_index, &disk_pointer, size, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } - memory_found = TRUE ; - } /* end if */ - else { - previous_disk_pointer = disk_pointer ; - disk_pointer = free_chunk.next_chunk ; - } /* end else */ - } /* end while */ - } /* end if */ - - /** The end-of_file pointer points to the last byte USED, - NOT the next byte TO USE. - **/ -if( memory_found != TRUE ) { /* Append memory at end of file **/ - ADFI_read_file_header( file_index, &file_header, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - /** If the end-of_file is NOT at a block boundary, then - see if the new allocated chunk will span a block boundary. - If it will, then start at the new block if it will fit within - the block. This helps efficiency to have file control headers - located within a block boundry. - **/ - if( file_header.end_of_file.offset != DISK_BLOCK_SIZE - 1 ) { - if( (file_header.end_of_file.offset+size_bytes) >= DISK_BLOCK_SIZE && - size_bytes <= DISK_BLOCK_SIZE ) { - /** Free rest of block, allocate from next block **/ - file_header.end_of_file.offset++ ; - ADFI_file_free( file_index, &file_header.end_of_file, - DISK_BLOCK_SIZE - file_header.end_of_file.offset, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - block_offset->block = file_header.end_of_file.block + 1 ; - block_offset->offset = 0 ; - file_header.end_of_file.block++ ; - file_header.end_of_file.offset = size_bytes - 1 ; - ADFI_adjust_disk_pointer( &file_header.end_of_file, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - } /* end if */ - else { /** Use the remaining block **/ - block_offset->block = file_header.end_of_file.block ; - block_offset->offset = file_header.end_of_file.offset + 1 ; - file_header.end_of_file.offset += size_bytes ; - ADFI_adjust_disk_pointer( &file_header.end_of_file, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - } /* end if */ - else { /* already pointing to start of block **/ - block_offset->block = file_header.end_of_file.block + 1 ; - block_offset->offset = 0 ; - file_header.end_of_file.block++ ; - file_header.end_of_file.offset = size_bytes - 1 ; - ADFI_adjust_disk_pointer( &file_header.end_of_file, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - - - /** Write out the modified file header **/ - ADFI_write_file_header( file_index, &file_header, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - -} /* end of ADFI_file_malloc */ -/* end of file ADFI_file_malloc.c */ -/* file ADFI_fill_initial_file_header.c */ -/*********************************************************************** -ADFI fill initial file header: - To determine the file header information... - -input: const char format 'B', 'L', 'C', 'N' -input: const char os_size 'B', 'L' -input: const char *what_string UNIX "what" identifier. -output: struct FILE_HEADER *file_header The resulting file header information. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -ADF_FILE_FORMAT_NOT_RECOGNIZED -***********************************************************************/ -void ADFI_fill_initial_file_header( - const char format, - const char os_size, - const char *what_string, - struct FILE_HEADER *file_header, - int *error_return ) -{ -int i ; - -if( what_string == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_header == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (format != IEEE_BIG_FORMAT_CHAR) && (format != IEEE_LITTLE_FORMAT_CHAR) && - (format != CRAY_FORMAT_CHAR) && (format != NATIVE_FORMAT_CHAR) ) { - *error_return = ADF_FILE_FORMAT_NOT_RECOGNIZED ; - return ; - } /* end if */ - - /** Put the boundary tags in first. If we then overwrite them, we'll know **/ -strncpy( file_header->tag0, file_header_tags[0], TAG_SIZE ) ; -strncpy( file_header->tag1, file_header_tags[1], TAG_SIZE ) ; -strncpy( file_header->tag2, file_header_tags[2], TAG_SIZE ) ; -strncpy( file_header->tag3, file_header_tags[3], TAG_SIZE ) ; -strncpy( file_header->tag4, file_header_tags[4], TAG_SIZE ) ; -strncpy( file_header->tag5, file_header_tags[5], TAG_SIZE ) ; - - /** The UNIX "what" string" - blank terminated **/ -strncpy( file_header->what, what_string, WHAT_STRING_SIZE ) ; -if ( strlen(what_string) < WHAT_STRING_SIZE ) -{ - ADFI_blank_fill_string ( file_header->what, WHAT_STRING_SIZE ) ; -} - - /** File creation date/time - blank terminated **/ -ADFI_get_current_date( file_header->creation_date ) ; - - /** File modification date/time - same as creation time **/ -strncpy( file_header->modification_date, file_header->creation_date, - DATE_TIME_SIZE ) ; - -file_header->numeric_format = format ; -file_header->os_size = os_size ; - - /** Set sizeof() information for file data **/ -if( (format==ADF_this_machine_format && os_size==ADF_this_machine_os_size) || - format==NATIVE_FORMAT_CHAR ) -{ - file_header->sizeof_char = sizeof( char ) ; - file_header->sizeof_short = sizeof( short ) ; - file_header->sizeof_int = sizeof( int ) ; - file_header->sizeof_long = sizeof( long ) ; - file_header->sizeof_float = sizeof( float ) ; - file_header->sizeof_double = sizeof( double ) ; - file_header->sizeof_char_p = sizeof( char * ) ; - file_header->sizeof_short_p = sizeof( short * ) ; - file_header->sizeof_int_p = sizeof( int * ) ; - file_header->sizeof_long_p = sizeof( long * ) ; - file_header->sizeof_float_p = sizeof( float * ) ; - file_header->sizeof_double_p = sizeof( double * ) ; -} /** end if **/ -else -{ - switch( EVAL_2_BYTES( format, os_size ) ) { - case EVAL_2_BYTES( 'B', 'L' ): - i = IEEE_BIG_32_FORMAT - 1 ; - break ; - case EVAL_2_BYTES( 'L', 'L' ): - i = IEEE_LITTLE_32_FORMAT - 1 ; - break ; - case EVAL_2_BYTES( 'B', 'B' ): - i = IEEE_BIG_64_FORMAT - 1 ; - break ; - case EVAL_2_BYTES( 'L', 'B' ): - i = IEEE_LITTLE_64_FORMAT - 1 ; - break ; - case EVAL_2_BYTES( 'C', 'B' ): - i = CRAY_FORMAT - 1 ; - break ; - default: - *error_return = MACHINE_FORMAT_NOT_RECOGNIZED ; - return ; - } /* end switch */ - - file_header->sizeof_char = machine_sizes[i][ 0] ; - file_header->sizeof_short = machine_sizes[i][ 3] ; - file_header->sizeof_int = machine_sizes[i][ 5] ; - file_header->sizeof_long = machine_sizes[i][ 7] ; - file_header->sizeof_float = machine_sizes[i][ 9] ; - file_header->sizeof_double = machine_sizes[i][10] ; - file_header->sizeof_char_p = machine_sizes[i][11] ; - file_header->sizeof_short_p = machine_sizes[i][12] ; - file_header->sizeof_int_p = machine_sizes[i][12] ; - file_header->sizeof_long_p = machine_sizes[i][13] ; - file_header->sizeof_float_p = machine_sizes[i][14] ; - file_header->sizeof_double_p = machine_sizes[i][15] ; -} /** end else **/ - - /** Set root node table pointers **/ -file_header->root_node.block = ROOT_NODE_BLOCK ; -file_header->root_node.offset = ROOT_NODE_OFFSET ; -file_header->end_of_file.block = ROOT_NODE_BLOCK ; -file_header->end_of_file.offset = ROOT_NODE_OFFSET + NODE_HEADER_SIZE - 1 ; -file_header->free_chunks.block = FREE_CHUNKS_BLOCK ; -file_header->free_chunks.offset = FREE_CHUNKS_OFFSET ; -ADFI_set_blank_disk_pointer( &file_header->extra ) ; - -} /* end of ADFI_fill_initial_file_header */ -/* end of file ADFI_fill_initial_file_header.c */ -/* file ADFI_fill_initial_free_chunk_table.c */ -/*********************************************************************** -ADFI fill initial free chunk header: - To fill out a new free chunk header. - -output: struct FREE_CHUNK_TABLE *free_chunk_table Resulting header info. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -***********************************************************************/ -void ADFI_fill_initial_free_chunk_table( - struct FREE_CHUNK_TABLE *free_chunk_table, - int *error_return ) -{ - -if( free_chunk_table == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -strncpy( free_chunk_table->start_tag, free_chunk_table_start_tag, TAG_SIZE ) ; -strncpy( free_chunk_table->end_tag, free_chunk_table_end_tag, TAG_SIZE ) ; - - /** Small: First and Last Blocks **/ -ADFI_set_blank_disk_pointer( &free_chunk_table->small_first_block ) ; -ADFI_set_blank_disk_pointer( &free_chunk_table->small_last_block ) ; - - /** Medium: First and Last Blocks **/ -ADFI_set_blank_disk_pointer( &free_chunk_table->medium_first_block ) ; -ADFI_set_blank_disk_pointer( &free_chunk_table->medium_last_block ) ; - - /** large: First and Last Blocks **/ -ADFI_set_blank_disk_pointer( &free_chunk_table->large_first_block ) ; -ADFI_set_blank_disk_pointer( &free_chunk_table->large_last_block ) ; -} /* end of ADFI_fill_initial_free_chunk_table */ -/* end of file ADFI_fill_initial_free_chunk_table.c */ -/* file ADFI_fill_initial_node_header.c */ -/*********************************************************************** -ADFI fill initial node header: - To fill out a new node header. - -output: struct NODE_HEADER *node_header The resulting node header information. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -***********************************************************************/ -void ADFI_fill_initial_node_header( - struct NODE_HEADER *node_header, - int *error_return ) -{ -int i ; - -if( node_header == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -strncpy( node_header->node_start_tag, node_start_tag, TAG_SIZE ) ; -strncpy( node_header->node_end_tag, node_end_tag, TAG_SIZE ) ; - - /** Blank out the name **/ -for( i=0; iname[i] = ' ' ; - - /** Blank out the label **/ -for( i=0; ilabel[i] = ' ' ; - - /** Set number of sub nodes to zero **/ -node_header->num_sub_nodes = 0 ; -node_header->entries_for_sub_nodes = 0 ; -ADFI_set_blank_disk_pointer( &node_header->sub_node_table ) ; - - /** Blank out the Data-Type, then set to eMpTy. **/ -for( i=2; idata_type[i] = ' ' ; -node_header->data_type[0] = 'M' ; -node_header->data_type[1] = 'T' ; - - - /** Zero out number of dimensions & Set dimension values to zero **/ -node_header->number_of_dimensions = 0 ; -for( i=0; idimension_values[i] = 0 ; - - /** Set number of data chunks to zero, zero out data chunk pointer **/ -node_header->number_of_data_chunks = 0 ; -ADFI_set_blank_disk_pointer( &node_header->data_chunks ) ; -} /* end of ADFI_fill_initial_node_header */ -/* end of file ADFI_fill_initial_node_header.c */ -/* file ADFI_flush_buffers.c */ -/*********************************************************************** -ADFI Flush buffers: - -input: const unsigned int file_index The file index. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -ADF_FILE_NOT_OPENED -FWRITE_ERROR -***********************************************************************/ -void ADFI_flush_buffers( - const unsigned int file_index, - int flush_mode, - int *error_return ) -{ -char data; - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; -} /* end if */ - -*error_return = NO_ERROR ; - -if ( (long int) file_index == last_wr_file ) { - /** Flush any active write buffer, file block is set to a nonsense - value so that the buffer flags are not reset **/ - ADFI_write_file ( file_index, MAXIMUM_32_BITS, 0, 0, &data, error_return ) ; - /** Reset control flags **/ - if ( flush_mode == FLUSH_CLOSE ) - last_wr_block = last_wr_file = flush_wr_block = -2 ; -} - -if ( (long int) file_index == last_rd_file && flush_mode == FLUSH_CLOSE ) { - /** Reset control flags **/ - last_rd_block = last_rd_file = num_in_rd_block = -1 ; -} - -} /* end of ADFI_flush_buffers */ -/* end of file ADFI_flush_buffers.c */ -/* file ADFI_fseek_file.c */ -/*********************************************************************** -ADFI_fseek_file: - To position the current position for fread() or fwrite(). - Need to allow for files larger than what a long int can - represent (the offset for fseek). - -input: const unsigned int file_index File to use. -input: const unsigned long file_block Block within the file. -input: const unsigned long block_offset Offset within the block. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -ADF_FILE_NOT_OPENED -FSEEK_ERROR -***********************************************************************/ -void ADFI_fseek_file( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - int *error_return ) -{ -off_t offset ; -int iret ; - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -offset = file_block * DISK_BLOCK_SIZE + block_offset ; -iret = fseek( ADF_file[ file_index ], offset, SEEK_SET ) ; -if( iret != 0 ) { - *error_return = FSEEK_ERROR ; - return ; - } /* end if */ -} /* end of ADFI_fseek_file */ -/* end of file ADFI_fseek_file.c */ -/* file ADFI_get_current_date.c */ -/*********************************************************************** -ADFI get current date: - Returns the current date and time in a blank-filled character array. - -output: char date[] Current date/time in an array blank-filled - to DATE_TIME_SIZE. Array must be allocated - to at least DATE_TIME_SIZE. No null added. - -***********************************************************************/ -void ADFI_get_current_date( - char date[] ) -{ -time_t ct ; -int i_len ; -char *current_time_p ; - - - /** get the current time **/ -ct = time( (time_t *)NULL ) ; -current_time_p = ctime( &ct ) ; - - /** remove '\n' from ctime format **/ -i_len = strcspn ( current_time_p, "\n" ) ; -strcpy( date, current_time_p ) ; -date[i_len] = '\0' ; - - /** blank fill **/ -ADFI_blank_fill_string ( date, DATE_TIME_SIZE ) ; - -} /* end of ADFI_get_current_date */ -/* end of file ADFI_get_current_date.c */ -/* file ADFI_get_direct_children_ids.c */ -/*********************************************************************** -ADFI get direct children ids: - -Get Children ids of a Node. Return the ids of children nodes directly -associated with a parent node (no links are followed). The ids of the -children are NOT guaranteed to be returned in any particular order. -If it is desired to follow potential links for the node ID, then -call ADFI_chase_link() and pass the resultant link ID to this function. -NOTE: link nodes do not have direct children. - - -ADFI_get_direct_children_ids( ID, num_ids, ids, error_return ) -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *node_block_offset Block & offset in file. -output: int *num_ids The number of ids returned. -output: double **ids An allocated array of ids (free this space). -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -MEMORY_ALLOCATION_FAILED -FILE_INDEX_OUT_OF_RANGE -BLOCK_OFFSET_OUT_OF_RANGE -ADF_FILE_NOT_OPENED -ADF_DISK_TAG_ERROR -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_get_direct_children_ids( - const unsigned int file_index, - const struct DISK_POINTER *node_block_offset, - int *num_ids, - double **ids, - int *error_return ) -{ -int i ; -struct DISK_POINTER sub_node_block_offset ; -struct NODE_HEADER node ; -struct SUB_NODE_TABLE_ENTRY sub_node_table_entry ; - -*error_return = NO_ERROR ; - -if( num_ids == NULL || ids == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -*num_ids = 0 ; -*ids = NULL ; - -ADFI_read_node_header( file_index, node_block_offset, &node, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Check for zero children, return if 0 **/ -if( node.num_sub_nodes == 0 ) { - return ; - } /* end if */ - -*ids = (double *) malloc ( node.num_sub_nodes * sizeof(double) ) ; -if( *ids == NULL ) { - *error_return = MEMORY_ALLOCATION_FAILED ; - return ; - } /* end if */ - - /** point to the first child **/ -sub_node_block_offset.block = node.sub_node_table.block ; -sub_node_block_offset.offset = node.sub_node_table.offset + - (TAG_SIZE + DISK_POINTER_SIZE ) ; - - /** Return the ids for all the children **/ -*num_ids = node.num_sub_nodes ; -for( i=0; i< *num_ids; i++ ) { - ADFI_adjust_disk_pointer( &sub_node_block_offset, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Read one sub-node table entry **/ - ADFI_read_sub_node_table_entry( file_index, &sub_node_block_offset, - &sub_node_table_entry, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Get the ID from the sub-node table **/ - ADFI_file_block_offset_2_ID( file_index, - sub_node_table_entry.child_location.block, - sub_node_table_entry.child_location.offset, &(*ids)[i], - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Increment the disk-pointer **/ - sub_node_block_offset.offset += (ADF_NAME_LENGTH + DISK_POINTER_SIZE) ; - } /* end for */ -} -/* end of file ADFI_get_direct_children_ids.c */ -/* file ADFI_get_file_index_from_name.c */ -/*********************************************************************** -ADFI get file index from name: - -Searches file list for given name. Returns file index and Root ID -if name is found in list. - -input: const char *file_name Name of file -output: int *found 1 = name found, 0 = not found -output: unsigned int *file_index File-index -output: double *ID ID of files root node -output: int *error_return Error return -***********************************************************************/ -void ADFI_get_file_index_from_name( - const char *file_name, - int *found, - unsigned int *file_index, - double *ID, - int *error_return ) -{ -double root_ID ; -int i ; - - -*error_return = NO_ERROR ; -*found = 0; - -if( (file_index == NULL) || (ID == NULL) || (found == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_name == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -for( i=0; i 12) ) { - *error_return = BAD_NUMBER_OF_DIMENSIONS ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -offset = 0 ; -accumlated_size = 1 ; -for( i=0; i>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -Machine Numeric Formats: -***IEEE_LITTLE ( The backwards Big Endian ) -I4: Byte0 Byte1 Byte2 Byte3 - LSB---------------------MSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: 23-bit mantissa, 8-bit exponent, sign-bit - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: 52-bit mantissa, 11-bit exponent, sign-bit - -Note: To convert between these two formats the order of the bytes is reversed -since by definition the Big endian starts at the LSB and goes to the MSB where -the little goes form the MSB to the LSB of the word. -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_little_endian_32_swap_64( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -if ( delta_to_bytes == delta_from_bytes ) { - memcpy( to_data, from_data, delta_from_bytes ) ; - } /* end if */ -else if ( delta_from_bytes < delta_to_bytes ) { - switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - case EVAL_2_BYTES( 'I', '8' ): - if( (from_data[3] & 0x80) == 0x80 ) { /* Negative number */ - to_data[7] = 0xff ; - to_data[6] = 0xff ; - to_data[5] = 0xff ; - to_data[4] = 0xff ; - } /* end if */ - else { - to_data[7] = 0x00 ; - to_data[6] = 0x00 ; - to_data[5] = 0x00 ; - to_data[4] = 0x00 ; - } /* end else */ - to_data[3] = from_data[3] ; - to_data[2] = from_data[2] ; - to_data[1] = from_data[1] ; - to_data[0] = from_data[0] ; - break ; - default: - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ - } /* end else if */ -else { - switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - case EVAL_2_BYTES( 'I', '8' ): - to_data[3] = from_data[3] ; - to_data[2] = from_data[2] ; - to_data[1] = from_data[1] ; - to_data[0] = from_data[0] ; - break ; - default: - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ - } /* end else */ - -} /* end of ADFI_little_endian_32_swap_64 */ -/* end of file ADFI_little_endian_32_swap_64.c */ -/* file ADFI_little_endian_to_cray.c */ -/*********************************************************************** -ADFI little endian to cray: - -input: const char from_format Format to convert from. 'B','L','C','N' -input: const char from_os_size Format to convert from. 'B','L' -input: const char to_format Format to convert to. -input: const char to_os_size Format to convert to. 'B','L' -input: const char data_type[2] The type of data to convert. - MT I4 I8 U4 U8 R4 R8 X4 X8 C1 B1 -input: const unsigned long delta_from_bytes Number of from_bytes used. -input: const unsigned long delta_to_bytes Number of to_bytes used. -input: const char *from_data The data to convert from. -output: char *to_data The resulting data. -output: int *error_return Error return. - - Recognized data types: - Machine representations - Type Notation IEEE_BIG IEEE_LITTLE Cray - 32 64 32 64 - No data MT - Integer 32 I4 I4 I4 I4 I4 I8 - Integer 64 I8 -- I8 -- I8 I8 - Unsigned 32 U4 I4 I4 I4 I4 I8 - Unsigned 64 U8 -- I8 -- I8 I8 - Real 32 R4 R4 R4 R4 R4 R8 - Real 64 R8 R8 R8 R8 R8 R8 - Complex 64 X4 R4R4 R4R4 R4R4 R4R4 R8R8 - Complex 128 X8 R8R8 R8R8 R8R8 R8R8 R8R8 - Character (unsigned byte) C1 C1 C1 C1 C1 C1 - Byte (unsigned byte) B1 C1 C1 C1 C1 C1 - -Machine Numeric Formats: -***IEEE_BIG (SGI-Iris Assembly Language Programmer's Guide, pages 1-2, 6-3) -I4: Byte0 Byte1 Byte2 Byte3 - MSB---------------------LSB -R4: Byte0 Byte1 Byte2 Byte3 - Bits: sign-bit, 8-bit exponent, 23-bit mantissa - The sign of the exponent is: 1=positive, 0=negative (NOT 2's complement) - The interpreation of the floating-point number is: - >>> 2.mantissia(fraction) X 2^exponent. <<< - -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, 11-bit exponent, 52-bit mantissa - -***Cray (Cray CFT77 Reference Manual, pages G-1 G-2) -I8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - MSB-----------------------------------------------------LSB -R8: Byte0 Byte1 Byte2 Byte 3 Byte 4 Byte5 Byte6 Byte7 - Bits: sign-bit, exponent-sign, 14-bit exponent, 48-bit mantissa -Note: Exponent sign: 1 in this bits indicates a positive exponent sign, - thus bit 62 is the inverse of bit 61 (the sign in the exponent). - The exception to this is a zero, in which all 64 bits are zero! - The interpreation of the floating-point number is: - >>> .mantissia(fraction) X 2^exponent. <<< - The mantissia is left justified (the leftmost bit is a 1). - This MUST be done! - -*** - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NULL_POINTER -***********************************************************************/ -void ADFI_little_endian_to_cray( - const char from_format, - const char from_os_size, - const char to_format, - const char to_os_size, - const char data_type[2], - const unsigned long delta_from_bytes, - const unsigned long delta_to_bytes, - const unsigned char *from_data, - unsigned char *to_data, - int *error_return ) -{ -int i, exp ; - -if( (from_data == NULL) || (to_data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( (delta_from_bytes == 0) || (delta_to_bytes == 0) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (from_format == 'N') || (to_format == 'N') ) { - *error_return = CANNOT_CONVERT_NATIVE_FORMAT ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -switch( EVAL_2_BYTES( data_type[0], data_type[1] ) ) { - - case EVAL_2_BYTES( 'M', 'T' ): - *error_return = NO_DATA ; - return ; - - case EVAL_2_BYTES( 'C', '1' ): - case EVAL_2_BYTES( 'B', '1' ): - to_data[0] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'I', '4' ): - if( (from_data[3] & 0x80) == 0x80 ) { /* Negative number */ - to_data[0] = 0xff ; - to_data[1] = 0xff ; - to_data[2] = 0xff ; - to_data[3] = 0xff ; - } /* end if */ - else { - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - } /* end else */ - to_data[4] = from_data[3] ; - to_data[5] = from_data[2] ; - to_data[6] = from_data[1] ; - to_data[7] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'U', '4' ): - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - to_data[4] = from_data[3] ; - to_data[5] = from_data[2] ; - to_data[6] = from_data[1] ; - to_data[7] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'I', '8' ): - if( (from_data[3] & 0x80) == 0x80 ) { /* Negative number */ - to_data[0] = 0xff ; - to_data[1] = 0xff ; - to_data[2] = 0xff ; - to_data[3] = 0xff ; - } /* end if */ - else { - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - } /* end else */ - for( i=0; i<(int)delta_from_bytes; i++ ) - to_data[8-delta_from_bytes+i] = from_data[delta_from_bytes-1-i] ; - break ; - - case EVAL_2_BYTES( 'U', '8' ): - to_data[0] = 0x00 ; - to_data[1] = 0x00 ; - to_data[2] = 0x00 ; - to_data[3] = 0x00 ; - for( i=0; i<(int)delta_from_bytes; i++ ) - to_data[8-delta_from_bytes+i] = from_data[delta_from_bytes-1-i] ; - break ; - - case EVAL_2_BYTES( 'R', '4' ): - for( i=0; i<8; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[3] == 0x00) && (from_data[2] == 0x00) && - (from_data[1] == 0x00) && (from_data[0] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[0] = from_data[3] & 0x80 ; - - /** Convert the exponent **/ - /** 8 bits to 14 bits. Sign extent from 8 to 14 **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = (from_data[3] & 0x3f) << 1 ; - if( (from_data[2] & 0x80) == 0x80 ) - exp += 1 ; - if( (from_data[3] & 0x40) == 0x00 ) /* set sign */ - exp -= 128 ; - exp += 2 ; - - to_data[1] = exp & 0xff ; - if( exp < 0 ) - to_data[0] |= 0x3f ; /* exponent sign 0, sign extend exponent */ - else - to_data[0] |= 0x40 ; /* exponent sign 1 */ - - /** Convert the mantissia **/ - /** 23 bits to 48 bits. Left shift 25 bits, zero fill **/ - to_data[2] = from_data[2] | 0x80 ; - to_data[3] = from_data[1] ; - to_data[4] = from_data[0] ; - break ; - - case EVAL_2_BYTES( 'R', '8' ): - for( i=0; i<8; i++ ) - to_data[i] = 0x00 ; - - /** Check for zero: a special case on the Cray (exponent sign) **/ - if( (from_data[7] == 0x00) && (from_data[6] == 0x00) && - (from_data[5] == 0x00) && (from_data[4] == 0x00) ) - break ; - - /** Convert the sign **/ - to_data[0] = from_data[7] & 0x80 ; - - /** Convert the exponent **/ - /** 11 bits to 14 bits. Sign extent from 11 to 14 **/ - /** Cray exponent is 2 greater than the Iris **/ - exp = ((from_data[7] & 0x3f) << 4) + ((from_data[6]>>4)&0x0f) ; - - if( (from_data[7] & 0x40) == 0x00 ) /* set sign */ - exp -= 1024 ; - exp += 2 ; - - to_data[1] = (unsigned int)(exp & 0xff) ; - to_data[0] |= ((exp>>8) & 0x03) ; - if( exp < 0 ) - to_data[0] |= 0x3c ; /* exponent sign 0, sign extend exponent */ - else - to_data[0] |= 0x40 ; /* exponent sign 1 */ - - /** Convert the mantissia **/ - /** 52 bits to 48 bits. Use 48, drop last 4 bits **/ - to_data[2] = 0x80 | ((from_data[6]<<3)&0x78) | - ((from_data[5]>>5)&0x07) ; - for( i=3; i<8; i++ ) - to_data[i] = ((from_data[7-i+1]<<3)&0xF8) | - ((from_data[7-i]>>5)&0x07) ; -#ifdef PRINT_STUFF -printf("from:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", from_data[i] ) ; -printf("to:" ) ; -for( i=0; i<8; i++ ) - printf("%02x ", to_data[i] ) ; -printf("\n" ) ; -#endif - break ; - - case EVAL_2_BYTES( 'X', '4' ): - ADFI_little_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_little_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R4", delta_from_bytes, - delta_to_bytes, &from_data[4], &to_data[8], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - case EVAL_2_BYTES( 'X', '8' ): - ADFI_little_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, from_data, to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - ADFI_little_endian_to_cray( from_format, from_os_size, - to_format, to_os_size, "R8", delta_from_bytes, - delta_to_bytes, &from_data[8], &to_data[8], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - break ; - - default: - *error_return = INVALID_DATA_TYPE ; - return ; - } /* end switch */ -} /* end of ADFI_little_endian_to_cray */ -/* end of file ADFI_little_endian_to_cray.c */ -/* file ADFI_open_file.c */ -/*********************************************************************** -ADFI open file: - - Track the files used by index. - Also track which files are within a given system so a close for - the system can close all related files. - -input: const char *file The filename to open. -input: const char *status The status in which to open the file. - Allowable values are: - READ_ONLY - File must exist. Writing NOT allowed. - OLD - File must exist. Reading and writing allowed. - NEW - File must not exist. - SCRATCH - New file. Filename is ignored. - UNKNOWN - OLD if file exists, else NEW is used. -input: const int top_file_index -1 if this is the top file. -output: unsigned int *file_index Returned index of the file. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -TOO_MANY_ADF_FILES_OPENED -ADF_FILE_STATUS_NOT_RECOGNIZED -FILE_OPEN_ERROR -***********************************************************************/ -void ADFI_open_file( - const char *file, - const char *status, - const int top_file_index, - unsigned int *file_index, - int *error_return ) -{ -int index ; -FILE *f_ret ; - -if( (status == NULL) || - ((file == NULL) && (ADFI_stridx_c( status, "SCRATCH" ) != 0) ) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_index == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -/* Initialize the priority satck if it has not been done */ -if (STACK_INIT==-1) ADFI_stack_control(0,0,0,INIT_STK,0,0,NULL); - -for( index=0; index= MAXIMUM_FILES ) { - *error_return = TOO_MANY_ADF_FILES_OPENED ; - return ; - } /* end if */ - -ADF_file_format[index] = UNDEFINED_FORMAT ; -ADF_file_os_size[index] = UNDEFINED_FORMAT ; - -/*** - READ_ONLY - File must exist. Writing NOT allowed. - OLD - File must exist. Reading and writing allowed. - NEW - File must not exist. - SCRATCH - New file. Filename is ignored. - UNKNOWN - OLD if file exists, else NEW is used. -***/ -#ifdef _WIN32 - _fmode = O_BINARY ; -#endif -if( ADFI_stridx_c( status, "READ_ONLY" ) == 0 ) { - f_ret = fopen( file, "r" ) ; /** Open for reading **/ - } /* end if */ -else if( ADFI_stridx_c( status, "OLD" ) == 0 ) { - f_ret = fopen( file, "r+" ) ; /** Open for both reading & writing **/ - } /* end else if */ -else if( ADFI_stridx_c( status, "NEW" ) == 0 ) { - f_ret = fopen( file, "w+" ) ; /** open new file, or truncate old file */ - } /* end else if */ -else if( ADFI_stridx_c( status, "SCRATCH" ) == 0 ) { - f_ret = tmpfile(); - } /* end else if */ -else if( ADFI_stridx_c( status, "UNKNOWN" ) == 0 ) { - f_ret = fopen( file, "a+" ) ; /** open new, or use existing file **/ - } /* end else if */ -else { - *error_return = ADF_FILE_STATUS_NOT_RECOGNIZED ; - goto Error_Exit ; - } /* end else */ - -if( f_ret == NULL ) { - *error_return = FILE_OPEN_ERROR ; - goto Error_Exit ; - } /* end if */ - -file_in_use[ index ] = 1 ; -first_file_in_system[ index ] = top_file_index ; -ADF_file[ index ] = f_ret ; -file_version_update[ index ][ 0 ] = '\0' ; -*file_index = index ; -sprintf( file_open_mode[index], "%s", status ) ; -if( ADFI_stridx_c( status, "SCRATCH" ) == 0 ) { - names_of_files[index][0] = '\0' ; - } /* end if */ -else { - sprintf( names_of_files[index], "%s", file ) ; - } /* end else */ -return ; - -Error_Exit: - /** Clear this file's entry **/ -if( ADF_file[ index ] != 0 ) { - if( fclose( ADF_file[ index ] ) != 0 ) - *error_return = FILE_CLOSE_ERROR ; - } /* end if */ -file_in_use[ index ] = 0 ; -first_file_in_system[ index ] = -1 ; -ADF_file[ index ] = NULL ; -file_version_update[ index ][ 0 ] = '\0' ; - -} /* end of ADFI_open_file */ -/* end of file ADFI_open_file.c */ -/* file ADFI_read_chunk_length.c */ -/*********************************************************************** -ADFI read chunk length: - Read the header of the chunk. If it is a variable sized - chunk, then the first 2 things in is are: - Tag, and pointer to end_of_chunk-tag - If NOT variable, then determine what type of chunk it is - and return a pointer to the end_of_chunk-tag: - - If the incomming pointers are 0 0, then we are looking - at the file header. - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -output: char tag[TAG_SIZE] The tag from the chunk. -output: struct DISK_POINTER *end_of_chunk_tag End of chunk. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ - -void ADFI_read_chunk_length( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - char tag[TAG_SIZE+1], - struct DISK_POINTER *end_of_chunk_tag, - int *error_return ) -{ -char info[ TAG_SIZE + DISK_POINTER_SIZE ] ; -struct DISK_POINTER current_block_offset ; -unsigned long count ; - -if( (block_offset == NULL) || (end_of_chunk_tag == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( tag == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -end_of_chunk_tag->block = 0 ; -end_of_chunk_tag->offset = 0 ; - - /** File Header **/ -if( (block_offset->block == 0) && (block_offset->offset == 0) ) { - - /** point to end-tag **/ - end_of_chunk_tag->offset = FILE_HEADER_SIZE - TAG_SIZE ; - tag[0] = file_header_tags[0][0] ; - tag[1] = file_header_tags[0][1] ; - tag[2] = file_header_tags[0][2] ; - tag[3] = file_header_tags[0][3] ; - } /* end if */ - - /** Free-Chunk Table **/ -else if( (block_offset->block == 0) && - (block_offset->offset == FREE_CHUNKS_OFFSET) ) { - - /** point to end-tag **/ - end_of_chunk_tag->offset = - (FREE_CHUNKS_OFFSET + FREE_CHUNK_TABLE_SIZE) - TAG_SIZE ; - tag[0] = free_chunk_table_start_tag[0] ; - tag[1] = free_chunk_table_start_tag[1] ; - tag[2] = free_chunk_table_start_tag[2] ; - tag[3] = free_chunk_table_start_tag[3] ; - } /* end if */ -else { - - /** Check for 'z's in the file. This is free-data, too small - to include tags and pointers - **/ - count = 0 ; - ADFI_read_file( file_index, block_offset->block, block_offset->offset, - 1, info, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - if( info[0] == 'z' ) { - current_block_offset.block = block_offset->block ; - current_block_offset.offset = block_offset->offset ; - while( info[0] == 'z' ) { - count++ ; - current_block_offset.offset++ ; - ADFI_adjust_disk_pointer( ¤t_block_offset, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - info[0] = '\0' ; - ADFI_read_file( file_index, current_block_offset.block, - current_block_offset.offset, 1, info, error_return ) ; - if( (*error_return == FSEEK_ERROR) || (*error_return == FREAD_ERROR)){ - break ; - } /* end if */ - if( *error_return != NO_ERROR ) - return ; - } /* end while */ - end_of_chunk_tag->block = block_offset->block ; - end_of_chunk_tag->offset = block_offset->offset + count - TAG_SIZE ; - ADFI_adjust_disk_pointer( end_of_chunk_tag, error_return ) ; - tag[0] = tag[1] = tag[2] = tag[3] = 'z' ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - else { - /** Read TAG and disk_pointer **/ - ADFI_read_file( file_index, block_offset->block, block_offset->offset, - TAG_SIZE + DISK_POINTER_SIZE, info, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /* Copy the tag **/ - tag[0] = info[0] ; - tag[1] = info[1] ; - tag[2] = info[2] ; - tag[3] = info[3] ; - tag[4] = '\0' ; - - /** Check for known tags **/ - if( ADFI_stridx_c( tag, node_start_tag ) == 0 ) { /** Node **/ - end_of_chunk_tag->block = block_offset->block ; - end_of_chunk_tag->offset = block_offset->offset + - NODE_HEADER_SIZE - TAG_SIZE ; - ADFI_adjust_disk_pointer( end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - else { - - /** Convert pointers into numeric form **/ - ADFI_disk_pointer_from_ASCII_Hex( &info[TAG_SIZE], - &info[DISK_POINTER_SIZE], end_of_chunk_tag, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - } /* end else */ - } /* end else */ - -} /* end of ADFI_read_chunk_length */ -/* end of file ADFI_read_chunk_length.c */ -/* file ADFI_read_data_chunk.c */ -/*********************************************************************** -ADFI read data chunk: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const char *data_type The defined datatype. -input: const int data_size Size of data entity in bytes. -input: const long chunk_bytes Number of bytes in data chunk. -input: const long start_offset Starting offset into the data chunk -input: const long total_bytes Number of bytes to read in data chunk. -output: char *data Pointer to the resulting data. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_DISK_TAG_ERROR -REQUESTED_DATA_TOO_LONG -***********************************************************************/ -void ADFI_read_data_chunk( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct TOKENIZED_DATA_TYPE *tokenized_data_type, - const int data_size, - const long chunk_bytes, - const long start_offset, - const long total_bytes, - char *data, - int *error_return ) -{ -int format_compare ; -char tag[TAG_SIZE + 1] ; -struct DISK_POINTER data_start, end_of_chunk_tag ; -long chunk_total_bytes ; - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( (tokenized_data_type == NULL) || (data == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -if( total_bytes+start_offset > chunk_bytes ) { - *error_return = REQUESTED_DATA_TOO_LONG ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Get tag and chunk length **/ -ADFI_read_chunk_length( file_index, block_offset, tag, &end_of_chunk_tag, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; -tag[TAG_SIZE] = '\0' ; - - /** Check start-of-chunk tag **/ -if( ADFI_stridx_c( tag, data_chunk_start_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - - /** Check end-of-chunk tag **/ -ADFI_read_file( file_index, end_of_chunk_tag.block, end_of_chunk_tag.offset, - TAG_SIZE, tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -tag[TAG_SIZE] = '\0' ; - -if( ADFI_stridx_c( tag, data_chunk_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - - /** Point to the start of the data **/ -data_start.block = block_offset->block ; -data_start.offset = block_offset->offset + start_offset + - DISK_POINTER_SIZE + TAG_SIZE ; -ADFI_adjust_disk_pointer( &data_start, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** calculate the total number of data bytes **/ -chunk_total_bytes = end_of_chunk_tag.offset - data_start.offset + start_offset - + (end_of_chunk_tag.block - data_start.block) * DISK_BLOCK_SIZE ; -if( chunk_bytes > chunk_total_bytes ) { - *error_return = REQUESTED_DATA_TOO_LONG ; - return ; - } /* end if */ -else { - if( chunk_bytes < chunk_total_bytes ) - *error_return = REQUESTED_DATA_TOO_LONG ; - - /** check for need of data translation **/ - ADFI_file_and_machine_compare( file_index, tokenized_data_type, - &format_compare, error_return ); - if( *error_return != NO_ERROR ) - return ; - if( format_compare == 1 ) { - /** Read the data off of disk **/ - ADFI_read_file( file_index, data_start.block, data_start.offset, - total_bytes, data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - else { - ADFI_read_data_translated( file_index, data_start.block, - data_start.offset, tokenized_data_type, data_size, - total_bytes, data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - } /* end else */ - -} /* end of ADFI_read_data_chunk */ -/* end of file ADFI_read_data_chunk.c */ -/* file ADFI_read_data_chunk_table.c */ -/*********************************************************************** -ADFI read data chunk table: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -output: struct DATA_CHUNK_TABLE_ENTRY data_chunk_table[] Array of DC entries. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_read_data_chunk_table( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct DATA_CHUNK_TABLE_ENTRY data_chunk_table[], - int *error_return ) -{ -char tag[ TAG_SIZE + 1 ] ; -struct DISK_POINTER end_of_chunk_tag, tmp_block_offset ; -unsigned int i, number_of_bytes_to_read ; - -if( (block_offset == NULL) || (data_chunk_table == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - /** Get the tag and the length **/ -ADFI_read_chunk_length( file_index, block_offset, tag, - &end_of_chunk_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -tag[TAG_SIZE] = '\0' ; - - /** Compare the start tag **/ -if( ADFI_stridx_c( tag, data_chunk_table_start_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - -number_of_bytes_to_read = - (end_of_chunk_tag.block - block_offset->block) * DISK_BLOCK_SIZE + - (end_of_chunk_tag.offset - block_offset->offset) - - (TAG_SIZE + DISK_POINTER_SIZE) ; - - /** Read the data from disk **/ -tmp_block_offset.block = block_offset->block ; -tmp_block_offset.offset = block_offset->offset + TAG_SIZE ; - -for( i=0; i number_of_data_elements ) { - chunk_size -= ( number_of_elements_read - number_of_data_elements ) ; - delta_from_bytes = chunk_size * data_size ; - delta_to_bytes = chunk_size * machine_size ; - } - ADFI_read_file( file_index, disk_pointer.block, disk_pointer.offset, - delta_from_bytes, (char *)from_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - ADFI_convert_number_format( - ADF_file_format[file_index], /* from format */ - ADF_file_os_size[file_index], /* from os size */ - ADF_this_machine_format, /* to format */ - ADF_this_machine_os_size, /* to os size */ - FROM_FILE_FORMAT, - tokenized_data_type, chunk_size, from_data, - to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - to_data += delta_to_bytes ; - disk_pointer.offset += delta_from_bytes ; - if ( disk_pointer.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &disk_pointer, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - } /* end while */ - -} /* end of ADFI_read_data_translated */ -/* end of file ADFI_read_data_translated.c */ -/* file ADFI_read_disk_block.c */ -/*********************************************************************** -ADFI read disk block: - - Possible errors: -NO_ERROR -***********************************************************************/ -void ADFI_read_disk_block() -{ -printf("Subroutine ADFI_read_disk_block is not yet implemented...\n" ) ; -} /* end of ADFI_read_disk_block */ -/* end of file ADFI_read_disk_block.c */ -/* file ADFI_read_disk_pointer_from_disk.c */ -/*********************************************************************** -ADFI read disk pointer from disk: - Given a pointer to a disk pointer, read it from disk and convert - it into numeric form. - -input: const unsigned int file_index File to read from. -input: const unsigned long file_block Block within the file. -input: const unsigned long block_offset Offset within the block. -output: struct DISK_POINTER *block_and_offset Resulting disk pointer. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_read_disk_pointer_from_disk( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - struct DISK_POINTER *block_and_offset, - int *error_return ) -{ -char disk_block_offset[DISK_POINTER_SIZE] ; - -if( block_and_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( block_offset > DISK_BLOCK_SIZE ) { - *error_return = BLOCK_OFFSET_OUT_OF_RANGE ; - return ; - } /* end if */ - - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check the stack for block/offset **/ -if ( ADFI_stack_control(file_index, file_block, block_offset, - GET_STK, DISK_PTR_STK, - DISK_POINTER_SIZE, disk_block_offset ) != NO_ERROR ) { - - /** Get the block/offset from disk **/ - ADFI_read_file( file_index, file_block, block_offset, - DISK_POINTER_SIZE, disk_block_offset, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Set the block/offset onto the stack **/ - ADFI_stack_control(file_index, file_block, block_offset, - SET_STK, DISK_PTR_STK, - DISK_POINTER_SIZE, disk_block_offset ); -} /* end if */ - - /** Convert into numeric form **/ -ADFI_disk_pointer_from_ASCII_Hex( &disk_block_offset[0], &disk_block_offset[8], - block_and_offset, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -} /* end of ADFI_read_disk_pointer_from_disk */ -/* end of file ADFI_read_disk_pointer_from_disk.c */ -/* file ADFI_read_file.c */ -/*********************************************************************** -ADFI read file: - Read a number of bytes from an open ADF file from a given - file, block, and offset. Buffering is done in an attempt to - improve performance of repeatedly reading small pieces of - contiguous data. Note: read buffering also affects the - write function, i.e, all writes must reset the read buffer. - -input: const unsigned int file_index File to read from. -input: const unsigned long file_block Block within the file. -input: const unsigned long block_offset Offset within the block. -input: const unsigned int data_length Length of the data to read. -input: char *data Address of the data. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -FREAD_ERROR -***********************************************************************/ -void ADFI_read_file( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - const unsigned int data_length, - char *data, - int *error_return ) -{ -int iret ; - - -if( data == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** No need to buffer large pieces of data or to take special - measures to cross block boundaries **/ - -if( data_length + block_offset > DISK_BLOCK_SIZE ) { - - /** Position the file **/ - ADFI_fseek_file( file_index, file_block, block_offset, error_return ) ; - if( *error_return != NO_ERROR ) { - return ; - } /* end if */ - - /** Read the data from disk **/ - iret = fread( data, 1, data_length, ADF_file[ file_index ] ) ; - if( iret != (int)data_length ) { - *error_return = FREAD_ERROR ; - return ; - } /* end if */ - - return; -} /* end if */ - - /** For smaller pieces of data, read a block at a time. This will improve - performance if neighboring data is requested a small piece at a time - (strided reads, file overhead). - - Some assumptions apply to the block size. With some experimenting, - 1K blocks do not offer much improvement. 4K blocks (4096 bytes) - do improve performance remarkably. This is due to the fact that the - file structure is based of 4K blocks with offsets. - **/ - -if( num_in_rd_block < DISK_BLOCK_SIZE || /*- buffer is not full -*/ - (long int) file_block != last_rd_block || /*- a different block -*/ - (long int) file_index != last_rd_file ) { /*- entirely different file -*/ - - /** buffer is not current, re-read **/ - - if ( (long int) file_block == last_wr_block && (long int) file_index == last_wr_file ) { - - /* Copy data from write buffer */ - memcpy( rd_block_buffer, wr_block_buffer, DISK_BLOCK_SIZE ); - iret = DISK_BLOCK_SIZE; - } - else { - - /** Position the file **/ - ADFI_fseek_file( file_index, file_block, 0, error_return ) ; - if( *error_return != NO_ERROR ) { - return ; - } /* end if */ - - /** Read the data from disk **/ - iret = fread( rd_block_buffer, 1, DISK_BLOCK_SIZE, ADF_file[ file_index ] ) ; - if( iret == EOF || iret == 0 ) { - *error_return = FREAD_ERROR ; - return ; - } /* end if */ - - } /* end if */ - - /** Remember buffer information **/ - last_rd_block = file_block ; - last_rd_file = file_index ; - num_in_rd_block = iret ; - -} /* end if */ - - /*read from buffer*/ -memcpy( data, &rd_block_buffer[block_offset], data_length ); - -} /* end of ADFI_read_file */ -/* end of file ADFI_read_file.c */ -/* file ADFI_read_file_header.c */ -/*********************************************************************** -ADFI read file header: - -input: const unsigned int file_index The file index. -output: struct FILE_HEADER *file_header Pointer to a file-header struct. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_read_file_header( - const unsigned int file_index, - struct FILE_HEADER *file_header, - int *error_return ) -{ -char disk_header[ FILE_HEADER_SIZE ] ; - -if( file_header == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check the stack for header **/ -if ( ADFI_stack_control(file_index, 0, 0, GET_STK, FILE_STK, - FILE_HEADER_SIZE, disk_header ) != NO_ERROR ) { - - /** Read in the header into memory **/ - ADFI_read_file( file_index, 0, 0, FILE_HEADER_SIZE, disk_header, - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Check memory tags for proper data **/ - if( strncmp( &disk_header[32], file_header_tags[0], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - - if( strncmp( &disk_header[64], file_header_tags[1], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - - if( strncmp( &disk_header[96], file_header_tags[2], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - - if( strncmp( &disk_header[102], file_header_tags[3], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - - if( strncmp( &disk_header[130], file_header_tags[4], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - - if( strncmp( &disk_header[182], file_header_tags[5], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - - /** Set the header onto the stack **/ - ADFI_stack_control(file_index, 0, 0, SET_STK, FILE_STK, - FILE_HEADER_SIZE, disk_header ); -} /* end if */ - -/** OK the memory tags look good, let's convert disk-formatted header - into memory **/ -strncpy( (char *)file_header->what, &disk_header[ 0], 32 ) ; -strncpy( (char *)file_header->tag0, &disk_header[ 32], TAG_SIZE ) ; -strncpy( (char *)file_header->creation_date, &disk_header[ 36], DATE_TIME_SIZE); -strncpy( (char *)file_header->tag1, &disk_header[ 64], TAG_SIZE ) ; -strncpy( (char *)file_header->modification_date, &disk_header[ 68], - DATE_TIME_SIZE ) ; -strncpy( (char *)file_header->tag2, &disk_header[ 96], TAG_SIZE ) ; -file_header->numeric_format = disk_header[100] ; -file_header->os_size = disk_header[101] ; -strncpy( (char *)file_header->tag3, &disk_header[102], TAG_SIZE ) ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[106], - &file_header->sizeof_char, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[108], - &file_header->sizeof_short, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[110], - &file_header->sizeof_int, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[112], - &file_header->sizeof_long, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[114], - &file_header->sizeof_float, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[116], - &file_header->sizeof_double, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[118], - &file_header->sizeof_char_p, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[120], - &file_header->sizeof_short_p, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[122], - &file_header->sizeof_int_p, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[124], - &file_header->sizeof_long_p, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[126], - &file_header->sizeof_float_p, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 255, 2, &disk_header[128], - &file_header->sizeof_double_p, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -strncpy( file_header->tag4, &disk_header[130], TAG_SIZE ) ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_header[134], &disk_header[142], - &file_header->root_node, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_header[146], &disk_header[154], - &file_header->end_of_file, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_header[158], &disk_header[166], - &file_header->free_chunks, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_header[170], &disk_header[178], - &file_header->extra, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -strncpy( file_header->tag5, &disk_header[182], TAG_SIZE ) ; - - - /** Check memory tags for proper data **/ -if( strncmp( file_header->tag0, file_header_tags[0], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag1, file_header_tags[1], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag2, file_header_tags[2], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag3, file_header_tags[3], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag4, file_header_tags[4], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag5, file_header_tags[5], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -} /* end of ADFI_read_file_header */ -/* end of file ADFI_read_file_header.c */ -/* file ADFI_read_free_chunk.c */ -/*********************************************************************** -ADFI read free chunk: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -output: struct DISK_POINTER *end_of_chunk_tag End of free chunk tag. -output: struct DISK_POINTER *next_chunk Next free chunk in list. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_DISK_TAG_ERROR -***********************************************************************/ -void ADFI_read_free_chunk( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct FREE_CHUNK *free_chunk, - int *error_return ) -{ -char tag[TAG_SIZE + 1] ; -struct DISK_POINTER chunk_block_offset ; - -if( (block_offset == NULL) || (free_chunk == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Get the tag and the length **/ -ADFI_read_chunk_length( file_index, block_offset, tag, - &(free_chunk->end_of_chunk_tag), error_return ) ; -if( *error_return != NO_ERROR ) - return ; -tag[TAG_SIZE] = '\0' ; - - /** Compare the start tag **/ -if( ADFI_stridx_c( tag, free_chunk_start_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - - /** Set block offset to the start of the chunk **/ - -chunk_block_offset = *block_offset ; -chunk_block_offset.offset += TAG_SIZE + DISK_POINTER_SIZE ; -ADFI_adjust_disk_pointer( &chunk_block_offset, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Read the data from disk **/ - -ADFI_read_disk_pointer_from_disk( file_index, chunk_block_offset.block, - chunk_block_offset.offset, &(free_chunk->next_chunk), error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_read_file( file_index, free_chunk->end_of_chunk_tag.block, - free_chunk->end_of_chunk_tag.offset, TAG_SIZE, tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Compare the end tag **/ -if( ADFI_stridx_c( tag, free_chunk_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - -strncpy( free_chunk->start_tag, free_chunk_start_tag, 4 ) ; -strncpy( free_chunk->end_tag, free_chunk_end_tag, 4 ) ; -} /* end of ADFI_read_free_chunk */ -/* end of file ADFI_read_free_chunk.c */ -/* file ADFI_read_free_chunk_table.c */ -/*********************************************************************** -ADFI read free chunk table: - -input: const unsigned int file_index The file index. -output: struct FREE_CHUNK_TABLE *free_chunk_table Pointer to table. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_DISK_TAG_ERROR -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_read_free_chunk_table( - const unsigned int file_index, - struct FREE_CHUNK_TABLE *free_chunk_table, - int *error_return ) -{ -char disk_free_chunk_data[ FREE_CHUNK_TABLE_SIZE ] ; - -if( free_chunk_table == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check the stack for free chunk **/ -if ( ADFI_stack_control(file_index, FREE_CHUNKS_BLOCK, FREE_CHUNKS_OFFSET, - GET_STK, FREE_CHUNK_STK, FREE_CHUNK_TABLE_SIZE, - disk_free_chunk_data ) != NO_ERROR ) { - - /** Read the free-chunk table off of disk **/ - ADFI_read_file( file_index, FREE_CHUNKS_BLOCK, FREE_CHUNKS_OFFSET, - FREE_CHUNK_TABLE_SIZE, disk_free_chunk_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Check disk tags **/ - if( ADFI_stridx_c( &disk_free_chunk_data[0], free_chunk_table_start_tag ) != - 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end of */ - - if( ADFI_stridx_c( &disk_free_chunk_data[FREE_CHUNK_TABLE_SIZE - TAG_SIZE], - free_chunk_table_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end of */ - - /** Set the free chunk onto the stack **/ - ADFI_stack_control(file_index, FREE_CHUNKS_BLOCK, FREE_CHUNKS_OFFSET, - SET_STK, FREE_CHUNK_STK, FREE_CHUNK_TABLE_SIZE, - disk_free_chunk_data ); -} /* end if */ - - /** Convert into memory **/ -strncpy( (char *)free_chunk_table->start_tag, &disk_free_chunk_data[ 0], - TAG_SIZE ) ; -strncpy( (char *)free_chunk_table->end_tag, - &disk_free_chunk_data[ FREE_CHUNK_TABLE_SIZE - TAG_SIZE ], TAG_SIZE ) ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_free_chunk_data[ TAG_SIZE], - &disk_free_chunk_data[DISK_POINTER_SIZE], - &free_chunk_table->small_first_block, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_free_chunk_data[16], - &disk_free_chunk_data[24], &free_chunk_table->small_last_block, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_free_chunk_data[28], - &disk_free_chunk_data[36], &free_chunk_table->medium_first_block, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_free_chunk_data[40], - &disk_free_chunk_data[48], &free_chunk_table->medium_last_block, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_free_chunk_data[52], - &disk_free_chunk_data[60], &free_chunk_table->large_first_block, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_free_chunk_data[64], - &disk_free_chunk_data[72], &free_chunk_table->large_last_block, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Check memory tags **/ -if( ADFI_stridx_c( free_chunk_table->start_tag, free_chunk_table_start_tag ) - != 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end of */ - -if( ADFI_stridx_c( free_chunk_table->end_tag, free_chunk_table_end_tag ) - != 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end of */ - -} /* end of ADFI_read_free_chunk_table */ -/* end of file ADFI_read_free_chunk_table.c */ -/* file ADFI_read_node_header.c */ -/*********************************************************************** -ADFI read node header: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -output: struct NODE_HEADER *node_header Pointer to node header. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_DISK_TAG_ERROR -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_read_node_header( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct NODE_HEADER *node_header, - int *error_return ) -{ -char disk_node_data[ NODE_HEADER_SIZE ] ; -int i ; - -if( (block_offset == NULL) || (node_header == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check the stack for header **/ -if ( ADFI_stack_control(file_index, block_offset->block, block_offset->offset, - GET_STK, NODE_STK, NODE_HEADER_SIZE, - disk_node_data ) != NO_ERROR ) { - - /** Get the node header from disk **/ - ADFI_read_file( file_index, block_offset->block, block_offset->offset, - NODE_HEADER_SIZE, disk_node_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Check disk tags **/ - if( ADFI_stridx_c( &disk_node_data[0], node_start_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end of */ - - if( ADFI_stridx_c( &disk_node_data[ NODE_HEADER_SIZE - TAG_SIZE ], - node_end_tag ) != 0 ) { - *error_return = ADF_DISK_TAG_ERROR ; - return ; - } /* end if */ - - /** Set the header onto the stack **/ - ADFI_stack_control(file_index, block_offset->block, block_offset->offset, - SET_STK, NODE_STK, NODE_HEADER_SIZE, disk_node_data ); -} /* end if */ - - /** Convert into memory **/ -strncpy( (char *)node_header->node_start_tag, &disk_node_data[ 0], TAG_SIZE ) ; -strncpy( (char *)node_header->node_end_tag, - &disk_node_data[ NODE_HEADER_SIZE - TAG_SIZE], TAG_SIZE ) ; - -strncpy( (char *)node_header->name, &disk_node_data[ TAG_SIZE], - ADF_NAME_LENGTH ) ; -strncpy( (char *)node_header->label, &disk_node_data[ 36], ADF_LABEL_LENGTH ) ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, MAXIMUM_32_BITS, 8, &disk_node_data[ 68], - &node_header->num_sub_nodes, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, MAXIMUM_32_BITS, 8, &disk_node_data[ 76], - &node_header->entries_for_sub_nodes, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_node_data[84], &disk_node_data[92], - &node_header->sub_node_table, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -strncpy( (char *)node_header->data_type, &disk_node_data[ 96], - ADF_DATA_TYPE_LENGTH ) ; - -ADFI_ASCII_Hex_2_unsigned_int( 0, 12, 2, &disk_node_data[128], - &node_header->number_of_dimensions, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -for( i=0; idimension_values[i], - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end for */ - -ADFI_ASCII_Hex_2_unsigned_int( 0, 65535, 4, &disk_node_data[226], - &node_header->number_of_data_chunks, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_from_ASCII_Hex( &disk_node_data[230], &disk_node_data[238], - &node_header->data_chunks, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Check memory tags **/ -if( ADFI_stridx_c( node_header->node_start_tag, node_start_tag ) != 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end of */ - -if( ADFI_stridx_c( node_header->node_end_tag, node_end_tag ) != 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end of */ - -} /* end of ADFI_read_node_header */ -/* end of file ADFI_read_node_header.c */ -/* file ADFI_read_sub_node_table.c */ -/*********************************************************************** -ADFI read sub node table: - - At this point, reading of the ENTIRE table is required. - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -output: struct SUB_NODE_TABLE_ENTRY sub_node_table[] Array of SN entries. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_read_sub_node_table( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - struct SUB_NODE_TABLE_ENTRY sub_node_table[], - int *error_return ) -{ -char tag[TAG_SIZE + 1] ; -struct DISK_POINTER end_of_chunk_tag, current_child ; -unsigned int number_of_children, i ; - -if( (block_offset == NULL) || (sub_node_table == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Get tag and length **/ -ADFI_read_chunk_length( file_index, block_offset, tag, - &end_of_chunk_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -tag[TAG_SIZE] = '\0' ; - - /** calculate the number of chuldren in the sub-node table **/ -number_of_children = ( - (end_of_chunk_tag.block - block_offset->block) * DISK_BLOCK_SIZE + - (end_of_chunk_tag.offset - block_offset->offset) ) / - (DISK_POINTER_SIZE + ADF_NAME_LENGTH) ; - -current_child.block = block_offset->block ; -current_child.offset = block_offset->offset + TAG_SIZE + DISK_POINTER_SIZE ; -ADFI_adjust_disk_pointer( ¤t_child, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Read and convert the variable-length table into memory **/ -for( i=0; iblock, block_offset->offset, - GET_STK, SUBNODE_STK, ADF_NAME_LENGTH + DISK_POINTER_SIZE, - sub_node_entry_disk_data ) != NO_ERROR ) { - - /** Read the entry from disk **/ - ADFI_read_file( file_index, block_offset->block, block_offset->offset, - ADF_NAME_LENGTH + DISK_POINTER_SIZE, sub_node_entry_disk_data, - error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - /** Set the subnode onto the stack **/ - ADFI_stack_control(file_index, block_offset->block, block_offset->offset, - SET_STK, SUBNODE_STK, ADF_NAME_LENGTH + DISK_POINTER_SIZE, - sub_node_entry_disk_data ); -} /* end if */ - - /** Copy the name **/ -strncpy( sub_node_table_entry->child_name, &sub_node_entry_disk_data[0], - ADF_NAME_LENGTH ) ; - - /** Convert the disk-pointer **/ -ADFI_disk_pointer_from_ASCII_Hex( &sub_node_entry_disk_data[ ADF_NAME_LENGTH ], - &sub_node_entry_disk_data[ ADF_NAME_LENGTH + 8 ], - &sub_node_table_entry->child_location, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -} /* end of ADFI_read_sub_node_table_entry */ -/* end of file ADFI_read_sub_node_table_entry.c */ -/* file ADFI_remember_file_format.c */ -/********************************************************************** -ADFI remember file format: - Track the file format used: - -input: const int file_index Index for the file. -input: const char numeric_format Format for the file. -input: const char os_size operating system size for the file. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -FILE_INDEX_OUT_OF_RANGE -**********************************************************************/ -void ADFI_remember_file_format( - const int file_index, - const char numeric_format, - const char os_size, - int *error_return ) -{ -if( (file_index < 0) || (file_index > MAXIMUM_FILES) ) { - *error_return = FILE_INDEX_OUT_OF_RANGE ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; -ADF_file_format[file_index] = numeric_format ; -ADF_file_os_size[file_index] = os_size ; -} -/* end of file ADFI_remember_file_format.c */ -/* file ADFI_remember_version_update.c */ -/*********************************************************************** -ADFI remember version update: - Stores the what-string (which contains the file version number) so - that it can be written after the first successful update. After the - file has been updated once, the remembered what-string is "forgotten". - -input: const int file_index File index to write to. -input: const char *what_string What string to remember (contains version) -output: int *error_return Error return. - - Possible errors: -FILE_INDEX_OUT_OF_RANGE -NULL_STRING_POINTER -STRING_LENGTH_ZERO -***********************************************************************/ -void ADFI_remember_version_update( - const int file_index, - const char *what_string, - int *error_return ) -{ - -*error_return = NO_ERROR ; - -if( (file_index < 0) || (file_index > MAXIMUM_FILES) ) { - *error_return = FILE_INDEX_OUT_OF_RANGE ; - return ; - } /* end if */ - -if( what_string == NULL ) { - *error_return = NULL_STRING_POINTER ; - return; - } /* end if */ - -if( what_string[0] == '\0' ) { - *error_return = STRING_LENGTH_ZERO ; - return; - } /* end if */ - -if( strlen( what_string ) > WHAT_STRING_SIZE ) { - *error_return = STRING_LENGTH_TOO_BIG ; - return ; - } /* end if */ - -strcpy( file_version_update[ file_index ], what_string ) ; - -} /* end of ADFI_remember_version_update */ -/* end of file ADFI_remember_version_update.c */ -/* file ADFI_set_blank_disk_pointer.c */ -/********************************************************************** -ADFI_set_blank_disk_pointer: - Set the block and offset to the defined "blank", or unused values. - -output: struct DISK_POINTER *block_offset Block & offset in the file. - - Possible errors: -None allowed -**********************************************************************/ -void ADFI_set_blank_disk_pointer( - struct DISK_POINTER *block_offset ) -{ -block_offset->block = BLANK_FILE_BLOCK ; -block_offset->offset = BLANK_BLOCK_OFFSET ; -} /* end of ADFI_set_blank_disk_pointer */ -/* end of file ADFI_set_blank_disk_pointer.c */ -/* file ADFI_stack_control.c */ -/*********************************************************************** -ADFI stack control: - -input: const unsigned int file_index The file index. -input: const unsigned long file_block Block within the file. -input: const unsigned long block_offset Offset within the block. -input: const int stack_mode Control mode: INIT, GET or SET -input; const int stack_type Type of stack entry to process: FILE, NODE, etc.. -input: const unsigned int data_length Length of the data to buffer. -input/output: char *stack_data The character string buffered, is input for - mode SET and output for mode GET. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -PRISTK_NOT_FOUND - Note: errors are only important for GET mode since you must then go ahead - and read the data fom the file. The stack is only meant to speed things - up, not stop the process !!! -***********************************************************************/ -int ADFI_stack_control( const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - const int stack_mode, - const int stack_type, - const unsigned long data_length, - char *stack_data ) -{ -int i; -int low_priority; -int insert_index; -int found; - -if( stack_data == NULL && (stack_mode == GET_STK || stack_mode == SET_STK) ) { - return NULL_STRING_POINTER ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 && stack_mode != INIT_STK ) { - return ADF_FILE_NOT_OPENED ; - } /* end if */ - -/* Process depending on the mode */ - - switch( stack_mode ) { - case INIT_STK: - case CLEAR_STK: - case CLEAR_STK_TYPE: - /* Clear all entries with current file_index and or type, - if file_index is 0 then clear all the entries!! */ - for (i=0; i 0 ) free(PRISTK[i].stack_data); - PRISTK[i].file_index = -1; - PRISTK[i].file_block = 0; - PRISTK[i].block_offset = 0; - PRISTK[i].stack_type = -1; - PRISTK[i].priority_level = -1; - } /* end for */ - if ( stack_mode == INIT_STK ) STACK_INIT = 1; - break ; - case GET_STK: - /* Try and find the entry in the current stack by matching the - file index, block and offset, if found copy data else if - not return with an error. */ - for (i=0; i= 0 ) { - /* Existing entry so lower its priority, if it is the lowest - then save its index for possible replacement. */ - if ( PRISTK[i].priority_level > low_priority ) { - low_priority = PRISTK[i].priority_level; - insert_index = i; - } /* end if */ - PRISTK[i].priority_level++; - } /* end else if */ - else if ( found == 'f' ) { - /* An empty entry set pointer for possible insertion */ - low_priority = MAX_STACK * MAX_STACK; - insert_index = i; - found = 'e'; - } /* end else if */ - } /* end for */ - /* If the item was already on the stack then we are done */ - if ( found == 't' ) return NO_ERROR; - /* Insert the data onto the stack at the index_insert location. */ - i = insert_index; - if ( PRISTK[i].priority_level > 0 ) free(PRISTK[i].stack_data); - PRISTK[i].stack_data = ( char * ) malloc(data_length*sizeof(char)); - if ( PRISTK[i].stack_data == NULL ) { - /* Error allocating memory buffer so clear stack and punt */ - PRISTK[i].file_index = -1; - PRISTK[i].file_block = 0; - PRISTK[i].block_offset = 0; - PRISTK[i].stack_type = -1; - PRISTK[i].priority_level = -1; - return NO_ERROR; - } /* end if */ - strncpy( PRISTK[i].stack_data, stack_data, data_length ); - PRISTK[i].file_index = file_index; - PRISTK[i].file_block = file_block; - PRISTK[i].block_offset = block_offset; - PRISTK[i].stack_type = stack_type; - PRISTK[i].priority_level = 1; - break ; - } /* end switch */ - - return NO_ERROR; - -} /* end of ADFI_stack_control */ -/* end of file ADFI_stack_control.c */ -/* file ADFI_stridx_c.c */ -/********************************************************************** -ADFI stridx c: - To find the location of a substring within a string. This - routine is case InSeNsItIvE!!! - - It is NOT assumed that the substring is already upper-case!!! - -input: const char *str The string to search in. -input: const char *substr The substring to search for. -output: int return-value The position in str where substr was found. - -1 if substr was not found. - - Possible errors: -none: Errors are not allowed. -***********************************************************************/ -int ADFI_stridx_c( - const char *str, - const char *substr ) -{ -int i, j, k ; - -if( str == NULL || substr == NULL || substr[0] == '\0' ) { - return -1 ; /* not found - nothing to check */ -} - -for( i=0; str[i] != '\0'; i++ ) { - for( j=i, k=0; TO_UPPER( str[j] ) == TO_UPPER( substr[k] ); j++ ) { - if( substr[++k] == '\0' ) - return i ; /* the substring was found */ - } /* end for */ - } /* end for */ -return -1 ; /* the substring was not found */ -} /* end of ADFI_stridx_c */ -/* end of file ADFI_stridx_c.c */ -/* file ADFI_string_2_C_string.c */ -/********************************************************************** -ADFI string to C string: - Create a C string of the maximum length (+1 for null) which is - null terminated and has no trailing blanks. - -input: const char *string Input string. -input: const int string_length Length of input string to use. -output: char *c_string Returned C string. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -**********************************************************************/ -void ADFI_string_2_C_string( - const char *string, - const int string_length, - char *c_string, - int *error_return ) -{ -int i, iend ; - -if( (string == NULL) || (c_string == NULL) ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Skip and trailing blanks **/ -for( iend=string_length-1; iend>=0; iend-- ) { - if( string[ iend ] != ' ' ) { - break ; - } /* end if */ - } /* end for */ - - /** Copy the non-trailing blank portion of the string **/ -for( i=0; i<=iend; i++ ) - c_string[i] = string[i] ; - - /** NULL terminate the C string **/ -c_string[i] = '\0' ; -} /* end of ADFI_string_2_C_string */ -/* end of file ADFI_string_2_C_string.c */ -/* file ADFI_unsigned_int_2_ASCII_Hex.c */ -/*********************************************************************** -ADFI unsigned int to ASCII hex: - Convert an unsigned int to an ASCII-Hex string. - -input: const unsigned int number The integer number to convert to ASCII. -input: const unsigned int minimum The expected minimum number in the int. -input: const unsigned int maximum The expected maximum number in the int. -input: const unsigned int string_length The length of the returned string. -output: char string[] The string. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -NUMBER_LESS_THAN_MINIMUM -NUMBER_GREATER_THAN_MAXIMUM -STRING_LENGTH_ZERO -STRING_LENGTH_TOO_BIG -***********************************************************************/ -void ADFI_unsigned_int_2_ASCII_Hex( - const unsigned int number, - const unsigned int minimum, - const unsigned int maximum, - const unsigned int string_length, - char string[], - int *error_return ) -{ -unsigned int i, /** Index from 0 to string_length - 1 **/ - ir, /** Index from string_length - 1 to 0 **/ - j, /** Temoprary integer variable **/ - num ; /** Working value of ther number **/ - -if( string == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( number < minimum ) { - *error_return = NUMBER_LESS_THAN_MINIMUM ; - return ; - } /* end if */ - -if( number > maximum ) { - *error_return = NUMBER_GREATER_THAN_MAXIMUM ; - return ; - } /* end if */ - -if( string_length == 0 ) { - *error_return = STRING_LENGTH_ZERO ; - return ; - } /* end if */ - -if( string_length > 8 ) { - *error_return = STRING_LENGTH_TOO_BIG ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Convert the number using power-of-2 table **/ -num = number ; -for( i=0, ir=string_length - 1; i= pows[ ir ] ) { - j = num / pows[ ir ] ; - num = num - j * pows[ ir ] ; - } /* end if */ - else - j = 0 ; - string[i] = ASCII_Hex[ j ] ; - } /* end for */ -} /* end of ADFI_unsignedlong_2_ASCII_Hex */ -/* end of file ADFI_unsigned_int_2_ASCII_Hex.c */ -/* file ADFI_write_data_chunk.c */ -/*********************************************************************** -ADFI write data chunk: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const struct TOKENIZED_DATA_TYPE *tokenized_data_type Array. -input: const int data_size Size of data entity in bytes. -input: const long chunk_bytes Number of bytes in data chunk. -input: const long start_offset Starting offset into the data chunk -input: const long total_bytes Number of bytes to write in data chunk. -input: const char *data Pointer to the data. If 0, zero data. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_write_data_chunk( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - const struct TOKENIZED_DATA_TYPE *tokenized_data_type, - const int data_size, - const long chunk_bytes, - const long start_offset, - const long total_bytes, - const char *data, - int *error_return ) -{ -int format_compare ; -struct DISK_POINTER current_location, end_of_chunk_tag ; - -if( block_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( tokenized_data_type == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -if( total_bytes+start_offset > chunk_bytes ) { - *error_return = REQUESTED_DATA_TOO_LONG ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Write the tag **/ -ADFI_write_file( file_index, block_offset->block, block_offset->offset, - TAG_SIZE, data_chunk_start_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Calculate the end-of-chunk-tag pointer **/ -end_of_chunk_tag.block = block_offset->block ; -end_of_chunk_tag.offset = block_offset->offset + TAG_SIZE + - DISK_POINTER_SIZE + chunk_bytes ; -ADFI_adjust_disk_pointer( &end_of_chunk_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Adjust location and write end-of-chunk pointer **/ -current_location.block = block_offset->block ; -current_location.offset = block_offset->offset + TAG_SIZE ; -ADFI_adjust_disk_pointer( ¤t_location, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_write_disk_pointer_2_disk( file_index, current_location.block, - current_location.offset, &end_of_chunk_tag, error_return ) ; - -current_location.offset += start_offset + DISK_POINTER_SIZE ; -ADFI_adjust_disk_pointer( ¤t_location, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** write the data **/ -if( data == NULL ) { /** Zero out the file data **/ - - /** If the data-pointer is NULL, write zeros to the file **/ - - /** Initialize the block of zeros **/ - if( block_of_00_initialized == FALSE ) { - int i ; - for( i=0; i DISK_BLOCK_SIZE ) { - long t_bytes = total_bytes ; - - /** If the number of bytes to write is larger than the block of - zeros we have, write out a series of zero blocks... - **/ - - /** write out the remainder of this block **/ - ADFI_write_file( file_index, current_location.block, - current_location.offset, DISK_BLOCK_SIZE - current_location.offset + 1, - block_of_00, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - - current_location.block++ ; - current_location.offset = 0 ; - t_bytes -= (DISK_BLOCK_SIZE - current_location.offset + 1) ; - - /** Write blocks of zeros, then a partial block **/ - while( t_bytes > 0 ) { - ADFI_write_file( file_index, current_location.block, - current_location.offset, MIN( DISK_BLOCK_SIZE, t_bytes), - block_of_00, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - t_bytes -= (MIN( DISK_BLOCK_SIZE, t_bytes)) ; - } /* end while */ - - } /* end if */ - else { - - /** Write a partial block of zeros to disk **/ - ADFI_write_file( file_index, current_location.block, - current_location.offset, total_bytes, block_of_00, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - } /* end if */ -else { - - /** check for need of data translation **/ - ADFI_file_and_machine_compare( file_index, tokenized_data_type, - &format_compare, error_return ); - if( *error_return != NO_ERROR ) - return ; - if( format_compare == 1 ) { - /** Write the data to disk **/ - ADFI_write_file( file_index, current_location.block, - current_location.offset, total_bytes, data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - else { - ADFI_write_data_translated( file_index, current_location.block, - current_location.offset, tokenized_data_type, data_size, - total_bytes, data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end else */ - } /* end else */ - - /** Write the ending tag to disk **/ -ADFI_write_file( file_index, end_of_chunk_tag.block, end_of_chunk_tag.offset, - TAG_SIZE, data_chunk_end_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -} /* end of ADFI_write_data_chunk */ -/* end of file ADFI_write_data_chunk.c */ -/* file ADFI_write_data_chunk_table.c */ -/*********************************************************************** -ADFI write data chunk table: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const int number_of_data_chunks Number of entries to write. -output: struct DATA_CHUNK_TABLE_ENTRY data_chunk_table[] Array of entries. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_write_data_chunk_table( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - const int number_of_data_chunks, - struct DATA_CHUNK_TABLE_ENTRY data_chunk_table[], - int *error_return ) -{ -struct DISK_POINTER disk_pointer, end_of_chunk_tag ; -int i ; - -if( (block_offset == NULL) || (data_chunk_table == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Write Starting boundary tag **/ -disk_pointer.block = block_offset->block ; -disk_pointer.offset = block_offset->offset ; -ADFI_write_file( file_index, disk_pointer.block, disk_pointer.offset, - TAG_SIZE, data_chunk_table_start_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -disk_pointer.offset += TAG_SIZE ; -ADFI_adjust_disk_pointer( &disk_pointer, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Calculate the end-of-chunk-tag location **/ -end_of_chunk_tag.block = disk_pointer.block ; -end_of_chunk_tag.offset = disk_pointer.offset + DISK_POINTER_SIZE + - number_of_data_chunks * 2 * DISK_POINTER_SIZE ; -ADFI_adjust_disk_pointer( &end_of_chunk_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_write_disk_pointer_2_disk( file_index, disk_pointer.block, - disk_pointer.offset, &end_of_chunk_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Write data chunk table entries **/ -disk_pointer.offset += DISK_POINTER_SIZE ; -for( i=0; i number_of_data_elements ) { - chunk_size -= ( number_of_elements_written - number_of_data_elements ) ; - delta_to_bytes = chunk_size * data_size ; - delta_from_bytes = chunk_size * machine_size ; - } - ADFI_convert_number_format( - ADF_this_machine_format, /* from format */ - ADF_this_machine_os_size, /* from os size */ - ADF_file_format[file_index], /* to format */ - ADF_file_os_size[file_index], /* to os size */ - TO_FILE_FORMAT, - tokenized_data_type, chunk_size, from_data, - to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - ADFI_write_file( file_index, disk_pointer.block, disk_pointer.offset, - delta_to_bytes, (char *)to_data, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - from_data += delta_from_bytes ; - disk_pointer.offset += delta_to_bytes ; - if ( disk_pointer.offset > DISK_BLOCK_SIZE ) { - ADFI_adjust_disk_pointer( &disk_pointer, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - } /* end while */ - -} /* end of ADFI_write_data_translated */ -/* end of file ADFI_write_data_translated.c */ -/* file ADFI_write_disk_block.c */ -/*********************************************************************** -ADFI write disk block: -***********************************************************************/ -void ADFI_write_disk_block() -{ -printf("Subroutine ADFI_write_disk_block is not yet implemented...\n" ) ; -} /* end of ADFI_write_disk_block */ -/* end of file ADFI_write_disk_block.c */ -/* file ADFI_write_disk_pointer_2_disk.c */ -/*********************************************************************** -ADFI write disk pointer 2 disk: - Given a pointer to a disk pointer, convert it to ASCII Hex - and write it to disk. - -input: const unsigned int file_index File to write to. -input: const unsigned long file_block Block within the file. -input: const unsigned long block_offset Offset within the block. -input: const struct DISK_POINTER *block_and_offset Disk pointer. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_write_disk_pointer_2_disk( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - const struct DISK_POINTER *block_and_offset, - int *error_return ) -{ -char disk_block_offset[DISK_POINTER_SIZE] ; - -if( block_and_offset == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Convert into ASCII_Hex form **/ -ADFI_disk_pointer_2_ASCII_Hex( block_and_offset, &disk_block_offset[0], - &disk_block_offset[8], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Put the block/offset to disk **/ -ADFI_write_file( file_index, file_block, block_offset, - DISK_POINTER_SIZE, disk_block_offset, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Set the block/offset onto the stack **/ -ADFI_stack_control(file_index, file_block, block_offset, - SET_STK, DISK_PTR_STK, DISK_POINTER_SIZE, - disk_block_offset ); - -} /* end of ADFI_write_disk_pointer_2_disk */ -/* end of file ADFI_write_disk_pointer_2_disk.c */ -/* file ADFI_write_file.c */ -/*********************************************************************** -ADFI write file: - Write a number of bytes to an ADF file, given the file, - block, and block offset. - -input: const unsigned int file_index File to write to. -input: const unsigned long file_block Block within the file. -input: const unsigned long block_offset Offset within the block. -input: const unsigned int data_length Length of the data to write. -input: const char *data Address of the data. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -FWRITE_ERROR -***********************************************************************/ -void ADFI_write_file( - const unsigned int file_index, - const unsigned long file_block, - const unsigned long block_offset, - const unsigned int data_length, - const char *data, - int *error_return ) -{ -int iret, end_block ; - -if( data == NULL ) { - *error_return = NULL_STRING_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** If the read buffer overlaps the buffer then reset it to make - sure its currrent **/ - -end_block = file_block+(block_offset+data_length)/DISK_BLOCK_SIZE+1; -if ( last_rd_file == (long int) file_index && last_rd_block >= (long int) file_block && - last_rd_block <= (long int) end_block ) - last_rd_block = last_rd_file = num_in_rd_block = -1 ; - - /** Check to see if we need to flush the write buffer. this happens if we - are writing a large chunk or the write moves out of the current block. - If the data length is zero then just flush the buffer and return. - Note that the ADF_modification_date routine will flush the buffer - after any write operations !! **/ - -if( ( (unsigned long int) data_length + block_offset > DISK_BLOCK_SIZE || - last_wr_block != (long int) file_block || last_wr_file != (long int) file_index || - data_length == 0 ) && flush_wr_block > 0 ) { - - /** Position the file **/ - ADFI_fseek_file( last_wr_file, last_wr_block, 0, error_return ) ; - if( *error_return != NO_ERROR ) { - return ; - } /* end if */ - - /** write the buffer **/ - iret=fwrite( wr_block_buffer, 1, DISK_BLOCK_SIZE, ADF_file[last_wr_file] ); - flush_wr_block = -2 ; /** Make sure we don't flush twice due to error **/ - if( iret != DISK_BLOCK_SIZE ) { - *error_return = FWRITE_ERROR ; - return ; - } /* end if */ - - /** If the write buffer overlaps the buffer then reset it to make - sure its currrent, set flush buffer flag to false. **/ - if ( last_wr_file == (long int) file_index && last_wr_block >= (long int) file_block && - last_wr_block <= (long int) end_block ) - last_wr_block = last_wr_file = -2 ; - -} /* end if */ -if ( data_length == 0 ) return; /** Just a buffer flush **/ - - /** No need to buffer large pieces of data or to take special - measures to cross block boundaries **/ - -if( data_length + block_offset > DISK_BLOCK_SIZE ) { - - /** Position the file **/ - ADFI_fseek_file( file_index, file_block, block_offset, error_return ) ; - if( *error_return != NO_ERROR ) { - return ; - } /* end if */ - - /** write the data **/ - iret = fwrite( data, 1, data_length, ADF_file[ file_index ] ) ; - if( iret != (int) data_length ) { - *error_return = FWRITE_ERROR ; - return ; - } /* end if */ - - return; -} /* end if */ - - /** For smaller pieces of data, write a block at a time. This will improve - performance if neighboring data is writen a small piece at a time - (strided reads, file overhead). - - Some assumptions apply to the block size. With some experimenting, - 1K blocks do not offer much improvement. 4K blocks (4096 bytes) - do improve performance remarkably. This is due to the fact that the - file structure is based of 4K blocks with offsets. Also the CRAY - loves 4K block writes!! - **/ - -if( (long int) file_block != last_wr_block || /*- a different block -*/ - (long int) file_index != last_wr_file ) { /*- entirely different file -*/ - - /** buffer is not current, re-read **/ - - if ( (long int) file_block == last_rd_block && (long int) file_index == last_rd_file ) { - - /* Copy data from read buffer */ - memcpy( wr_block_buffer, rd_block_buffer, DISK_BLOCK_SIZE ); - iret = num_in_rd_block; - } - else { - - /** Position the file **/ - ADFI_fseek_file( file_index, file_block, 0, error_return ) ; - if( *error_return != NO_ERROR ) { - return ; - } /* end if */ - - /** Read the data from disk **/ - iret=fread( wr_block_buffer, 1, DISK_BLOCK_SIZE, ADF_file[file_index] ) ; - if( iret == EOF || iret < DISK_BLOCK_SIZE ) { - if ( iret < 0 ) iret = 0; - memset( &wr_block_buffer[iret], (size_t) ' ', DISK_BLOCK_SIZE-iret ); - } /* end if */ - - } /* end if */ - - /** Remember buffer information **/ - last_wr_block = file_block ; - last_wr_file = file_index ; - -} /* end if */ - - /** Write into the buffer and set flush buffer flag **/ -memcpy( &wr_block_buffer[block_offset], data, data_length ); -flush_wr_block = 1 ; - -} /* end of ADFI_write_file */ -/* end of file ADFI_write_file.c */ -/* file ADFI_write_file_header.c */ -/*********************************************************************** -ADFI write file header: - To take information in the FILE_HEADER structure and format it - for disk, and write it out. -input: const int file_index File index to write to. -input: const FILE_HEADER *file_header The file header structure. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_MEMORY_TAG_ERROR -ADF_DISK_TAG_ERROR -***********************************************************************/ -void ADFI_write_file_header( - const int file_index, - const struct FILE_HEADER *file_header, - int *error_return ) -{ -char disk_header[ FILE_HEADER_SIZE ] ; - -if( file_header == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check memory tags for proper data **/ -if( strncmp( file_header->tag0, file_header_tags[0], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag1, file_header_tags[1], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag2, file_header_tags[2], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag3, file_header_tags[3], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag4, file_header_tags[4], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( file_header->tag5, file_header_tags[5], TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -/** OK the memory tags look good, let's format the file header information - into the disk format and write it out. -**/ -strncpy( &disk_header[ 0], (char *)file_header->what, WHAT_STRING_SIZE ) ; -strncpy( &disk_header[ 32], (char *)file_header->tag0, TAG_SIZE ) ; -strncpy( &disk_header[ 36], (char *)file_header->creation_date, DATE_TIME_SIZE); -strncpy( &disk_header[ 64], (char *)file_header->tag1, TAG_SIZE ) ; -strncpy( &disk_header[ 68], (char *)file_header->modification_date, - DATE_TIME_SIZE ) ; -strncpy( &disk_header[ 96], (char *)file_header->tag2, TAG_SIZE ) ; -disk_header[100] = file_header->numeric_format ; -disk_header[101] = file_header->os_size ; -strncpy( &disk_header[102], (char *)file_header->tag3, TAG_SIZE ) ; - -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_char, 0, 255, 2, - &disk_header[106], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_short, 0, 255, 2, - &disk_header[108], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_int, 0, 255, 2, - &disk_header[110], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_long, 0, 255, 2, - &disk_header[112], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_float, 0, 255, 2, - &disk_header[114], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_double, 0, 255, 2, - &disk_header[116], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_char_p, 0, 255, 2, - &disk_header[118], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_short_p, 0, 255, 2, - &disk_header[120], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_int_p, 0, 255, 2, - &disk_header[122], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_long_p, 0, 255, 2, - &disk_header[124], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_float_p, 0, 255, 2, - &disk_header[126], error_return ) ; -if( *error_return != NO_ERROR ) - return ; -ADFI_unsigned_int_2_ASCII_Hex( file_header->sizeof_double_p, 0, 255, 2, - &disk_header[128], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -strncpy( &disk_header[130], file_header->tag4, TAG_SIZE ) ; - -ADFI_disk_pointer_2_ASCII_Hex( &file_header->root_node, &disk_header[134], - &disk_header[142], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &file_header->end_of_file, &disk_header[146], - &disk_header[154], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &file_header->free_chunks, &disk_header[158], - &disk_header[166], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &file_header->extra, &disk_header[170], - &disk_header[178], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -strncpy( &disk_header[182], file_header->tag5, TAG_SIZE ) ; - - /** Now write the disk header out... **/ -ADFI_write_file( file_index, 0, 0, FILE_HEADER_SIZE, disk_header, - error_return ) ; - /** Set the header onto the stack **/ -ADFI_stack_control(file_index, 0, 0, SET_STK, FILE_STK, - FILE_HEADER_SIZE, disk_header ); -} /* end of ADFI_write_file_header */ -/* end of file ADFI_write_file_header.c */ -/* file ADFI_write_free_chunk.c */ -/*********************************************************************** -ADFI write free chunk: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const struct FREE_CHUNK *free_chunk Pointer to free-chunk. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_write_free_chunk( - const int file_index, - const struct DISK_POINTER *block_offset, - const struct FREE_CHUNK *free_chunk, - int *error_return ) -{ -unsigned int i ; -struct DISK_POINTER current_location ; - -if( (block_offset == NULL) || (free_chunk == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Initialize the block of 'X's **/ -if( block_of_XX_initialized == FALSE ) { - for( i=0; istart_tag, free_chunk_start_tag, TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( free_chunk->end_tag, free_chunk_end_tag, TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - - /** Write start TAG **/ -ADFI_write_file( file_index, block_offset->block, block_offset->offset, - TAG_SIZE, free_chunk->start_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Write disk pointers **/ -current_location.block = block_offset->block ; -current_location.offset = block_offset->offset + TAG_SIZE ; -ADFI_adjust_disk_pointer( ¤t_location, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_write_disk_pointer_2_disk( file_index, current_location.block, - current_location.offset, - &free_chunk->end_of_chunk_tag, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -current_location.offset += DISK_POINTER_SIZE ; -ADFI_adjust_disk_pointer( ¤t_location, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_write_disk_pointer_2_disk( file_index, current_location.block, - current_location.offset, - &free_chunk->next_chunk, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Write out a bunch of 'x's in the free chunk's empty space **/ -current_location.offset += DISK_POINTER_SIZE ; -ADFI_adjust_disk_pointer( ¤t_location, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Fill in partial end of a block **/ -if( (current_location.block != free_chunk->end_of_chunk_tag.block) && - (current_location.offset != 0 ) ) { - ADFI_write_file( file_index, current_location.block, - current_location.offset, DISK_BLOCK_SIZE - current_location.offset, - block_of_XX, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - current_location.block++ ; - current_location.offset = 0 ; - } /* end if */ - - /** Fill in intermediate whole blocks **/ -while( current_location.block < free_chunk->end_of_chunk_tag.block ) { - ADFI_write_file( file_index, current_location.block, - 0, DISK_BLOCK_SIZE, block_of_XX, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - current_location.block++ ; - } /* end if */ - - /** Fill in partial block to end-of-free-chunk **/ -if( current_location.offset < free_chunk->end_of_chunk_tag.offset ) { - ADFI_write_file( file_index, current_location.block, - current_location.offset, - free_chunk->end_of_chunk_tag.offset - current_location.offset, - block_of_XX, error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end if */ - - /** Now (finally) write out the free_chunk-end_tag **/ -ADFI_write_file( file_index, current_location.block, - free_chunk->end_of_chunk_tag.offset, TAG_SIZE, free_chunk->end_tag, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -} /* end of ADFI_write_free_chunk */ -/* end of file ADFI_write_free_chunk.c */ -/* file ADFI_write_free_chunk_table.c */ -/*********************************************************************** -ADFI write free chunk table: - To take information in the FREE_CHUNK_TABLE structure and format it - for disk, and write it out. -input: const int file_index File index to write to. -input: const FREE_CHUNK_TABLE *free_chunk_table The free_chunk header struct. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_write_free_chunk_table( - const int file_index, - const struct FREE_CHUNK_TABLE *free_chunk_table, - int *error_return ) -{ -char disk_free_chunk_data[ FREE_CHUNK_TABLE_SIZE ] ; - -if( free_chunk_table == NULL ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** Check memory tags for proper data **/ -if( strncmp( free_chunk_table->start_tag, free_chunk_table_start_tag, - TAG_SIZE ) != 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( free_chunk_table->end_tag, free_chunk_table_end_tag, - TAG_SIZE ) != 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -/** OK the memory tags look good, let's format the free_chunk header - information into the disk format and write it out. -**/ -strncpy( &disk_free_chunk_data[ 0], (char *)free_chunk_table->start_tag, - TAG_SIZE ) ; - -ADFI_disk_pointer_2_ASCII_Hex( &free_chunk_table->small_first_block, - &disk_free_chunk_data[TAG_SIZE], - &disk_free_chunk_data[DISK_POINTER_SIZE], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &free_chunk_table->small_last_block, - &disk_free_chunk_data[16], &disk_free_chunk_data[24], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &free_chunk_table->medium_first_block, - &disk_free_chunk_data[28], &disk_free_chunk_data[36], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &free_chunk_table->medium_last_block, - &disk_free_chunk_data[40], &disk_free_chunk_data[48], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &free_chunk_table->large_first_block, - &disk_free_chunk_data[52], &disk_free_chunk_data[60], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &free_chunk_table->large_last_block, - &disk_free_chunk_data[64], &disk_free_chunk_data[72], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -strncpy( &disk_free_chunk_data[ 76], (char *)free_chunk_table->end_tag, - TAG_SIZE ) ; - - /** Now write the free_chunk header out to disk... **/ -ADFI_write_file( file_index, FREE_CHUNKS_BLOCK, FREE_CHUNKS_OFFSET, - FREE_CHUNK_TABLE_SIZE, disk_free_chunk_data, error_return ) ; - /** Set the free chunk onto the stack **/ -ADFI_stack_control(file_index, FREE_CHUNKS_BLOCK, FREE_CHUNKS_OFFSET, - SET_STK, FREE_CHUNK_STK, FREE_CHUNK_TABLE_SIZE, - disk_free_chunk_data ); -} /* end of ADFI_write_free_chunk_table */ -/* end of file ADFI_write_free_chunk_table.c */ -/* file ADFI_write_modification_date.c */ -/*********************************************************************** -ADFI write modification date: - Writes the current date/time into the modification date field of - the file header. Also updates the file version (what string) - in the header if the file version global variable has been set - - after writing, file version global variable is unset so that it is - only written once. - -input: const int file_index File index to write to. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_STRING_POINTER -ADF_FILE_NOT_OPENED -FWRITE_ERROR -***********************************************************************/ -void ADFI_write_modification_date( - const int file_index, - int *error_return ) -{ -int i_block_offset ; -char mod_date[DATE_TIME_SIZE] ; - - -*error_return = NO_ERROR ; - -ADFI_get_current_date( mod_date ) ; - - /** block offset depends on the location the of modification date - in the FILE_HEADER structure **/ -i_block_offset = WHAT_STRING_SIZE + TAG_SIZE + DATE_TIME_SIZE + TAG_SIZE ; -ADFI_write_file( file_index, 0, i_block_offset, DATE_TIME_SIZE, mod_date, - error_return ) ; -if( *error_return != NO_ERROR ) { - return; - } /* end if */ - - /** Flush the write buffer to ensure the file is current!! **/ -ADFI_flush_buffers( file_index, FLUSH, error_return ); -if( *error_return != NO_ERROR ) { - return; - } /* end if */ - -if( file_version_update[ file_index ][ 0 ] != '\0' ) -{ - i_block_offset = 0 ; /* what-string is first field in header */ - ADFI_write_file( file_index, 0, i_block_offset, WHAT_STRING_SIZE, - file_version_update[ file_index ], error_return ) ; - -/** reset the version to default so that it only gets updated once **/ - file_version_update[ file_index ][ 0 ] = '\0' ; - if( *error_return != NO_ERROR ) { - return; - } /* end if */ - } /* end if */ - -} /* end of ADFI_write_modification_date */ -/* end of file ADFI_write_modification_date.c */ -/* file ADFI_write_node_header.c */ -/*********************************************************************** -ADFI write node header: - To take information in the NODE_HEADER structure and format it - for disk, and write it out. -input: const int file_index File index to write to. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const NODE_HEADER *node_header The node header structure. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -ADF_MEMORY_TAG_ERROR -***********************************************************************/ -void ADFI_write_node_header( - const int file_index, - const struct DISK_POINTER *block_offset, - const struct NODE_HEADER *node_header, - int *error_return ) -{ -int i ; -char disk_node_data[ NODE_HEADER_SIZE ] ; - -if( (block_offset == NULL) || (node_header == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - -/** Check memory tags for proper data **/ -if( strncmp( node_header->node_start_tag, node_start_tag, TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -if( strncmp( node_header->node_end_tag, node_end_tag, TAG_SIZE )!= 0 ) { - *error_return = ADF_MEMORY_TAG_ERROR ; - return ; - } /* end if */ - -/** OK the memory tags look good, let's format the node header information - into the disk format and write it out. -**/ -strncpy( &disk_node_data[ 0], (char *)node_header->node_start_tag, TAG_SIZE ) ; -strncpy( &disk_node_data[ TAG_SIZE], (char *)node_header->name, - ADF_NAME_LENGTH ); -strncpy( &disk_node_data[ 36], (char *)node_header->label, ADF_LABEL_LENGTH ) ; - -ADFI_unsigned_int_2_ASCII_Hex( node_header->num_sub_nodes, 0, - MAXIMUM_32_BITS, 8, &disk_node_data[ 68], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_unsigned_int_2_ASCII_Hex( node_header->entries_for_sub_nodes, 0, - MAXIMUM_32_BITS, 8, &disk_node_data[ 76], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &node_header->sub_node_table, - &disk_node_data[84], &disk_node_data[92], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -strncpy( &disk_node_data[ 96], (char *)node_header->data_type, - ADF_DATA_TYPE_LENGTH ) ; - -ADFI_unsigned_int_2_ASCII_Hex( node_header->number_of_dimensions, 0, - 12, 2, &disk_node_data[128], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -for( i=0; idimension_values[i], 0, - MAXIMUM_32_BITS, 8, &disk_node_data[130+(i*8)], error_return ) ; - if( *error_return != NO_ERROR ) - return ; - } /* end for */ - -ADFI_unsigned_int_2_ASCII_Hex( node_header->number_of_data_chunks, 0, - 65535, 4, &disk_node_data[226], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_disk_pointer_2_ASCII_Hex( &node_header->data_chunks, - &disk_node_data[230], &disk_node_data[238], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -strncpy( &disk_node_data[242], (char *)node_header->node_end_tag, TAG_SIZE ) ; - - /** Now write the node-header out to disk... **/ -ADFI_write_file( file_index, block_offset->block, block_offset->offset, - NODE_HEADER_SIZE, disk_node_data, error_return ) ; - /** Set the header onto the stack **/ -ADFI_stack_control(file_index, block_offset->block, block_offset->offset, - SET_STK, NODE_STK, NODE_HEADER_SIZE, disk_node_data ); -} /* end of ADFI_write_node_header */ -/* end of file ADFI_write_node_header.c */ -/* file ADFI_write_sub_node_table.c */ -/*********************************************************************** -ADFI write sub node table: - -input: const unsigned int file_index The file index. -input: const struct DISK_POINTER *block_offset Block & offset in the file. -input: const int number_of_sub_nodes Number of sub-node entries. -input: struct SUB_NODE_TABLE_ENTRY sub_node_table[] Array of sub-node entries. -output: int *error_return Error return. - - Possible errors: -NO_ERROR -NULL_POINTER -ADF_FILE_NOT_OPENED -***********************************************************************/ -void ADFI_write_sub_node_table( - const unsigned int file_index, - const struct DISK_POINTER *block_offset, - const int number_of_sub_nodes, - struct SUB_NODE_TABLE_ENTRY sub_node_table[], - int *error_return ) -{ -int i ; -struct DISK_POINTER end_of_chunk_tag, current_child ; - -if( (block_offset == NULL) || (sub_node_table == NULL) ) { - *error_return = NULL_POINTER ; - return ; - } /* end if */ - -if( file_in_use[ file_index ] == 0 ) { - *error_return = ADF_FILE_NOT_OPENED ; - return ; - } /* end if */ - -*error_return = NO_ERROR ; - - /** calculate the end-of-chunk tag pointer **/ -end_of_chunk_tag.block = block_offset->block ; -end_of_chunk_tag.offset = block_offset->offset + TAG_SIZE + DISK_POINTER_SIZE + - number_of_sub_nodes * (ADF_NAME_LENGTH + DISK_POINTER_SIZE) ; -ADFI_adjust_disk_pointer( &end_of_chunk_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Write start TAG **/ -ADFI_write_file( file_index, block_offset->block, block_offset->offset, - TAG_SIZE, sub_node_start_tag, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Write disk pointer **/ -current_child.block = block_offset->block ; -current_child.offset = block_offset->offset + TAG_SIZE ; -ADFI_adjust_disk_pointer( ¤t_child, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - -ADFI_write_disk_pointer_2_disk( file_index, current_child.block, - current_child.offset, &end_of_chunk_tag, - error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Format and write out the table entries **/ -current_child.offset += DISK_POINTER_SIZE ; -for( i=0; ichild_name, - ADF_NAME_LENGTH ) ; -ADFI_disk_pointer_2_ASCII_Hex( &sub_node_table_entry->child_location, - &sub_node_entry_disk_data[ ADF_NAME_LENGTH ], - &sub_node_entry_disk_data[ ADF_NAME_LENGTH + 8 ], error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Now write it out to disk **/ -ADFI_write_file( file_index, block_offset->block, block_offset->offset, - ADF_NAME_LENGTH + DISK_POINTER_SIZE, - sub_node_entry_disk_data, error_return ) ; -if( *error_return != NO_ERROR ) - return ; - - /** Set the subnode onto the stack **/ -ADFI_stack_control(file_index, block_offset->block, block_offset->offset, - SET_STK, SUBNODE_STK, ADF_NAME_LENGTH + DISK_POINTER_SIZE, - sub_node_entry_disk_data ); - -} /* end of ADFI_write_sub_node_table_entry */ -/* end of file ADFI_write_sub_node_table_entry.c */ -/* file ADFI_strtok.c */ -/*********************************************************************** -ADFI get string token: This routine simulates strtok except it returns the -current postion in the string tobe used later. Thas avoids the problem of -trying using strtok in a recrusive subroutine call which does not work! - -input/output: *string - the string to parse tokens from. - returns string with token replaced by nil. -input/output: *string_pos - the string position to begin parsing should - be placed at the beginning of the string. - returns postion after last token to continue - string parsing. Token may change from last call. -input: *token - The token to search for. -function return: - a pointer to the desired substring. - A NULL returns indicates the end of the string. - -***********************************************************************/ -char *ADFI_strtok( - char *string, - char **string_pos, - char *token ) -{ - char *tmp_ptr ; - char *sub_string ; - int string_len ; - - if ( string_pos == NULL ) return NULL ; - if( token == NULL || string == NULL || *string_pos == NULL ) return NULL ; - - /* Get the length left in the string */ - - string_len = strlen ( *string_pos ) ; - if ( string_len == 0 ) return NULL ; - - /* Find the first character in the string which does not match the token */ - tmp_ptr = *string_pos ; - while ( string_len > 0 ) { - if ( tmp_ptr[0] == token[0] ) { - tmp_ptr++ ; - string_len-- ; - } - else { - break ; - } /* end if */ - } /* end while */ - if ( string_len == 0 ) return NULL ; - - /* Set the begining fof the sub string */ - sub_string = tmp_ptr ; - - /* Find the next token or the end of the string */ - - while ( string_len > 0 ) { - if ( tmp_ptr[0] != token[0] ) { - tmp_ptr++ ; - string_len-- ; - } - else { - tmp_ptr[0] = '\0' ; - break ; - } /* end if */ - } /* end while */ - - /* Set location for the next search */ - - if ( string_len > 0 ) - *string_pos = &tmp_ptr[1] ; - else - *string_pos = NULL ; - - return sub_string ; - -} /* end of ADFI_strtok */ -/* end of file ADFI_strtok.c */ -/* end of combine 2.0 */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/qmake.vars b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/qmake.vars deleted file mode 100644 index 2838f06032..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/qmake.vars +++ /dev/null @@ -1,4 +0,0 @@ -Project MESSAGE: Building in Debug mode -Project MESSAGE: Building dynamic libraries -Project MESSAGE: MK_BUILDNAME=linux64_2.4-x86-glibc_2.2.5; export MK_BUILDNAME; -Project MESSAGE: RELEASEMODE=debug-shared; export RELEASEMODE; diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/version.pro b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/version.pro deleted file mode 100644 index 528beb556c..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libadf/version.pro +++ /dev/null @@ -1 +0,0 @@ -VERSION=5.01.000 diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/.cvsignore b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/.cvsignore deleted file mode 100644 index 67d896ff99..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*~ -.#* -\#* -make.*.list -make.*.list.batch -make.*.list.qlogerr diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/Make/files b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/Make/files deleted file mode 100644 index faf707bfe8..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/Make/files +++ /dev/null @@ -1,8 +0,0 @@ -ccmio.c -ccmiocore.c -ccmioprivate.c -ccmioutility.c -vector.c -ccmioversion.c - -LIB = $(FOAM_LIBBIN)/libccmio diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/Make/options b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/Make/options deleted file mode 100644 index 8797e717b1..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/Make/options +++ /dev/null @@ -1,6 +0,0 @@ -EXE_INC = \ - -I.. - -EXE_LIBS = \ - -ladf - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/Makefile b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/Makefile deleted file mode 100644 index 61779e37cc..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -include ../../config/Makeflags.sys - -OBJ_DIR = $(BUILD_HOME)/libccmio/libccmio -TARGET_SO_NAME = ccmio -SOURCES = $(wildcard *.cpp) - -INCLUDE_PATH = \ - -I$(STAR_HOME)/base/src \ - -I$(STAR_HOME)/libccmio - -# Because .cpp files #include .c files, need to -# allow dependency cache to deal with removed .c files -%.c: - @echo '# Ignoring missing $@' - -include $(STAR_HOME)/config/Makefile.shared_object -include $(STAR_HOME)/config/Makefile.objects diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/Makefile.ccmio b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/Makefile.ccmio deleted file mode 100644 index 0e53d6f063..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/Makefile.ccmio +++ /dev/null @@ -1,202 +0,0 @@ -############################################################################# -# Makefile for building: libccmio.so.2.06.001 -# Generated by qmake (1.07a) (Qt 3.3.2) on: Wed Aug 9 13:52:09 2006 -# Project: ccmio.pro -# Template: lib -# Command: $(QMAKE) -spec /home/hunt2/mattijs/OpenFOAM/mattijs-1.3.1/applications/utilities/ccm24ToFoam/libccmio-2.6.1/libccmio/..//config/linux64_2.4-x86-glibc_2.2.5 "RELEASEMODE=" "LIBMODE=dynamic" "PROFILEMODE=" "CC=gcc" "CXX=g++" -o Makefile.ccmio ccmio.pro -############################################################################# - -####### Compiler, tools and options - -CC = gcc -CXX = g++ -LEX = flex -YACC = yacc -CFLAGS = -m64 -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wall -W -g -fPIC -DLINUX64_2_4_X86_GLIBC_2_2_5 -CXXFLAGS = -m64 -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fexceptions -Wall -W -g -fPIC -DLINUX64_2_4_X86_GLIBC_2_2_5 -LEXFLAGS = -YACCFLAGS= -d -INCPATH = -I/home/hunt2/mattijs/OpenFOAM/mattijs-1.3.1/applications/utilities/ccm24ToFoam/libccmio-2.6.1/config/linux64_2.4-x86-glibc_2.2.5 -I. -I.. -I..//include -LINK = g++ -LFLAGS = -shared -Wl,-soname,libccmio.so.2 -Wl,-rpath,/home/hunt2/mattijs/OpenFOAM/mattijs-1.3.1/applications/utilities/ccm24ToFoam/libccmio-2.6.1/lib/linux64_2.4-x86-glibc_2.2.5/debug-shared -LIBS = $(SUBLIBS) -AR = ar cqs -RANLIB = -MOC = $(QTDIR)/bin/moc -UIC = $(QTDIR)/bin/uic -QMAKE = ../config/linux64_2.4-x86-glibc_2.2.5/qmake -TAR = tar -cf -GZIP = gzip -9f -COPY = cp -f -p -COPY_FILE= $(COPY) -COPY_DIR = $(COPY) -r -INSTALL_FILE= $(COPY_FILE) -INSTALL_DIR = $(COPY_DIR) -DEL_FILE = rm -f -SYMLINK = ln -sf -DEL_DIR = rmdir -MOVE = mv -f -CHK_DIR_EXISTS= test -d -MKDIR = mkdir -p - -####### Output directory - -OBJECTS_DIR = ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ - -####### Files - -HEADERS = ccmio.h \ - ccmiocore.h \ - ccmiotypes.h \ - ccmioprivate.h \ - ccmioutility.h \ - vector.h \ - ccmioversion.h -SOURCES = ccmio.c \ - ccmiocore.c \ - ccmioprivate.c \ - ccmioutility.c \ - vector.c \ - ccmioversion.c -OBJECTS = ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ccmio.o \ - ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ccmiocore.o \ - ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ccmioprivate.o \ - ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ccmioutility.o \ - ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/vector.o \ - ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ccmioversion.o -FORMS = -UICDECLS = -UICIMPLS = -SRCMOC = -OBJMOC = -DIST = ../config/config.pro \ - ../config/ccm.pro \ - version.pro \ - ccmio.pro -QMAKE_TARGET = ccmio -DESTDIR = ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/ -TARGET = libccmio.so.2.06.001 -TARGETA = ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/libccmio.a -TARGETD = libccmio.so.2.06.001 -TARGET0 = libccmio.so -TARGET1 = libccmio.so.2 -TARGET2 = libccmio.so.2.06 - -first: all -####### Implicit rules - -.SUFFIXES: .c .o .cpp .cc .cxx .C - -.cpp.o: - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< - -.cc.o: - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< - -.cxx.o: - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< - -.C.o: - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< - -.c.o: - $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< - -####### Build rules - -all: Makefile.ccmio ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET) - -../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP) - test -d ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/ || mkdir -p ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/ - -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) - $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP) - -ln -s $(TARGET) $(TARGET0) - -ln -s $(TARGET) $(TARGET1) - -ln -s $(TARGET) $(TARGET2) - -$(DEL_FILE) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET) - -$(DEL_FILE) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET0) - -$(DEL_FILE) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET1) - -$(DEL_FILE) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET2) - -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/ - - - -staticlib: $(TARGETA) - -$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP) - -$(DEL_FILE) $(TARGETA) - $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) - -mocables: $(SRCMOC) -uicables: $(UICDECLS) $(UICIMPLS) - -$(MOC): - ( cd $(QTDIR)/src/moc && $(MAKE) ) - -Makefile.ccmio: ccmio.pro /home/hunt2/mattijs/OpenFOAM/mattijs-1.3.1/applications/utilities/ccm24ToFoam/libccmio-2.6.1/config/linux64_2.4-x86-glibc_2.2.5/qmake.conf ../config/config.pro \ - ../config/ccm.pro \ - version.pro - $(QMAKE) -spec /home/hunt2/mattijs/OpenFOAM/mattijs-1.3.1/applications/utilities/ccm24ToFoam/libccmio-2.6.1/libccmio/..//config/linux64_2.4-x86-glibc_2.2.5 "RELEASEMODE=" "LIBMODE=dynamic" "PROFILEMODE=" "CC=gcc" "CXX=g++" -o Makefile.ccmio ccmio.pro -qmake: - @$(QMAKE) -spec /home/hunt2/mattijs/OpenFOAM/mattijs-1.3.1/applications/utilities/ccm24ToFoam/libccmio-2.6.1/libccmio/..//config/linux64_2.4-x86-glibc_2.2.5 "RELEASEMODE=" "LIBMODE=dynamic" "PROFILEMODE=" "CC=gcc" "CXX=g++" -o Makefile.ccmio ccmio.pro - -dist: - @mkdir -p ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ccmio && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ccmio/ && ( cd `dirname ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ccmio` && $(TAR) ccmio.tar ccmio && $(GZIP) ccmio.tar ) && $(MOVE) `dirname ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ccmio`/ccmio.tar.gz . && $(DEL_FILE) -r ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ccmio - -mocclean: -uiclean: - -yaccclean: -lexclean: -clean: - -$(DEL_FILE) $(OBJECTS) - -$(DEL_FILE) *~ core *.core - - -####### Sub-libraries - -distclean: clean - -$(DEL_FILE) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET) $(TARGET) - -$(DEL_FILE) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET0) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET1) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET2) $(TARGETA) - - -FORCE: - -####### Compile - -../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ccmio.o: ccmio.c ccmio.h \ - ccmiocore.h \ - ccmioprivate.h \ - ccmioutility.h \ - ccmioversion.h \ - ccmioread.c - $(CC) -c $(CFLAGS) $(INCPATH) -o ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ccmio.o ccmio.c - -../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ccmiocore.o: ccmiocore.c ccmio.h \ - ccmiocore.h \ - ccmioprivate.h \ - ccmioversion.h \ - ccmioutility.h - $(CC) -c $(CFLAGS) $(INCPATH) -o ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ccmiocore.o ccmiocore.c - -../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ccmioprivate.o: ccmioprivate.c ccmiocore.h \ - ccmioprivate.h - $(CC) -c $(CFLAGS) $(INCPATH) -o ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ccmioprivate.o ccmioprivate.c - -../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ccmioutility.o: ccmioutility.c ccmioutility.h \ - ccmiocore.h \ - ccmioprivate.h - $(CC) -c $(CFLAGS) $(INCPATH) -o ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ccmioutility.o ccmioutility.c - -../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/vector.o: vector.c vector.h - $(CC) -c $(CFLAGS) $(INCPATH) -o ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/vector.o vector.c - -../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ccmioversion.o: ccmioversion.c ccmioversion.h - $(CC) -c $(CFLAGS) $(INCPATH) -o ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ccmioversion.o ccmioversion.c - -####### Install - -install: - -uninstall: - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/Makefile.qmake b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/Makefile.qmake deleted file mode 100644 index 3856b47046..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/Makefile.qmake +++ /dev/null @@ -1,4 +0,0 @@ -PATHTOSRC = ../ -PROJECT = ccmio - -include ../config/Makefile.main diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/TAGS.make b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/TAGS.make deleted file mode 100644 index 9d01e3ae7e..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/TAGS.make +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/tcsh -x - -find . -type f \( -name '*.h' -o -name '*.c' -o -name '*.cpp' -o -name '*.f' -o -name '*.F' \) -print | grep -iv dynamic | grep -iv pro_tcl | sort | xargs -t etags diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/asdf.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/asdf.c deleted file mode 100644 index f8803d6609..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/asdf.c +++ /dev/null @@ -1,37 +0,0 @@ -int CheckEntityParent( CCMIOID parent, CCMIOEntity childType ) -{ - if ((childType == kCCMIOProcessor && parent.type != kCCMIOState) || - (childType == kCCMIOBoundaryFaces && parent.type != kCCMIOTopology) || - (childType == kCCMIOCellType && parent.type != kCCMIOProblemDescription) || - (childType == kCCMIOBoundaryRegion && parent.type != kCCMIOProblemDescription) || - (childType == kCCMIOInterfaces && parent.type != kCCMIOCells)) - return(0); - return(1); -} - - -int CheckEntityParent (CCMIOID parent, CCMIOEntity childType) -{ - switch (childType) - { - case kCCMIOProcessor: - return (parent.type != kCCMIOState) ? 0 : 1; - - case kCCMIOBoundaryFaces: - return (parent.type != kCCMIOTopology) ? 0 : 1; - - case kCCMIOCellType: - return (parent.type != kCCMIOProblemDescription) ? 0 : 1; - - case kCCMIOBoundaryRegion: - return (parent.type != kCCMIOProblemDescription) ? 0 : 1; - - case kCCMIOInterfaces: - return (parent.type != kCCMIOCells && - parent.type != kCCMIOTopology) ? 0 : 1; - - default: - return 1; - } - return 1; -} diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmio.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmio.c deleted file mode 100644 index a98ddd8586..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmio.c +++ /dev/null @@ -1,2322 +0,0 @@ -#ifndef CCMIO_C -#define CCMIO_C - -/*@@ - * Program: Star File Format Library - $RCSfile: ccmio.c,v $ - * Author: Geoff Prewett - * Date: July 28, 2003 - * - * - * Star File Format Library - Copyright (C) 2003 by adapco, Ltd. - * - * This program is the property of adapco, Ltd. and contains - * confidential and proprietary information. The unauthorized use, - * distribution, or duplication of this program is prohibited. - * All rights reserved. - * - * $Id: ccmio.c,v 1.29 2006/06/06 13:59:18 cmm Exp $ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef MAKEDEPEND -#include -#include -#include -#include -#endif - -#include -#include "ccmio.h" -#include "ccmiocore.h" -#include "ccmioprivate.h" -#include "ccmioutility.h" -#include "ccmioversion.h" - -const char kGeneralNodeName[] = "General"; -const char kVersionNodePath[] = "/General/Version"; -const char kVersionNodeName[] = "Version"; -const char kTitleNodePath[] = "/General/Title"; -const char kTitleNodeName[] = "Title"; -const char kEntityIDDelimiter = '-'; -const char kLabelName[] = "Label"; -const char kMapName[] = "MapId"; -const char kMapMaxName[] = "MaximumMappedId"; -const char kMapDataName[] = "IdMap"; -const char kMeshesName[] = "Meshes"; -const char kVertexDimensionName[] = "Dimension"; -const char kVertexScaleFactorName[] = "ScaleFactor"; -const char kVertexCoordinatesName[] = "Coordinates"; -const char kNumFacesName[] = "NumFaces"; -const char kFacesVertexDataName[] = "Vertices"; -const char kFacesCellDataName[] = "Cells"; -const char kCellDataName[] = "CellType"; -const char kNumCellsName[] = "NumCells"; -const char kNBoundariesName[] = "NumBoundaryTypes"; -const char kVerticesFileName[] = "VerticesFile"; -const char kTopologyFileName[] = "TopologyFile"; -const char kInitialFieldFileName[] = "InitialFieldFile"; -const char kSolutionFileName[] = "SolutionFileName"; -const char kPositionsFileName[] = "PositionsFile"; -const char kVerticesIDName[] = "VerticesId"; -const char kTopologyIDName[] = "TopologyId"; -const char kInitialFieldIDName[] = "InitialFieldId"; -const char kSolutionIDName[] = "SolutionId"; -const char kPositionsIDName[] = "PositionsId"; -const char kProblemDescriptionName[] = "ProblemDescription"; -const char kFieldTypeName[] = "FieldType"; -const char kFieldShortName[] = "ShortName"; -const char kFieldUnitsName[] = "Units"; -const char kFieldDataTypeName[] = "DataType"; -const char kFieldDataName[] = "Data"; -const char kMapMarkName[] = "unused"; -const char kTempName[] = "tmp"; -const char kSolverName[] = "SolverName"; -const char kIterationName[] = "Iteration"; -const char kTimeName[] = "Time"; -const char kTimeUnitsName[] = "TimeUnits"; -const char kStartAngleName[] = "StartAngle"; -const char kDefaultTimeUnits[] = "s"; -const char kConstantDataName[] = "ConstantData"; -const char kComponentName[] = "Component"; -const char kProstarSetsName[] = "ProstarSets"; -const char kCellSetName[] = "CellSet"; -const char kVertexSetName[] = "VertexSet"; -const char kBoundarySetName[] = "BoundarySet"; -const char kSplineSetName[] = "SplineSet"; -const char kBlockSetName[] = "BlockSet"; -const char kCoupleSetName[] = "CoupleSet"; - - -static char gEntityNames[][kCCMIOMaxStringLength + 1] = - { "Map", "Vertices", "FaceBasedTopology", "InternalFaces", - "BoundaryFaces", "Cells", "ProblemDescription", - "FieldSet", "Field", "Data", "State", "Processor", "CellType", - "BoundaryRegion", "LagrangianData", "Interfaces", "Phase", "RestartInfo", - "RestartData", "ReferenceData", "ModelConstants", "ProstarSet", "" }; - -static char gTypeNames[][kCCMIOMaxStringLength + 1] = - { "map", "vertices", "topology", "internalFaces", "boundaryFaces", - "cells", "problemDescription", "fieldSet", "field", "fieldData", "state", - "processor", "cellType", "boundaryRegion", "lagrangianData", - "interfaces", "phase", "restartInfo", "restartData", "referenceData", - "modelConstants", "prostarSet", "" }; - -static void ClearCCMIOID( CCMIOID *id ); -static void MakeRootCCMIOID( CCMIONode root, CCMIOID *id ); -static int CheckEntityParent( CCMIOID parent, CCMIOEntity childType ); -static CCMIOError GetEntityParent( CCMIOError *err, CCMIOID id, CCMIOEntity type, - CCMIOID *parent ); -static int ParseEntityID( const char *name ); -static void MakeEntityName( CCMIOEntity type, int id, char *name); -static void ClearStateProbDef( CCMIOError *err, CCMIOID state ); -static CCMIOError MarkMaps( CCMIOError *err, CCMIOID anyID, CCMIONode top, int unused ); -static CCMIOError RemoveUnusedMaps( CCMIOError *err, CCMIONode root ); -static CCMIOError ReadProcessorItem( CCMIOError *err, CCMIOID processor, CCMIOID *id, - const char *fileNodeName, - const char *mapNodeName, CCMIOEntity type ); -static int IsProcessorEntityUsed( CCMIOError *err, CCMIOID state, CCMIOID proc, - CCMIOID *lagrangian, const char *fileNodeName, - const char *idNodeName ); - -/* ------------ Entity Cache -------------- */ -/* Creating entities automatically requires knowing that last entity - id. Walking through them all each time is too slow with a large - number of nodes, particularly since ADF gets very slow after about - 300 child nodes. This cache attempts to ameliorate the problem. */ -struct MaxIndexCache -{ - CCMIONode root; - unsigned int max[kCCMIOMaxEntity]; - CCMIONode parent[kCCMIOMaxEntity]; -}; -static struct MaxIndexCache gCache = { { 0, 0 }, { 0 }, { { 0, 0} } }; - -static int CacheNeedsClear( struct MaxIndexCache *cache, CCMIOID parent, - CCMIOEntity type ) -{ - if (CCMIOAreNodesEqual(cache->root, parent.root)) - return(!CCMIOAreNodesEqual(cache->parent[type], parent.node)); - return(TRUE); -} - -static void CacheClear( struct MaxIndexCache *cache, CCMIOID parent, - CCMIOEntity type ) -{ - int i; - - if (type == kCCMIONull) - { - cache->root = parent.root; - for (i = 0; i < kCCMIOMaxEntity; ++i) - { - cache->max[i] = 0; - cache->parent[i].node = 0.0; - cache->parent[i].parent = 0.0; - } - } - else - { - cache->max[type] = 0; - cache->parent[type] = parent.node; - } -} - -static int CacheGet( struct MaxIndexCache *cache, CCMIOEntity type ) -{ - return(cache->max[(int)type]); -} - -static int CacheIncrement( struct MaxIndexCache *cache, CCMIOEntity type ) -{ - return(cache->max[(int)type]++); -} - -static void CacheSet( struct MaxIndexCache *cache, CCMIOEntity type, - unsigned int maxID ) -{ - cache->max[(int)type] = maxID; -} -/* ---------------------------------------- */ - -void ClearCCMIOID( CCMIOID *id ) -{ - if (id) - { - id->root.parent = 0; - id->root.node = 0; - id->node.parent = 0; - id->node.node = 0; - id->id = 0; - id->type = kCCMIOMaxEntity; - id->version = 0; - } -} - -void MakeRootCCMIOID( CCMIONode root, CCMIOID *id ) -{ - if (id) - { - id->root = root; - id->node = root; - id->id = 0; - id->type = kCCMIONull; - id->version = 0; - CCMIOGetVersion(NULL, root, &id->version); - } -} - -CCMIOError CCMIOGetVersion( CCMIOError *err, CCMIONode root, int *version ) -{ - CHECK_ERROR(err); - if (!version) return(*err = kCCMIOBadParameterErr); - - CCMIOReadNodei(err, root, kVersionNodePath, version); - if (*err) - return(*err = kCCMIOCorruptFileErr); - return(*err = kCCMIONoErr); -} - -CCMIOError CCMIOSetVersion( CCMIOError *err, CCMIONode root, int version ) -{ - CCMIONode general; - - CHECK_ERROR(err); - - if (CCMIOGetNode(NULL, root, kGeneralNodeName, &general)) - if (CCMIOCreateNode(err, root, FALSE, kGeneralNodeName, kGeneralNodeName, - &general)) - return(*err = kCCMIOCorruptFileErr); - CCMIOWriteNodei(err, general, kVersionNodeName, version); - if (*err) - return(*err = kCCMIOCorruptFileErr); - return(*err = kCCMIONoErr); -} - -CCMIOError CCMIOGetTitle( CCMIOError *err, CCMIONode root, char **title ) -{ - CHECK_ERROR(err); - if (!title) return(*err = kCCMIOBadParameterErr); - - CCMIOReadNodestr(err, root, kTitleNodePath, title); - if (*err) - return(*err = kCCMIOCorruptFileErr); - return(*err = kCCMIONoErr); -} - -CCMIOError CCMIOSetTitle( CCMIOError *err, CCMIONode root, const char *title ) -{ - CCMIONode general; - - CHECK_ERROR(err); - if (!title) return(*err = kCCMIOBadParameterErr); - - if (CCMIOGetNode(NULL, root, kGeneralNodeName, &general)) - if (CCMIOCreateNode(NULL, root, FALSE, kGeneralNodeName, - kGeneralNodeName, &general)) - return(*err = kCCMIOCorruptFileErr); - CCMIOWriteNodestr(err, general, kTitleNodeName, title); - if (*err) - return(*err = kCCMIOCorruptFileErr); - return(*err = kCCMIONoErr); -} - -CCMIOError CCMIOOpenFile( CCMIOError *err, const char *file, CCMIOIOType mode, - CCMIOID *root ) -{ - CCMIONode node; - CHECK_ERROR(err); - - if (root) - ClearCCMIOID(root); - else - return(*err = kCCMIOBadParameterErr); - - *err = CCMIOOpen(file, mode, &node); - if (*err != kCCMIONoErr) - return(*err); - - MakeRootCCMIOID(node, root); - - /* If you closed a file and opened a new one, ADF might give the new - one the same root ID as the old one, so clear the cache, just in case.*/ - CacheClear(&gCache, *root, kCCMIONull); - - return(*err); -} - -CCMIOError CCMIOCloseFile( CCMIOError *err, CCMIOID root ) -{ - IGNORE_ERROR(err); - - CCMIOClose(root.root); - return(*err); -} - -CCMIOError CCMIOWriteOpti( CCMIOError *err, CCMIOID parent, const char *name, - int value ) -{ - return(CCMIOWriteNodei(err, parent.node, name, value)); -} - -CCMIOError CCMIOWriteOptf( CCMIOError *err, CCMIOID parent, const char *name, - float value ) -{ - return(CCMIOWriteNodef(err, parent.node, name, value)); -} - -CCMIOError CCMIOWriteOptd( CCMIOError *err, CCMIOID parent, const char *name, - double value ) -{ - return(CCMIOWriteNoded(err, parent.node, name, value)); -} - -CCMIOError CCMIOWriteOptstr( CCMIOError *err, CCMIOID parent, - const char *name, const char *value ) -{ - return(CCMIOWriteNodestr(err, parent.node, name, value)); -} - -CCMIOError CCMIOReadOptstr( CCMIOError *err, CCMIOID parent, const char *name, - int *size, char *value ) -{ - if (size) *size = 0; - { - char *tmp; - CHECK_ERROR(err); - - CCMIOReadNodestr(err, parent.node, name, &tmp); - if (tmp) - { - if (size) - *size = strlen(tmp); - if (value) - strcpy(value, tmp); - } - else - { - if (size) - *size = 0; - if (value) - *value = '\0'; - } - free(tmp); - - return(*err); - } -} - -CCMIOError CCMIOGetOptInfo( CCMIOError *err, CCMIOID parent, const char *name, - CCMIODataType *type, CCMIOIndex *x, - CCMIOIndex *y, CCMIOIndex *z ) -{ - if (type) *type = kCCMIOBadType; - if (x) *x = 0; - if (y) *y = 0; - if (z) *z = 0; - { - char nodeName[kCCMIOMaxStringLength + 1]; - CCMIONode node; - CHECK_ERROR(err); - - CCMIOGetName(err, parent.node, nodeName); - CCMIOGetNode(err, parent.node, name, &node); - if (type) - CCMIOGetDataType(err, node, type); - if (parent.version < 20300 && (x || y || z)) - { - int nDims; - CCMIOIndex *dims; - - CCMIOGetDimensions(err, node, &nDims, &dims); - if (*err != kCCMIONoErr) - return(*err); - if (nDims >= 1 && x) - *x = dims[0]; - if (nDims >= 2 && y) - *y = dims[1]; - if (nDims >= 2 && z) - *z = dims[2]; - free(dims); - } - else if (x || y || z) - { - int nDims; - CCMIOIndex *dims; - - CCMIOGetDimensions(err, node, &nDims, &dims); - if (*err != kCCMIONoErr) - return(*err); - if (nDims >= 1 && x) - *x = dims[nDims - 1]; - if (nDims >= 2 && y) - *y = dims[nDims - 2]; - if (nDims >= 2 && z) - *z = dims[nDims - 3]; - free(dims); - } - } - return(*err); -} - -void CCMIOInvalidateEntity( CCMIOID *entity ) -{ - ClearCCMIOID(entity); -} - -int CCMIOIsValidEntity( CCMIOID entity ) -{ - return(entity.type != kCCMIOMaxEntity); -} - -int CCMIOIsFromSameFile( CCMIOID entity1, CCMIOID entity2 ) -{ - return(CCMIOAreNodesEqual(entity1.root, entity2.root)); -} - -int CheckEntityParent (CCMIOID parent, CCMIOEntity childType) -{ - switch (childType) - { - case kCCMIOProcessor: - return (parent.type != kCCMIOState) ? 0 : 1; - - case kCCMIOBoundaryFaces: - return (parent.type != kCCMIOTopology) ? 0 : 1; - - case kCCMIOCellType: - return (parent.type != kCCMIOProblemDescription) ? 0 : 1; - - case kCCMIOBoundaryRegion: - return (parent.type != kCCMIOProblemDescription) ? 0 : 1; - - case kCCMIOInterfaces: - return (parent.type != kCCMIOCells && - parent.type != kCCMIOTopology) ? 0 : 1; - - default: - return 1; - } - return 1; -} - -CCMIOError GetEntityParent( CCMIOError *err, CCMIOID id, CCMIOEntity type, - CCMIOID *parent ) -{ - if (parent) ClearCCMIOID(parent); - { - CHECK_ERROR(err); - if (!parent) return(*err = kCCMIOBadParameterErr); - - switch(type) - { - case kCCMIOVertices: - case kCCMIOTopology: - CCMIOCreateNode(err, id.root, TRUE, kMeshesName, kMeshesName, - &parent->node); - break; - case kCCMIOMap: - case kCCMIOProblemDescription: - case kCCMIOFieldSet: - case kCCMIOField: - case kCCMIOState: - { - char name[kCCMIOMaxStringLength + 1]; - - CCMIONode node = id.root; - if (type == kCCMIOField) - node = id.node; -#if kHasSNPrintf - snprintf(name, kCCMIOMaxStringLength, "%ss", - gEntityNames[(int)type]); -#else - sprintf(name, "%ss", gEntityNames[(int)type]); -#endif - name[kCCMIOMaxStringLength] = '\0'; - CCMIOCreateNode(err, node, TRUE, name, gTypeNames[(int)type], - &parent->node); - } - break; - case kCCMIOLagrangianData: - CCMIOCreateNode(err, id.node, TRUE, gEntityNames[(int)type], - gTypeNames[(int)type], &parent->node); - break; - case kCCMIOProstarSet: - CCMIOCreateNode(err, id.root, TRUE, kProstarSetsName, - kProstarSetsName, &parent->node); - break; - default: - if (!CheckEntityParent(id, type)) - return(*err = kCCMIOWrongParentErr); - parent->node = id.node; - break; - } - parent->root = id.root; - parent->id = 0; - parent->type = type; - parent->version = id.version; - return(*err); - - } -} - -int ParseEntityID( const char *name ) -{ - char const *pos = strrchr(name, kEntityIDDelimiter); - - if (pos == NULL) - return(0); - if (pos != name && (*(pos - 1) == '-')) /* Negative ID number */ - --pos; - return(atoi(++pos)); -} - -void MakeEntityName( CCMIOEntity type, int id, char *name ) -{ - if (type == kCCMIOInternalFaces || type == kCCMIOCells || - type == kCCMIOInterfaces || type == kCCMIORestart || - type == kCCMIORestartData || type == kCCMIOReferenceData || - type == kCCMIOModelConstants) -#if kHasSNPrintf - snprintf(name, kCCMIOMaxStringLength, gEntityNames[(int)type]); -#else - sprintf(name, gEntityNames[(int)type]); -#endif - else -#if kHasSNPrintf - snprintf(name, kCCMIOMaxStringLength, "%s%c%d", - gEntityNames[(int)type], kEntityIDDelimiter, id); -#else - sprintf(name, "%s%c%d", - gEntityNames[(int)type], kEntityIDDelimiter, id); -#endif - name[kCCMIOMaxStringLength] = '\0'; -} - -CCMIOError GetEntityCore( CCMIOError *err, CCMIOID parent, int makeNew, - CCMIOEntity type, int idVal, - const char *description, CCMIOID *id ) -{ - char name[kCCMIOMaxStringLength + 1]; - - MakeEntityName(type, idVal, name); - if (makeNew) - { - CCMIOCreateNode(err, parent.node, FALSE, name, gTypeNames[(int)type], - &id->node); - if (description) - CCMIOWriteNodestr(err, id->node, kLabelName, description); - } - else - { - GetEntityParent(err, parent, type, &parent); - CCMIOGetNode(err, parent.node, name, &id->node); - } - id->id = idVal; - id->type = type; - id->root = parent.root; - id->version = parent.version; - return(*err); -} - -CCMIOError CCMIONewEntity( CCMIOError *err, CCMIOID parent, CCMIOEntity type, - const char *description, CCMIOID *id ) -{ - /* Keep a cache of the last known maximum IDs which needs to be cleared - if we start writing to a different file. Only one file is cached because - it is simpler and it is unlikely that entities will be alternatingly - created. */ - if (CacheNeedsClear(&gCache, parent, type)) - CacheClear(&gCache, parent, type); - - if (id) ClearCCMIOID(id); - { - char entityName[kCCMIOMaxStringLength + 1]; - int n, i = 0, maxID = 0; - CCMIONode next; - CCMIOID realParent; - CHECK_ERROR(err); - - if (type == kCCMIOBoundaryFaces || type == kCCMIOState) - return(*err = kCCMIOBadParameterErr); - GetEntityParent(err, parent, type, &realParent); - if (*err != kCCMIONoErr) - return(*err); - - if (CacheGet(&gCache, type) != 0) - maxID = CacheIncrement(&gCache, type); - else - { - while (*err == kCCMIONoErr && - CCMIOGetNextChildWithLabel(NULL, - realParent.node,gTypeNames[(int)type], - &i, &next) == kCCMIONoErr) - { - CCMIOGetName(err, next, entityName); - n = ParseEntityID(entityName); - if (n > maxID) - maxID = n; - } - CacheSet(&gCache, type, maxID + 1); - } - - GetEntityCore(err, realParent, TRUE, type, maxID + 1, description, id); - return(*err); - } -} - -CCMIOError CCMIONewIndexedEntity( CCMIOError *err, CCMIOID parent, - CCMIOEntity which, int idVal, - const char *description, CCMIOID *id ) -{ - if (id) ClearCCMIOID(id); - { - int nBoundaries; - CHECK_ERROR(err); - if (which != kCCMIOBoundaryFaces && which != kCCMIOCellType && - which != kCCMIOBoundaryRegion && which != kCCMIOFieldPhase) - return(*err = kCCMIOWrongParentErr); - - GetEntityCore(err, parent, TRUE, which, idVal, description, id); - if (*err != kCCMIONoErr) - return(*err); - if (which == kCCMIOBoundaryFaces) - { - CCMIOReadNodei(err, parent.node, kNBoundariesName, &nBoundaries); - if (*err == kCCMIONoNodeErr) - { - *err = kCCMIONoErr; - nBoundaries = 0; - } - CCMIOWriteNodei(err, parent.node, kNBoundariesName, nBoundaries + 1); - } - - return(*err); - } - -} - -CCMIOError CCMIOGetEntity( CCMIOError *err, CCMIOID parent, CCMIOEntity type, - int idVal, CCMIOID *id ) -{ - if (id) ClearCCMIOID(id); - { - CHECK_ERROR(err); - - if (!CheckEntityParent(parent, type)) - return(*err = kCCMIOWrongParentErr); - if (type == kCCMIOState || type == kCCMIOField) - return(*err = kCCMIOBadParameterErr); - - GetEntityCore(err, parent, FALSE, type, idVal, NULL, id); - return(*err); - } -} - -void ClearStateProbDef( CCMIOError *err, CCMIOID state ) -{ - int i = 0, idVal, idVal2; - CCMIONode node; - CCMIOID next, problem; - - if (CCMIOReadNodei(NULL, state.node, kProblemDescriptionName, &idVal) - != kCCMIONoErr) - return; - CCMIOGetEntity(err, state, kCCMIOProblemDescription, idVal, &problem); - while (CCMIONextEntity(NULL, state, kCCMIOState, &i, &next) == kCCMIONoErr) - { - if (CCMIOAreNodesEqual(state.node, next.node)) - continue; - if (CCMIOReadNodei(NULL, next.node, kProblemDescriptionName, &idVal2) - == kCCMIONoErr && idVal == idVal2) - return; - } - - CCMIODeleteEntity(err, problem); - CCMIOGetNode(err, state.node, kProblemDescriptionName, &node); - CCMIODeleteNode(err, node); - return; -} - -CCMIOError CCMIONewState( CCMIOError *err, CCMIOID root, const char *name, - CCMIOID *problemDescription, - const char *description, CCMIOID *state ) -{ - CCMIOID tmpID; - if (state) - ClearCCMIOID(state); - else - state = &tmpID; - { - int i = 0; - CCMIONode node; - CCMIOID parent, proc; - CHECK_ERROR(err); - if (!name) return(*err = kCCMIOBadParameterErr); - - GetEntityParent(err, root, kCCMIOState, &parent); - CCMIOCreateNode(err, parent.node, TRUE, name, gTypeNames[(int)kCCMIOState], - &node); - state->root = root.root; - state->node = node; - state->id = 0; - state->type = kCCMIOState; - - /* In case this node already exists, remove everything */ - ClearStateProbDef(err, *state); - while(CCMIONextEntity(NULL, *state, kCCMIOProcessor, &i, &proc) - == kCCMIONoErr) - CCMIOClearProcessor(NULL, *state, proc, TRUE, TRUE, TRUE, TRUE, TRUE); - CCMIODeleteAllChildren(NULL, state->node); - - if (problemDescription) - CCMIOWriteNodei(err, node, kProblemDescriptionName, - problemDescription->id); - - if (description) - CCMIOWriteNodestr(err, state->node, kLabelName, description); - - return(*err); - } -} - -CCMIOError CCMIOGetState( CCMIOError *err, CCMIOID root, const char *name, - CCMIOID *problemDescription, CCMIOID *state) -{ - CCMIOID tmpState; - if (problemDescription) ClearCCMIOID(problemDescription); - if (state) - ClearCCMIOID(state); - else - state = &tmpState; - { - CCMIONode node; - CCMIOID parent; - CHECK_ERROR(err); - if (!name) return(*err = kCCMIOBadParameterErr); - - GetEntityParent(err, root, kCCMIOState, &parent); - CCMIOGetNode(err, parent.node, name, &node); - if (*err != kCCMIONoErr) - return(*err); - state->root = root.root; - state->node = node; - state->id = 0; - state->type = kCCMIOState; - state->version = root.version; - if (problemDescription) - { - CCMIOReadNodei(err, state->node, kProblemDescriptionName, - &problemDescription->id); - if (*err == kCCMIONoNodeErr) - *err = kCCMIONoErr; - else - CCMIOGetEntity(err, *state, kCCMIOProblemDescription, - problemDescription->id, problemDescription); - } - } - return(*err); -} - -CCMIOError CCMIONewField( CCMIOError *err, CCMIOID phase, const char *name, - const char *shortName, CCMIODimensionality dim, - CCMIOID *field ) -{ - if (field) ClearCCMIOID(field); - { - CCMIOID parent; - CHECK_ERROR(err); - - GetEntityParent(err, phase, kCCMIOField, &parent); - CCMIOCreateNode(err, parent.node, TRUE, name, gTypeNames[(int)kCCMIOField], - &field->node); - field->root = parent.root; - field->id = 0; - field->type = kCCMIOField; - CCMIOWriteNodei(err, field->node, kFieldTypeName, dim); - if (shortName) - { - char sname[kCCMIOProstarShortNameLength + 1] = ""; - snprintf(sname, kCCMIOProstarShortNameLength + 1, "%s", shortName); - CCMIOWriteOptstr(err, *field, kFieldShortName, sname); - } - - return(*err); - } -} - -CCMIOError CCMIOGetField( CCMIOError *err, CCMIOID phase, const char *name, - CCMIODimensionality *dim, CCMIOID *field ) -{ - if (field) ClearCCMIOID(field); - { - CCMIOID parent; - CHECK_ERROR_AND_CLEAR_PTR(err, dim, kCCMIODimNull); - if (phase.type != kCCMIOFieldPhase) - return(*err = kCCMIOBadParameterErr); - - GetEntityParent(err, phase, kCCMIOField, &parent); - CCMIOGetNode(err, parent.node, name, &field->node); - field->root = parent.root; - field->id = 0; - field->type = kCCMIOField; - field->version = phase.version; - if (dim) - CCMIOReadNodei(err, field->node, kFieldTypeName, (int *)dim); - - return(*err); - } -} - -CCMIOError CCMIOReadField( CCMIOError *err, CCMIOID field, char *name, - char *shortName, CCMIODimensionality *dim, - CCMIODataType *datatype ) -{ - int dimensions; - if (name) name[0] = 0; - if (shortName) shortName[0] = 0; - if (dim) *dim = kCCMIODimNull; - if (datatype) *datatype = kCCMIOFloat32; - { - CHECK_ERROR(err); - - if (name) - CCMIOGetName(err, field.node, name); - if (shortName) - { - if (field.version >= 20200) - CCMIOReadOptstr(err, field, kFieldShortName, NULL, shortName); - } - CCMIOReadNodei(err, field.node, kFieldTypeName, &dimensions); - if (dim) - *dim = (CCMIODimensionality) dimensions; - if (datatype && dimensions == 1) - { - int i = 0; - CCMIONode node; - CCMIOID fieldData; - - CCMIONextEntity(err, field, kCCMIOFieldData, &i, &fieldData); - if (CCMIOGetNode(err, fieldData.node, kFieldDataName, &node) - == kCCMIONoNodeErr) - { - /* Check if this is a constant data node, and if so, - get the data type of that node instead.*/ - *err = kCCMIONoErr; - CCMIOGetNode(err, fieldData.node, kConstantDataName, &node); - } - CCMIOGetDataType(err, node, datatype); - } - else if (datatype) - /* Vectors and tensors are just pointers to scalars, so there is - no surety that each component will have the same data type.*/ - *datatype = kCCMIOUnknownType; - - return(*err); - } - -} - -CCMIOError CCMIONewProstarSet( CCMIOError *err, CCMIOID root, const char *name, - const char *longName, CCMIOID *setID ) -{ - char adfName[kCCMIOMaxStringLength + 1]; - CCMIONode node; - CCMIOID parent, tmpID; - CHECK_ERROR(err); - if (!name) return(*err = kCCMIOBadParameterErr); - if (!setID) setID = &tmpID; - - strncpy(adfName, name, kCCMIOMaxStringLength); - adfName[kCCMIOMaxStringLength] = '\0'; /* Just in case */ - GetEntityParent(err, root, kCCMIOProstarSet, &parent); - if (CCMIOGetNode(NULL, parent.node, adfName, &node) == kCCMIONoErr) - CCMIODeleteNode(NULL, node); /* Get rid of the sets */ - CCMIOCreateNode(err, parent.node, TRUE, adfName, adfName, &setID->node); - if (longName) - CCMIOWriteOptstr(err, *setID, kLabelName, longName); - - return(*err); -} - -CCMIOError CCMIOGetProstarSet( CCMIOError *err, CCMIOID root, const char *name, - int *longNameSize, char *longName, - unsigned int *setsAvailableFlag, - CCMIOID *setID ) -{ - char adfName[kCCMIOMaxStringLength + 1]; - CCMIONode node; - CCMIOID parent, tmpID; - CHECK_ERROR(err); - if (!name) return(*err = kCCMIOBadParameterErr); - if (!setID) setID = &tmpID; - - strncpy(adfName, name, kCCMIOMaxStringLength); - adfName[kCCMIOMaxStringLength] = '\0'; /* Just in case */ - GetEntityParent(err, root, kCCMIOProstarSet, &parent); - MakeRootCCMIOID(root.root, setID); - CCMIOGetNode(err, parent.node, name, &setID->node); - - if (longNameSize || longName) - { - CCMIOReadOptstr(err, *setID, kLabelName, longNameSize, longName); - if (*err == kCCMIONoNodeErr) /* If no label node, use the short name */ - { - if (longName) - strncpy(longName, adfName, strlen(adfName) + 1); - if (longNameSize) - *longNameSize = strlen(adfName); - *err = kCCMIONoErr; - } - } - - if (setsAvailableFlag && *err == kCCMIONoErr) - { - *setsAvailableFlag = 0; - if (CCMIOGetNode(NULL, setID->node, kCellSetName, &node) == kCCMIONoErr) - *setsAvailableFlag |= kCCMIOCellSet; - if (CCMIOGetNode(NULL, setID->node, kVertexSetName, &node) == kCCMIONoErr) - *setsAvailableFlag |= kCCMIOVertexSet; - if (CCMIOGetNode(NULL, setID->node, kBoundarySetName, &node) == kCCMIONoErr) - *setsAvailableFlag |= kCCMIOBoundarySet; - if (CCMIOGetNode(NULL, setID->node, kBlockSetName, &node) == kCCMIONoErr) - *setsAvailableFlag |= kCCMIOBlockSet; - if (CCMIOGetNode(NULL, setID->node, kSplineSetName, &node) == kCCMIONoErr) - *setsAvailableFlag |= kCCMIOSplineSet; - if (CCMIOGetNode(NULL, setID->node, kCoupleSetName, &node) == kCCMIONoErr) - *setsAvailableFlag |= kCCMIOCoupleSet; - } - - return(*err); -} - -CCMIOError CCMIOGetEntityIndex( CCMIOError *err, CCMIOID id, int *n ) -{ - CHECK_ERROR_AND_CLEAR_PTR(err, n, 0); - - if (id.type != kCCMIOBoundaryFaces && id.type != kCCMIOCellType && - id.type != kCCMIOBoundaryRegion && id.type != kCCMIOFieldPhase && - id.type != kCCMIOProcessor) - return(*err = kCCMIOBadParameterErr); - - *n = id.id; - - return(*err); -} - -CCMIOError CCMIODeleteEntity( CCMIOError *err, CCMIOID id ) -{ - int i = 0; - CCMIOID child; - CHECK_ERROR(err); - - if (id.type == kCCMIOState) - { - ClearStateProbDef(err, id); - while(CCMIONextEntity(NULL, id, kCCMIOProcessor, &i, &child) == kCCMIONoErr) - CCMIOClearProcessor(NULL, id, child, TRUE, TRUE, TRUE, TRUE, TRUE); - } - - CacheSet(&gCache, id.type, 0); - CCMIODeleteNode(err, id.node); - if (id.type == kCCMIOBoundaryFaces) - { - int nBoundaries; - - CCMIOReadNodei(err, id.node, kNBoundariesName, &nBoundaries); - CCMIOWriteNodei(err, id.node, kNBoundariesName, nBoundaries - 1); - } - return(*err); -} - -CCMIOError CCMIONextEntity( CCMIOError *err, CCMIOID parent, CCMIOEntity type, - int *i, CCMIOID *next ) -{ - if (next) ClearCCMIOID(next); - { - char name[kCCMIOMaxStringLength + 1]; - CHECK_ERROR(err); - - GetEntityParent(err, parent, type, &parent); - - if (CCMIOGetNextChildWithLabel(err, parent.node, gTypeNames[(int)type], i, - &next->node) == kCCMIONoErr) - { - next->root = parent.root; - next->type = type; - CCMIOGetName(err, next->node, name); - next->id = ParseEntityID(name); - next->version = parent.version; - } - return(*err); - } -} - -CCMIOError CCMIOEntitySize( CCMIOError *err, CCMIOID id, CCMIOSize *n, - CCMIOIndex *max ) -{ - if (max) *max = 0; - if (n) *n = 0; - { - int nDims; - CCMIOIndex *dims; - CCMIONode node; - CHECK_ERROR(err); - - if (!(id.type == kCCMIOMap || id.type == kCCMIOVertices - || id.type == kCCMIOCells || id.type == kCCMIOInternalFaces - || id.type == kCCMIOBoundaryFaces || id.type == kCCMIOFieldData)) - return(*err); /* No array data */ - - if (id.type != kCCMIOMap) - { - int mapVal; - CCMIOReadNodei(err, id.node, kMapName, &mapVal); - CCMIOGetEntity(err, id, kCCMIOMap, mapVal, &id); - } - if (n) - { - CCMIOGetNode(err, id.node, kMapDataName, &node); - CCMIOGetDimensions(err, node, &nDims, &dims); - if (*err == kCCMIONoErr) - *n = dims[nDims - 1]; - free(dims); - } - if (max) - CCMIOReadNodei(err, id.node, kMapMaxName, (int *) max); - - return(*err); - } -} - -CCMIOError CCMIOEntityName( CCMIOError *err, CCMIOID id, char *name ) -{ - CHECK_ERROR(err); - - CCMIOGetName(err, id.node, name); - return(*err); -} - -CCMIOError CCMIOEntityLabel( CCMIOError *err, CCMIOID id, CCMIOSize *size, - char *label ) -{ - if (size) *size = 0; - if (label) *label = '\0'; - { - CHECK_ERROR(err); - - CCMIOReadOptstr(err, id, kLabelName, (int *) size, label); - if (*err == kCCMIONoNodeErr) - *err = kCCMIONoErr; - return(*err); - } -} - -CCMIOError CCMIOEntityDescription( CCMIOError *err, CCMIOID id, - CCMIOSize *size, char *desc ) -{ - if (size) *size = 0; - if (desc) *desc = '\0'; - { - CHECK_ERROR(err); - - if (CCMIOReadOptstr(NULL, id, kLabelName, (int*)size, desc) != kCCMIONoErr) - { - if (size) - *size = 0; - if (desc) - *desc = '\0'; - } - return(*err); - } -} - -CCMIOError CCMIOGetEntityNode( CCMIOError *err, CCMIOID id, CCMIONode *node ) -{ - CHECK_ERROR(err); - - *node = id.node; - return(*err); -} - -CCMIOError CCMIOEntityDataType( CCMIOError *err, CCMIOID id, - CCMIODataType *type ) -{ - CCMIONode node, dataNode; - CHECK_ERROR_AND_CLEAR_PTR(err, type, kCCMIOFloat32); - - CCMIOGetEntityNode(err, id, &node); - switch(id.type) - { - case kCCMIOVertices: - CCMIOGetNode(err, node, kVertexCoordinatesName, &dataNode); - CCMIOGetDataType(err, dataNode, type); - break; - case kCCMIOFieldData: - CCMIOGetNode(err, node, kFieldDataName, &dataNode); - CCMIOGetDataType(err, dataNode, type); - break; - default: - *type = kCCMIOInt32; - break; - } - return(*err); -} - -CCMIOError CCMIOWriteState( CCMIOError *err, CCMIOID state, - CCMIOID problemDescription, const char *description) -{ - CHECK_ERROR(err); - - if (state.type != kCCMIOState || - problemDescription.type != kCCMIOProblemDescription) - return(*err = kCCMIOBadParameterErr); - - /* Do not call ClearStateProbDef() here, otherwise it is impossible - overwrite the file in such a way that the file size stays the same */ - - CCMIOWriteNodei(err, state.node, kProblemDescriptionName, - problemDescription.id); - - if (description) - CCMIOWriteNodestr(err, state.node, kLabelName, description); - else - { - CCMIONode label; - /* Node might not exist, but if it does, delete it */ - if (CCMIOGetNode(NULL, state.node, kLabelName, &label) == kCCMIONoErr) - CCMIODeleteNode(err, label); - } - - return(*err); -} - -CCMIOError CCMIOWriteMap( CCMIOError *err, CCMIOID id, CCMIOSize n, - CCMIOIndex max, int const *data, - CCMIOIndex start, CCMIOIndex end ) -{ - static CCMIONode node; - CHECK_ERROR(err); - if (!data) return(*err = kCCMIOBadParameterErr); - - if (start == kCCMIOStart) - { - CCMIOWriteNodei(err, id.node, kMapMaxName, max); - CCMIOCreateNode(err, id.node, TRUE, kMapDataName, kMapDataName, &node); - } - /* The static declaration of node apparently is to avoid having to lookup - the created node when writing maps in chunks, but if you interleave calls - to WriteMap for different maps it will be invalid. For example if you - create one map for all cell ids and loop over regions writing chunks - of that map for the cells of each region, while also creating and - writing per-region maps in that loop, the global cell id map will be - corrupted. Per-region cell maps are necessary to write solution data - (eg, velocities only exist in fluid regions). - This fixes that problem at the cost of re-introducing the node lookup.*/ - else if (node.parent != id.node.node) - { - CCMIOGetNode(err, id.node, kMapDataName, &node); - } - - CCMIOWrite1i(err, node, n, data, start, end); - - return(*err); -} - -CCMIOError CCMIOReadMap( CCMIOError *err, CCMIOID id, int *data, - CCMIOIndex start, CCMIOIndex end ) -{ - CCMIONode node; - CHECK_ERROR(err); - if (!data) return(*err = kCCMIOBadParameterErr); - - CCMIOGetNode(err, id.node, kMapDataName, &node); - CCMIORead1i(err, node, data, start, end); - - return(*err); -} - -CCMIOError CCMIOReadVerticesCore( CCMIOError *err, CCMIOID id, - int *dims, float *scale, CCMIOID *mapID, - CCMIODataType type, void *vertices, - CCMIOIndex start, CCMIOIndex end ) -{ - if (dims) *dims = 0; - if (scale) *scale = 0.0; - if (mapID) ClearCCMIOID(mapID); - - { - int idVal; - CCMIONode node; - CHECK_ERROR(err); - - if (dims) - CCMIOReadNodei(err, id.node, kVertexDimensionName, dims); - if (scale) - CCMIOReadNodef(err, id.node, kVertexScaleFactorName, scale); - if (mapID) - { - CCMIOReadNodei(err, id.node, kMapName, &idVal); - CCMIOGetEntity(err, id, kCCMIOMap, idVal, mapID); - } - if (vertices) - { - CCMIOGetNode(err, id.node, kVertexCoordinatesName, &node); - if (type == kCCMIOFloat32) - { - if (id.version < 20300) - CCMIOOldReadf(err, node, 2, FALSE, (float *)vertices, start, end); - else - CCMIORead2f(err, node, (float *)vertices, start, end); - } - else if (type == kCCMIOFloat64) - { - if (id.version < 20300) - CCMIOOldReadd(err, node, 2, FALSE, (double *)vertices, start, end); - else - CCMIORead2d(err, node, (double *)vertices, start, end); - } - else - return(*err = kCCMIOBadParameterErr); - } - return(*err); - } -} - -CCMIOError CCMIOWriteVerticesCore( CCMIOError *err, CCMIOID id, - int dims, float scale, CCMIOID mapID, - CCMIODataType type, const void *vertices, - CCMIOIndex start, CCMIOIndex end ) -{ - static CCMIOSize n; - static CCMIONode node; - CHECK_ERROR(err); - - if (start == kCCMIOStart) - { - CCMIOWriteNodei(err, id.node, kVertexDimensionName, dims); - CCMIOWriteNodef(err, id.node, kVertexScaleFactorName, scale); - CCMIOWriteNodei(err, id.node, kMapName, mapID.id); - CCMIOCreateNode(err, id.node, TRUE, kVertexCoordinatesName, - kVertexCoordinatesName, &node); - CCMIOEntitySize(err, mapID, &n, NULL); - } - /* See comment in WriteMap */ - else if (node.parent != id.node.node) - { - CCMIOGetNode(err, id.node, kVertexCoordinatesName, &node); - CCMIOEntitySize(err, mapID, &n, NULL); - } - - if (type == kCCMIOFloat32) - CCMIOWrite2f(err, node, dims, n, (float *)vertices, start, end); - else if (type == kCCMIOFloat64) - CCMIOWrite2d(err, node, dims, n, (double *)vertices, start, end); - else - return(*err = kCCMIOBadParameterErr); - return(*err); -} - -CCMIOError CCMIOReadVerticesf( CCMIOError *err, CCMIOID id, int *dims, - float *scale, CCMIOID *mapID, float *vertices, - CCMIOIndex start, CCMIOIndex end ) -{ - return(CCMIOReadVerticesCore(err, id, dims, scale, mapID, - kCCMIOFloat32, vertices, start, end)); -} - -CCMIOError CCMIOReadVerticesd( CCMIOError *err, CCMIOID id, int *dims, - float *scale, CCMIOID *mapID, double *vertices, - CCMIOIndex start, CCMIOIndex end ) -{ - return(CCMIOReadVerticesCore(err, id, dims, scale, mapID, - kCCMIOFloat64, vertices, start, end)); -} -CCMIOError CCMIOWriteVerticesf( CCMIOError *err, CCMIOID id, int dims, - float scale, CCMIOID mapID, - const float *vertices, - CCMIOIndex start, CCMIOIndex end ) -{ - return(CCMIOWriteVerticesCore(err, id, dims, scale, mapID, - kCCMIOFloat32, vertices, start, end)); -} - -CCMIOError CCMIOWriteVerticesd( CCMIOError *err, CCMIOID id, int dims, - float scale, CCMIOID mapID, - const double *vertices, - CCMIOIndex start, CCMIOIndex end ) -{ - return(CCMIOWriteVerticesCore(err, id, dims, scale, mapID, - kCCMIOFloat64, vertices, start, end)); -} - -CCMIOError CCMIOReadCells( CCMIOError *err, CCMIOID id, CCMIOID *mapID, - int *cellTypes, CCMIOIndex start, CCMIOIndex end) -{ - if (mapID) ClearCCMIOID(mapID); - { - CCMIONode node; - CHECK_ERROR(err); - - if (mapID) - { - int idVal; - - CCMIOReadNodei(err, id.node, kMapName, &idVal); - CCMIOGetEntity(err, id, kCCMIOMap, idVal, mapID); - } - if (cellTypes) - { - CCMIOGetNode(err, id.node, kCellDataName, &node); - CCMIORead1i(err, node, cellTypes, start, end); - } - return(*err); - } -} - -CCMIOError CCMIOWriteCells( CCMIOError *err, CCMIOID id, CCMIOID mapID, - int *cellTypes, CCMIOIndex start, - CCMIOIndex end ) -{ - static CCMIOSize n; - static CCMIONode node; - CHECK_ERROR(err); - - if (start == kCCMIOStart) - { - CCMIOEntitySize(err, mapID, &n, NULL); - CCMIOWriteNodei(err, id.node, kNumCellsName, n); - CCMIOWriteNodei(err, id.node, kMapName, mapID.id); - CCMIOCreateNode(err, id.node, TRUE, kCellDataName, kCellDataName,&node); - } - /* See comment in WriteMap */ - else if (node.parent != id.node.node) - { - CCMIOGetNode(err, id.node, kCellDataName, &node); - CCMIOEntitySize(err, mapID, &n, NULL); - } - - CCMIOWrite1i(err, node, n, cellTypes, start, end); - - return(*err); -} - -CCMIOError CCMIOReadFaces( CCMIOError *err, CCMIOID entity, CCMIOEntity which, - CCMIOID *mapID, CCMIOSize *streamSize, - int *vertexStream, CCMIOIndex start, - CCMIOIndex end ) -{ - if (streamSize) *streamSize = 0; - if (mapID) ClearCCMIOID(mapID); - - { - CCMIONode node; - CHECK_ERROR(err); - if (which != kCCMIOInternalFaces && which != kCCMIOBoundaryFaces) - return(*err = kCCMIOBadParameterErr); - - if (mapID) - { - int mapIDVal; - CCMIOReadNodei(err, entity.node, kMapName, &mapIDVal); - CCMIOGetEntity(err, entity, kCCMIOMap, mapIDVal, mapID); - } - if (streamSize || vertexStream) - { - CCMIOGetNode(err, entity.node, kFacesVertexDataName, &node); - if (streamSize) - { - int nDims; - CCMIOIndex *dims; - CCMIOGetDimensions(err, node, &nDims, &dims); - *streamSize = dims[0]; - free(dims); - } - if (vertexStream) - CCMIORead1i(err, node, vertexStream, start, end); - } - - return(*err); - } -} - -CCMIOError CCMIOWriteFaces( CCMIOError *err, CCMIOID entity, - CCMIOEntity which, CCMIOID mapID, - CCMIOSize streamSize, int const *vertexStream, - CCMIOIndex start, CCMIOIndex end ) -{ - CCMIOSize nFaces; - static CCMIONode node; - CHECK_ERROR(err); - if (!vertexStream || - (which != kCCMIOInternalFaces && which != kCCMIOBoundaryFaces)) - return(*err = kCCMIOBadParameterErr); - - if (start == kCCMIOStart) - { - CCMIOEntitySize(err, mapID, &nFaces, NULL); - CCMIOWriteNodei(err, entity.node, kNumFacesName, nFaces); - CCMIOWriteNodei(err, entity.node, kMapName, mapID.id); - CCMIOCreateNode(err, entity.node, TRUE, kFacesVertexDataName, - kFacesVertexDataName, &node); - } - /* See comment in WriteMap */ - else if (node.parent != entity.node.node) - { - CCMIOGetNode(err, entity.node, kFacesVertexDataName, &node); - } - - CCMIOWrite1i(err, node, streamSize, vertexStream, start, end); - - return(*err); -} - -CCMIOError CCMIOReadFaceCells( CCMIOError *err, CCMIOID entity, - CCMIOEntity which, int *cells, - CCMIOIndex start, CCMIOIndex end ) -{ - CCMIONode node; - CHECK_ERROR(err); - if (!cells || - (which != kCCMIOInternalFaces && which != kCCMIOBoundaryFaces)) - return(*err = kCCMIOBadParameterErr); - - CCMIOGetNode(err, entity.node, kFacesCellDataName, &node); - if (which == kCCMIOInternalFaces) - { - if (entity.version < 20300) - CCMIOOldReadi(err, node, 2, FALSE, cells, start, end); - else - CCMIORead2i(err, node, cells, start, end); - } - else - CCMIORead1i(err, node, cells, start, end); - - return(*err); -} - -CCMIOError CCMIOWriteFaceCells( CCMIOError *err, CCMIOID entity, - CCMIOEntity which, CCMIOID mapID, - int const *cells, CCMIOIndex start, - CCMIOIndex end ) -{ - static CCMIOSize nFaces; - static CCMIONode node; - CHECK_ERROR(err); - if (!cells || - (which != kCCMIOInternalFaces && which != kCCMIOBoundaryFaces)) - return(*err = kCCMIOBadParameterErr); - - if (start == kCCMIOStart) - { - CCMIOEntitySize(err, mapID, &nFaces, NULL); - CCMIOCreateNode(err, entity.node, TRUE, kFacesCellDataName, - kFacesCellDataName, &node); - } - /* See comment in WriteMap */ - else if (node.parent != entity.node.node) - { - CCMIOGetNode(err, entity.node, kFacesCellDataName, &node); - CCMIOEntitySize(err, mapID, &nFaces, NULL); - } - - if (which == kCCMIOInternalFaces) - CCMIOWrite2i(err, node, 2, nFaces, cells, start, end); - else - CCMIOWrite1i(err, node, nFaces, cells, start, end); - - return(*err); -} - -CCMIOError CCMIOWriteProcessor( CCMIOError *err, CCMIOID processor, - const char *verticesFile, CCMIOID *vertices, - const char *topologyFile, CCMIOID *topology, - const char *initialFieldFile, CCMIOID *initialField, - const char *solutionFile, CCMIOID *solution ) -{ - CHECK_ERROR(err); - - if (!verticesFile) verticesFile = ""; - if (!topologyFile) topologyFile = ""; - if (!initialFieldFile) initialFieldFile = ""; - if (!solutionFile) solutionFile = ""; - - if (vertices) - { - CCMIOWriteNodestr(err, processor.node, kVerticesFileName, verticesFile); - CCMIOWriteNodei(err, processor.node, kVerticesIDName, vertices->id); - } - if (topology) - { - CCMIOWriteNodestr(err, processor.node, kTopologyFileName, topologyFile); - CCMIOWriteNodei(err, processor.node, kTopologyIDName, topology->id); - } - if (initialField) - { - CCMIOWriteNodestr(err, processor.node, kInitialFieldFileName, - initialFieldFile); - CCMIOWriteNodei(err, processor.node, kInitialFieldIDName, - initialField->id); - } - if (solution) - { - CCMIOWriteNodestr(err, processor.node, kSolutionFileName, solutionFile); - CCMIOWriteNodei(err, processor.node, kSolutionIDName, solution->id); - } - return(*err); -} - -CCMIOError ReadProcessorItem( CCMIOError *err, CCMIOID processor, CCMIOID *id, - const char *fileNodeName, const char *mapNodeName, - CCMIOEntity type ) -{ - char *name; - int idVal; - CCMIONode root; - CCMIOID rootID; - - CCMIOReadNodestr(err, processor.node, fileNodeName, &name); - if (*err == kCCMIONoNodeErr || (*err == kCCMIONoErr && strcmp(name, "") == 0)) - { - root = processor.root; - *err = kCCMIONoErr; - } - else if (*err != kCCMIONoErr) - return(*err); - else - *err = CCMIOOpen(name, kCCMIORead, &root); - free(name); - CCMIOReadNodei(err, processor.node, mapNodeName, &idVal); - MakeRootCCMIOID(root, &rootID); - CCMIOGetEntity(err, rootID, type, idVal, id); - - return(*err); -} - -CCMIOError CCMIOReadProcessor( CCMIOError *err, CCMIOID processor, - CCMIOID *vertices, CCMIOID *topology, - CCMIOID *initialField, CCMIOID *solution ) -{ - if (vertices) ClearCCMIOID(vertices); - if (topology) ClearCCMIOID(topology); - if (initialField) ClearCCMIOID(initialField); - if (solution) ClearCCMIOID(solution); - - { - CHECK_ERROR(err); - - if (vertices) - ReadProcessorItem(err, processor, vertices, kVerticesFileName, - kVerticesIDName, kCCMIOVertices); - if (topology) - ReadProcessorItem(err, processor, topology, kTopologyFileName, - kTopologyIDName, kCCMIOTopology); - if (initialField) - ReadProcessorItem(err, processor, initialField, kInitialFieldFileName, - kInitialFieldIDName, kCCMIOFieldSet); - if (solution) - ReadProcessorItem(err, processor, solution, kSolutionFileName, - kSolutionIDName, kCCMIOFieldSet); - return(*err); - } -} - -CCMIOError CCMIOReadLagrangianData( CCMIOError *err, CCMIOID lagrangian, - CCMIOID *positions, CCMIOID *solution ) -{ - if (positions) ClearCCMIOID(positions); - if (solution) ClearCCMIOID(solution); - - { - CHECK_ERROR(err); - - if (positions) - ReadProcessorItem(err, lagrangian, positions, kPositionsFileName, - kPositionsIDName, kCCMIOVertices); - if (solution) - ReadProcessorItem(err, lagrangian, solution, kSolutionFileName, - kSolutionIDName, kCCMIOFieldSet); - return(*err); - } -} - -CCMIOError CCMIOWriteLagrangianData( CCMIOError *err, CCMIOID lagrangian, - const char *positionsFile, CCMIOID *positions, - const char *solutionFile, CCMIOID *solution ) -{ - CHECK_ERROR(err); - - if (!positionsFile) positionsFile = ""; - if (!solutionFile) solutionFile = ""; - - if (positions) - { - CCMIOWriteNodestr(err, lagrangian.node, kPositionsFileName, - positionsFile); - CCMIOWriteNodei(err, lagrangian.node, kPositionsIDName, positions->id); - } - if (solution) - { - CCMIOWriteNodestr(err, lagrangian.node, kSolutionFileName, - solutionFile); - CCMIOWriteNodei(err, lagrangian.node, kSolutionIDName, solution->id); - } - return(*err); -} - -int IsProcessorEntityUsed( CCMIOError *err, CCMIOID state, CCMIOID proc, - CCMIOID *lagrangian, - const char *fileNodeName, const char *idNodeName ) -{ - char *name, *name2; - int i = 0, j, k, idVal, idVal2; - CCMIOID next, nextState, nextLagrangian; - - if (lagrangian) - { - CCMIOReadNodestr(err, lagrangian->node, fileNodeName, &name); - CCMIOReadNodei(err, lagrangian->node, idNodeName, &idVal); - } - else - { - CCMIOReadNodestr(err, proc.node, fileNodeName, &name); - CCMIOReadNodei(err, proc.node, idNodeName, &idVal); - } - while (CCMIONextEntity(NULL, state, kCCMIOState, &i, &nextState) - == kCCMIONoErr) - { - j = 0; - while (CCMIONextEntity(NULL, nextState, kCCMIOProcessor, &j, &next) - == kCCMIONoErr) - { - if (CCMIOAreNodesEqual(proc.node, next.node) && - CCMIOAreNodesEqual(proc.root, next.root)) - continue; - CCMIOReadNodestr(err, next.node, fileNodeName, &name2); - CCMIOReadNodei(err, next.node, idNodeName, &idVal2); - if (idVal == idVal2 && - ((!name && !name2) || - ((name && name2) && strcmp(name, name2) == 0))) - { - free(name); - free(name2); - return(1); - } - free(name2); - - /* Check in the Lagrangian nodes, too */ - k = 0; - while (CCMIONextEntity(NULL, next, kCCMIOLagrangianData, &k, - &nextLagrangian) == kCCMIONoErr) - { - CCMIOReadNodestr(err, nextLagrangian.node, fileNodeName,&name2); - CCMIOReadNodei(err, nextLagrangian.node, idNodeName, &idVal2); - if (idVal == idVal2 && - ((!name && !name2) || - ((name && name2) && strcmp(name, name2) ==0))) - { - free(name); - free(name2); - return(1); - } - free(name2); - } - } - } - - free(name); - return(0); -} - -CCMIOError MarkMaps( CCMIOError *err, CCMIOID anyID, CCMIONode top, int unused ) -{ - char name[kCCMIOMaxStringLength + 1]; - int i = 0, idVal; - CCMIONode child, node; - CCMIOID mapID; - CHECK_ERROR(err); - - while (CCMIOGetNextChild(NULL, top, &i, &child) == kCCMIONoErr) - { - CCMIOGetName(err, child, name); - if (strcmp(name, kMapName) == 0) - { - CCMIOReadNodei(err, top, name, &idVal); - CCMIOGetEntity(err, anyID, kCCMIOMap, idVal, &mapID); - if (unused) - CCMIOCreateNode(err, mapID.node, TRUE, kMapMarkName, kTempName, - &node); - else - if (CCMIOGetNode(NULL, mapID.node, kMapMarkName, &node) - == kCCMIONoErr) - CCMIODeleteNode(err, node); - } - else - MarkMaps(err, anyID, child, unused); - } - return(*err); -} - -CCMIOError RemoveUnusedMaps( CCMIOError *err, CCMIONode root ) -{ - int i, n; - CCMIONode node, markNode; - CCMIOID rootID, id; - CHECK_ERROR(err); - - /* The maps that are potentially unused have already been marked and their - nodes deleted (requirement). Now walk through what it left and unmark - any maps that are used. Note that the vertices and the topology are both - under the same parent, so we can save a call to GetEntityParent. */ - MakeRootCCMIOID(root, &rootID); - GetEntityParent(err, rootID, kCCMIOVertices, &id); - MarkMaps(err, rootID, id.node, FALSE); - GetEntityParent(err, rootID, kCCMIOFieldSet, &id); - MarkMaps(err, rootID, id.node, FALSE); - - /* Now walk through the maps and delete everything that is marked. - But go backwards, otherwise i will be wrong. */ - GetEntityParent(err, rootID, kCCMIOMap, &id); - CCMIOGetNumberOfChildren(err, id.node, &n); - i = n - 1; - while (CCMIOGetNextChild(NULL, id.node, &i, &node) == kCCMIONoErr) - { - if (CCMIOGetNode(NULL, node, kMapMarkName, &markNode) == kCCMIONoErr) - { - CCMIODeleteNode(err, node); - n--; - } - i -= 2; /* CCMIOGetNextChild adds one to i, so need to subtract 2 */ - } - return(*err); -} - -CCMIOError CCMIOClearProcessor( CCMIOError *err, CCMIOID state, - CCMIOID processor, - int clearVertices, int clearTopology, - int clearInitialField, int clearSolution, - int clearLagrangian ) -{ - CCMIOID id; - CHECK_ERROR(err); - - /* Update the version. This isn't entirely accurate, but if the processor - is cleared, mostly likely the whole thing will be changed. */ - CCMIOSetVersion(err, state.root, kCCMIOVersion); - state.version = kCCMIOVersion; - - if (clearVertices && !IsProcessorEntityUsed(err, state, processor, NULL, - kVerticesFileName, kVerticesIDName)) - { - ReadProcessorItem(err, processor, &id, kVerticesFileName, - kVerticesIDName, kCCMIOVertices); - if (CCMIOAreNodesEqual(state.root, id.root)) - { - MarkMaps(err, id, id.node, TRUE); - CCMIODeleteEntity(err, id); - } - else - CCMIOClose(id.root); - } - if (*err == kCCMIONoNodeErr) - *err = kCCMIONoErr; - if (clearTopology && !IsProcessorEntityUsed(err, state, processor, NULL, - kTopologyFileName, kTopologyIDName)) - { - ReadProcessorItem(err, processor, &id, kTopologyFileName, - kTopologyIDName, kCCMIOTopology); - if (CCMIOAreNodesEqual(state.root, id.root)) - { - MarkMaps(err, id, id.node, TRUE); - CCMIODeleteEntity(err, id); - } - else - CCMIOClose(id.root); - } - if (*err == kCCMIONoNodeErr) - *err = kCCMIONoErr; - if (clearInitialField && !IsProcessorEntityUsed(err, state, processor, NULL, - kInitialFieldFileName, - kInitialFieldIDName)) - { - ReadProcessorItem(err, processor, &id, kInitialFieldFileName, - kInitialFieldIDName, kCCMIOFieldSet); - if (CCMIOAreNodesEqual(state.root, id.root)) - { - MarkMaps(err, id, id.node, TRUE); - CCMIODeleteEntity(err, id); - } - else - CCMIOClose(id.root); - } - if (*err == kCCMIONoNodeErr) - *err = kCCMIONoErr; - if (clearSolution && !IsProcessorEntityUsed(err, state, processor, NULL, - kSolutionFileName, kSolutionIDName)) - { - ReadProcessorItem(err, processor, &id, kSolutionFileName, - kSolutionIDName, kCCMIOFieldSet); - if (CCMIOAreNodesEqual(state.root, id.root)) - { - MarkMaps(err, id, id.node, TRUE); - CCMIODeleteEntity(err, id); - } - else - CCMIOClose(id.root); - } - if (*err == kCCMIONoNodeErr) - *err = kCCMIONoErr; - if (clearLagrangian) - { - int i = 0; - CCMIOID lagrangian; - while (CCMIONextEntity(NULL, processor, kCCMIOLagrangianData, &i, - &lagrangian) == kCCMIONoErr) - { - if (!IsProcessorEntityUsed(err, state, processor, &lagrangian, - kSolutionFileName, kSolutionIDName)) - { - ReadProcessorItem(err, lagrangian, &id, kSolutionFileName, - kSolutionIDName, kCCMIOFieldSet); - if (CCMIOAreNodesEqual(state.root, id.root)) - { - MarkMaps(err, id, id.node, TRUE); - CCMIODeleteEntity(err, id); - } - else - CCMIOClose(id.root); - } - if (!IsProcessorEntityUsed(err, state, processor, &lagrangian, - kPositionsFileName, kPositionsIDName)) - { - ReadProcessorItem(err, lagrangian, &id, kPositionsFileName, - kPositionsIDName, kCCMIOVertices); - if (CCMIOAreNodesEqual(state.root, id.root)) - { - MarkMaps(err, id, id.node, TRUE); - CCMIODeleteEntity(err, id); - } - else - CCMIOClose(id.root); - } - } - } - if (*err == kCCMIONoNodeErr) - *err = kCCMIONoErr; - - RemoveUnusedMaps(err, state.root); - return(*err); -} - -CCMIOError CCMIOWriteMultiDimensionalFieldData( CCMIOError *err, - CCMIOID fieldID, - CCMIOComponent component, - CCMIOID componentField ) -{ - char name[kCCMIOMaxStringLength+1], componentName[kCCMIOMaxStringLength+1]; - CHECK_ERROR(err); - - sprintf(name, "%s-%d", kComponentName, (int)component); - CCMIOGetName(err, componentField.node, componentName); - CCMIOWriteNodestr(err, fieldID.node, name, componentName); - - return(*err); -} - -CCMIOError CCMIOReadMultiDimensionalFieldData( CCMIOError *err, - CCMIOID fieldID, - CCMIOComponent component, - CCMIOID *componentField ) -{ - char name[kCCMIOMaxStringLength+1], *componentName; - CHECK_ERROR(err); - if (fieldID.version < 20400) - return(*err = kCCMIOVersionErr); - if (!componentField) - return(*err = kCCMIOBadParameterErr); - - sprintf(name, "%s-%d", kComponentName, (int)component); - CCMIOReadNodestr(err, fieldID.node, name, &componentName); - ClearCCMIOID(componentField); - if (componentName) - { - CCMIONode parent, node; - - parent.node = fieldID.node.parent; - parent.parent = 0; - if (CCMIOGetNode(err, parent, componentName, &node) == kCCMIONoErr) - { - componentField->root = fieldID.root; - componentField->node = node; - componentField->id = 0; - componentField->type = kCCMIOField; - componentField->version = fieldID.version; - } - } - free(componentName); - - return(*err); -} - - -CCMIOError CCMIOWriteFieldDataCore( CCMIOError *err, CCMIOID fieldData, - CCMIOID mapID, CCMIODataLocation loc, - CCMIODataType type, int isConst, void *data, - CCMIOIndex start, CCMIOIndex end ) -{ - static CCMIOSize n; - static CCMIONode node; - CHECK_ERROR(err); - - if (isConst) - { - CCMIOWriteNodei(err, fieldData.node, kFieldDataTypeName, (int)loc); - CCMIOWriteNodei(err, fieldData.node, kMapName, mapID.id); - CCMIOEntitySize(err, mapID, &n, NULL); - if (type == kCCMIOFloat32) - CCMIOWriteOptf(err, fieldData, kConstantDataName, *(float *)data); - else if (type == kCCMIOFloat64) - CCMIOWriteOptd(err, fieldData, kConstantDataName, *(double *)data); - else - CCMIOWriteOpti(err, fieldData, kConstantDataName, *(int *)data); - node.node = 0.0; - node.parent = 0.0; - } - else - { - if (start == kCCMIOStart) - { - CCMIOWriteNodei(err, fieldData.node, kFieldDataTypeName, (int)loc); - CCMIOWriteNodei(err, fieldData.node, kMapName, mapID.id); - CCMIOEntitySize(err, mapID, &n, NULL); - CCMIOCreateNode(err, fieldData.node, TRUE, kFieldDataName, - kFieldDataName, &node); - } - /* See comment in WriteMap */ - else if (node.parent != fieldData.node.node) - { - CCMIOGetNode(err, fieldData.node, kFieldDataName, &node); - CCMIOEntitySize(err, mapID, &n, NULL); - } - - if (type == kCCMIOFloat32) - CCMIOWrite1f(err, node, n, (float *)data, start, end); - else if (type == kCCMIOFloat64) - CCMIOWrite1d(err, node, n, (double *)data, start, end); - else - CCMIOWrite1i(err, node, n, (int *)data, start, end); - } - - return(*err); -} - -void memfill(unsigned char *dest, unsigned char *src, - int nSrcBytes, int nDestCopies) -{ - int i, j; - - for (i = 0; i < nDestCopies; ++i) - { - for (j = 0; j < nSrcBytes; ++j) - *(dest + j) = *(src + j); - dest += nSrcBytes; - } -} - -CCMIOError CCMIOReadFieldDataCore( CCMIOError *err, CCMIOID fieldData, - CCMIOID *mapID, CCMIODataLocation *loc, - CCMIODataType type, void *data, - CCMIOIndex start, CCMIOIndex end ) -{ - int isOld = (fieldData.version < 20300); - int isOldVector = (fieldData.version < 20400); - CCMIONode node; - CCMIOID map; - CHECK_ERROR(err); - - if (loc) - CCMIOReadNodei(err, fieldData.node, kFieldDataTypeName, (int *)loc); - - CCMIOReadNodei(err, fieldData.node, kMapName, &map.id); - CCMIOGetEntity(err, fieldData, kCCMIOMap, map.id, &map); - if (mapID) - *mapID = map; - - if (data) - { - if (CCMIOGetNode(err, fieldData.node, kFieldDataName, &node) - == kCCMIONoNodeErr) - { - int n; - CCMIOIndex nItems; - - *err = kCCMIONoErr; - CCMIOEntitySize(err, map, &nItems, NULL); - if (end == 0 || end > nItems) - end = nItems; - n = end - start; - - type = kCCMIOFloat32; - CCMIOGetOptInfo(err, fieldData, kConstantDataName, &type, - NULL, NULL, NULL); - if (type == kCCMIOFloat32) - { - float value; - CCMIOReadOptf(err, fieldData, kConstantDataName, &value); - memfill((unsigned char *) data, (unsigned char *) &value, - CCMIOGetDataTypeSize(type), n); - } - else if (type == kCCMIOFloat64) - { - double value; - CCMIOReadOptd(err, fieldData, kConstantDataName, &value); - memfill((unsigned char *) data, (unsigned char *) &value, - CCMIOGetDataTypeSize(type), n); - } - else - { - int value; - CCMIOReadOpti(err, fieldData, kConstantDataName, &value); - memfill((unsigned char *) data, (unsigned char *) &value, - CCMIOGetDataTypeSize(type), n); - } - } - else if (*err == kCCMIONoNodeErr && fieldData.version >= 20400) - return(*err = kCCMIOVersionErr); - else - { - int nDims = 1; - CCMIOIndex *dims; - if (isOldVector) - { - CCMIOGetDimensions(err, node, &nDims, &dims); - free(dims); - } - switch (nDims) - { - case 1: - { - if (type == kCCMIOFloat32) - CCMIORead1f(err, node, (float *)data, start, end); - else if (type == kCCMIOFloat64) - CCMIORead1d(err, node, (double *)data, start, end); - else - CCMIORead1i(err, node, (int *)data, start, end); - } - break; - case 2: - { - if (type == kCCMIOFloat32) - { - if (isOld) - CCMIOOldReadf(err, node, 2, FALSE, (float *)data, - start, end); - else - CCMIORead2f(err, node, (float *)data, start, end); - } - else if (type == kCCMIOFloat64) - { - if (isOld) - CCMIOOldReadd(err, node, 2, FALSE, (double *)data, - start, end); - else - CCMIORead2d(err, node, (double *)data, start, end); - } - else - { - if (isOld) - CCMIOOldReadi(err, node, 2, FALSE, (int *)data, - start, end); - else - CCMIORead2i(err, node, (int *)data, start, end); - } - } - break; - case 3: - { - if (type == kCCMIOFloat32) - { - if (isOld) - CCMIOOldReadf(err, node, 3, FALSE, (float *)data, - start, end); - else - CCMIORead3f(err, node, (float *)data, start, end); - } - else if (type == kCCMIOFloat64) - { - if (isOld) - CCMIOOldReadd(err, node, 3, FALSE, (double *)data, - start, end); - else - CCMIORead3f(err, node, (float *)data, start, end); - } - else - { - if (isOld) - CCMIOOldReadi(err, node, 3, FALSE, (int *)data, - start, end); - else - CCMIORead3f(err, node, (float *)data, start, end); - } - break; - } - } - } - } - return(*err); -} - -CCMIOError CCMIOWriteFieldDataf( CCMIOError *err, CCMIOID fieldData, - CCMIOID mapID, CCMIODataLocation loc, - float *data, CCMIOIndex start, - CCMIOIndex end ) -{ - return(CCMIOWriteFieldDataCore(err, fieldData, mapID, loc, kCCMIOFloat32, - FALSE, data, start, end)); -} - -CCMIOError CCMIOWriteFieldDatad( CCMIOError *err, CCMIOID fieldData, - CCMIOID mapID, CCMIODataLocation loc, - double *data, CCMIOIndex start, - CCMIOIndex end ) -{ - return(CCMIOWriteFieldDataCore(err, fieldData, mapID, loc, kCCMIOFloat64, - FALSE, data, start, end)); -} - -CCMIOError CCMIOWriteFieldDatai( CCMIOError *err, CCMIOID fieldData, - CCMIOID mapID, CCMIODataLocation loc, - int *data, CCMIOIndex start, - CCMIOIndex end ) -{ - return(CCMIOWriteFieldDataCore(err, fieldData, mapID, loc, kCCMIOInt32, - FALSE, data, start, end)); -} - -CCMIOError CCMIOWriteConstantFieldDataf( CCMIOError *err, CCMIOID fieldData, - CCMIOID mapID, CCMIODataLocation loc, - float value ) -{ - return(CCMIOWriteFieldDataCore(err, fieldData, mapID, loc, kCCMIOFloat32, - TRUE, &value, kCCMIOStart, kCCMIOEnd)); -} - -CCMIOError CCMIOWriteConstantFieldDatad( CCMIOError *err, CCMIOID fieldData, - CCMIOID mapID, CCMIODataLocation loc, - double value ) -{ - return(CCMIOWriteFieldDataCore(err, fieldData, mapID, loc, kCCMIOFloat64, - TRUE, &value, kCCMIOStart, kCCMIOEnd)); -} - -CCMIOError CCMIOWriteConstantFieldDatai( CCMIOError *err, CCMIOID fieldData, - CCMIOID mapID, CCMIODataLocation loc, - int value ) -{ - return(CCMIOWriteFieldDataCore(err, fieldData, mapID, loc, kCCMIOInt32, - TRUE, &value, kCCMIOStart, kCCMIOEnd)); -} - -CCMIOError CCMIOReadFieldDataf( CCMIOError *err, CCMIOID fieldData, - CCMIOID *mapID, CCMIODataLocation *loc, - float *data, CCMIOIndex start, - CCMIOIndex end ) -{ - return(CCMIOReadFieldDataCore(err, fieldData, mapID, loc, kCCMIOFloat32, - data, start, end)); -} - -CCMIOError CCMIOReadFieldDatad( CCMIOError *err, CCMIOID fieldData, - CCMIOID *mapID, CCMIODataLocation *loc, - double *data, CCMIOIndex start, - CCMIOIndex end ) -{ - return(CCMIOReadFieldDataCore(err, fieldData, mapID, loc, kCCMIOFloat64, - data, start, end)); -} - -CCMIOError CCMIOReadFieldDatai( CCMIOError *err, CCMIOID fieldData, - CCMIOID *mapID, CCMIODataLocation *loc, - int *data, CCMIOIndex start, - CCMIOIndex end ) -{ - return(CCMIOReadFieldDataCore(err, fieldData, mapID, loc, kCCMIOInt32, - data, start, end)); -} - -CCMIOError CCMIOWriteRestartInfo( CCMIOError *err, CCMIOID restartInfo, - const char *solverName, int iteration, - float time, const char *timeUnits, - float startAngle ) -{ - CHECK_ERROR(err); - if (!solverName) return(*err = kCCMIOBadParameterErr); - - CCMIOWriteOptstr(err, restartInfo, kSolverName, solverName); - CCMIOWriteOpti(err, restartInfo, kIterationName, iteration); - CCMIOWriteOptf(err, restartInfo, kTimeName, time); - if (timeUnits) - CCMIOWriteOptstr(err, restartInfo, kTimeUnitsName, timeUnits); - else - CCMIOWriteOptstr(err, restartInfo, kTimeUnitsName, kDefaultTimeUnits); - CCMIOWriteOptf(err, restartInfo, kStartAngleName, startAngle); - - return(*err); -} - -CCMIOError CCMIOReadRestartInfo( CCMIOError *err, CCMIOID restartInfo, - char *solverName, int *iteration, - float *time, char *timeUnits, - float *startAngle ) -{ - int size; - char *tmpStr; - CHECK_ERROR(err); - - if (solverName) - { - solverName[0] = '\0'; - CCMIOReadOptstr(NULL, restartInfo, kSolverName, &size, NULL); - tmpStr = (char*) malloc(size + 1); - CCMIOReadOptstr(NULL, restartInfo, kSolverName, NULL, tmpStr); - strncpy(solverName, tmpStr, kCCMIOMaxStringLength); - solverName[kCCMIOMaxStringLength] = '\0'; - free(tmpStr); - } - - if (iteration && CCMIOReadOpti(err, restartInfo, kIterationName, iteration) - != kCCMIONoErr) - *iteration = 0; - - if (time && CCMIOReadOptf(err, restartInfo, kTimeName, time) != kCCMIONoErr) - *time = 0.0; - - if (startAngle && - CCMIOReadOptf(err, restartInfo, kStartAngleName, startAngle) - != kCCMIONoErr) - *startAngle = 0.0; - - if (timeUnits) - { - timeUnits[0] = '\0'; - CCMIOReadOptstr(NULL, restartInfo, kTimeUnitsName, &size, NULL); - tmpStr = (char*) malloc(size + 1); - CCMIOReadOptstr(NULL, restartInfo, kTimeUnitsName, NULL, tmpStr); - strncpy(timeUnits, tmpStr, kCCMIOMaxStringLength); - timeUnits[kCCMIOMaxStringLength] = '\0'; - free(tmpStr); - } - - return(*err); -} - - - - -/* I changed this routine to include a parameter for the number of faces to - * speed it up so that there isn't a database read for every buffer write. - * WRO 22-Oct-2004 */ - -CCMIOError CCMIOV2WriteFaceCells( CCMIOError *err, CCMIOID entity, - CCMIOEntity which, - CCMIOSize nFaces, int const *cells, - CCMIOIndex start, CCMIOIndex end ) -{ - static CCMIONode node; - CHECK_ERROR(err); - if (!cells || - (which != kCCMIOInternalFaces && which != kCCMIOBoundaryFaces)) - return(*err = kCCMIOBadParameterErr); - - if (start == kCCMIOStart) - { - CCMIOCreateNode(err, entity.node, TRUE, kFacesCellDataName, - kFacesCellDataName, &node); - } - - if (which == kCCMIOInternalFaces) - CCMIOWrite2i(err, node, 2, nFaces, cells, start, end); - else - CCMIOWrite1i(err, node, nFaces, cells, start, end); - - return(*err); -} - - - -/* Include the CCMIORead*() functions. This uses #defines to accomplish - template functions. */ -#define TYPE int -#define TYPE_ABBREV i -#define CCMIOTYPE kCCMIOInt32 -#include "ccmioread.c" -#undef TYPE /* Prevents redefinition warnings */ -#undef TYPE_ABBREV -#undef CCMIOTYPE - -#define TYPE float -#define TYPE_ABBREV f -#define CCMIOTYPE kCCMIOFloat32 -#include "ccmioread.c" -#undef TYPE /* Prevents redefinition warnings */ -#undef TYPE_ABBREV -#undef CCMIOTYPE - -#define TYPE double -#define TYPE_ABBREV d -#define CCMIOTYPE kCCMIOFloat64 -#include "ccmioread.c" - -#ifdef __cplusplus -} -#endif -#endif /* CCMIO_C */ - - -/* Automatic setting of emacs local variables. */ -/* Local Variables: */ -/* mode: C++ */ -/* tab-width: 8 */ -/* End: */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmio.cpp b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmio.cpp deleted file mode 100644 index be66be1c4e..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmio.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// hack for starccm+. the source is already c++ compatibile - -#include "ccmio.c" -#include "ccmiocore.c" -#include "ccmioprivate.c" -#include "ccmioutility.c" -#include "ccmioversion.c" -#include "vector.c" diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmio.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmio.h deleted file mode 100644 index b8b6d557c7..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmio.h +++ /dev/null @@ -1,1079 +0,0 @@ -#ifndef CCMIO_H -#define CCMIO_H - -/*@@ - * Program: Star File Format Library - $RCSfile: ccmio.h,v $ - * Author: Geoff Prewett - * Date: July 28, 2003 - * - * - * Star File Format Library - Copyright (C) 2003 by adapco, Ltd. - * - * This program is the property of adapco, Ltd. and contains - * confidential and proprietary information. The unauthorized use, - * distribution, or duplication of this program is prohibited. - * All rights reserved. - * - * $Id: ccmio.h,v 1.18 2006/06/05 21:12:16 geoffp Exp $ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "libccmio/ccmiotypes.h" - -/* \{ \name Basic functions - \ingroup intermediate */ - -/** Opens an CCMIO file. Calling CCMIOOpenFile() multiple times on a file does - not create multiple references to it; thus if CCMIOOpenFile() is called - five times on the same file, only one CCMIOCloseFile() is required. */ -extern CCMIOError CCMIOOpenFile( CCMIOError *err, char const *file, - CCMIOIOType mode, CCMIOID *root ); - -/** Closes all references to the CCMIO file. Closing an already closed file - generates a kCCMIOBadParameterErr. */ -extern CCMIOError CCMIOCloseFile( CCMIOError *err, CCMIOID root ); - -/** Returns the version number of the file. */ -extern CCMIOError CCMIOGetVersion( CCMIOError *err, CCMIONode root, - int *version ); - -/** Sets the version number of the file. */ -extern CCMIOError CCMIOSetVersion( CCMIOError *err, CCMIONode root, - int version ); - -/** Returns the title of the file. Note that the returned string is allocated - by the library and must be freed by the user. It is null-terminated. */ -extern CCMIOError CCMIOGetTitle( CCMIOError *err, CCMIONode root, char **title ); - -/** Sets the title of the file. The string must be null-terminated. */ -extern CCMIOError CCMIOSetTitle( CCMIOError *err, CCMIONode root, - char const *title ); - -/* \} */ -/* \{ \name Functions for Optional Nodes - \ingroup intermediate */ - -/** Creates a child node of parent with given name and scalar value. - If the node already exists it will be overwritten. - \param parent The parent entity. - \param name Name of the child node. - \param value Scalar value to be written. */ -extern CCMIOError CCMIOWriteOpti( CCMIOError *err, CCMIOID parent, - char const *name, int value ); - -/** Creates a child node of parent with given name and scalar value. - If the node already exists it will be overwritten. - \param parent The parent entity. - \param name Name of the child node. - \param value Scalar value to be written. */ -extern CCMIOError CCMIOWriteOptf( CCMIOError *err, CCMIOID parent, - char const *name, float value ); - -/** Creates a child node of parent with given name and scalar value. - If the node already exists it will be overwritten. - \param parent The parent entity. - \param name Name of the child node. - \param value Scalar value to be written. */ -extern CCMIOError CCMIOWriteOptd( CCMIOError *err, CCMIOID parent, - char const *name, double value ); - -/** Creates a child node of parent with given name and string value. - If the node already exists it will be overwritten. - \param parent The parent entity. - \param name Name of the child node. - \param value Null-terminated string. */ -extern CCMIOError CCMIOWriteOptstr( CCMIOError *err, CCMIOID parent, - char const *name, char const *value ); - -/** Reads the scalar value of a child node; converts to an integer - if the type of the node is not \def kCCMIOInt32. - \param parent The parent entity. - \param name Name of the child node. - \param value Pointer to the scalar data to be read in. */ -extern CCMIOError CCMIOReadOpti( CCMIOError *err, CCMIOID parent, - char const *name, int *value ); - -/** Reads the scalar value of a child node; converts to an float - if the type of the node is not \def kCCMIOFloat32. - \param parent The parent entity. - \param name Name of the child node. - \param value Pointer to the scalar data to be read in. */ -extern CCMIOError CCMIOReadOptf( CCMIOError *err, CCMIOID parent, - char const *name, float *value ); - -/** Reads the scalar value of a child node; converts to an double - if the type of the node is not \def kCCMIOFloat64. - \param parent The parent entity. - \param name Name of the child node. - \param value Pointer to the scalar data to be read in. */ -extern CCMIOError CCMIOReadOptd( CCMIOError *err, CCMIOID parent, - char const *name, double *value ); - -/** Reads the string value of a child node; returns \def kCCMIOWrongDataTypeErr - if the type of the node is not \def kCCMIOString. 'value' must previously - be allocated to an appropriate size. (This can be determined by calling - the function once and passing NULL for 'value'. 'size' does not include - the C string terminator.). Either 'size' or 'value' can be NULL. */ -extern CCMIOError CCMIOReadOptstr( CCMIOError *err, CCMIOID parent, - char const *name, int *size, char *value ); - -/** Reads a one-dimensional array from the child node of 'parent' - with name 'name' into 'data'. See CCMIOReadOpt1f() for a complete - description. */ -extern CCMIOError CCMIOReadOpt1i( CCMIOError *err, CCMIOID parent, - char const *name, int *data, - CCMIOIndex start, CCMIOIndex end ); -/** Reads a one-dimensional array from the child node of 'parent' - with name 'name' into 'data'. 'data' must be the proper size - (which can be determined with CCMIOGetDimensions()). If actual node data is - stored in a different format than requested (i.e. float or double), it will - be converted. - \param parent The parent entity. - \param name Name of the child node. - \param data Data to be read into. Must be non-NULL. */ -extern CCMIOError CCMIOReadOpt1f( CCMIOError *err, CCMIOID parent, - char const *name, float *data, - CCMIOIndex start, CCMIOIndex end ); -/** Reads a one-dimensional array from the child node of 'parent' - with name 'name' into 'data'. See CCMIOReadOpt1f() for a complete - description. */ -extern CCMIOError CCMIOReadOpt1d( CCMIOError *err, CCMIOID parent, - char const *name, double *data, - CCMIOIndex start, CCMIOIndex end ); -/** Reads a two-dimensional array from the child node of 'parent' - with name 'name' into 'data'. See CCMIOReadOpt2f() for a complete - description. */ -extern CCMIOError CCMIOReadOpt2i( CCMIOError *err, CCMIOID parent, - char const *name, int *data, - CCMIOIndex start, CCMIOIndex end ); -/** Reads a two-dimensional array from the child node of 'parent' - with name 'name' into 'data'. 'data' must be the proper size - (which can be determined with CCMIOGetDimensions()). If actual node data is - stored in a different format than requested (i.e. float or double), it will - be converted. - \param parent The parent entity. - \param name Name of the child node. - \param data Data to be read into. Must be non-NULL. - \param start The offset of the element pointed to by 'data'. Must - Be in units of of the first element; so if - float data[10][3]; - then start can be in the range [0, 9]. - \param end The element one beyond the end. So to read from [2, 5], - start = 2, end = 6, which reads from data[2][0] - to data[5][3]. */ -extern CCMIOError CCMIOReadOpt2f( CCMIOError *err, CCMIOID parent, - char const *name, float *data, - CCMIOIndex start, CCMIOIndex end ); -/** Reads a two-dimensional array from the child node of 'parent' - with name 'name' into 'data'. See CCMIOReadOpt2f() for a complete - description. */ -extern CCMIOError CCMIOReadOpt2d( CCMIOError *err, CCMIOID parent, - char const *name, double *data, - CCMIOIndex start, CCMIOIndex end ); -/** Reads a three-dimensional array from the child node of 'parent' - with name 'name' into 'data'. See CCMIOReadOpt3f() for a complete - description. */ -extern CCMIOError CCMIOReadOpt3i( CCMIOError *err, CCMIOID parent, - char const *name, int *data, - CCMIOIndex start, CCMIOIndex end ); -/** Reads a three-dimensional array from the child node of 'parent' - with name 'name' into 'data'. 'data' must be the proper size - (which can be determined with CCMIOGetDimensions()). If actual node data is - stored in a different format than requested (i.e. float or double), it will - be converted. - \param parent The parent entity. - \param name Name of the child node. - \param data Data to be read into. Must be non-NULL. - \param start The offset of the element pointed to by 'data'. Must - Be in units of of the first element; so if - float data[10][3][3]; - then start can be in the range [0, 9]. - \param end The element one beyond the end. So to read from [2, 5], - start = 2, end = 6, which reads from data[2][0][0] - to data[5][3][3]. */ -extern CCMIOError CCMIOReadOpt3f( CCMIOError *err, CCMIOID parent, - char const *name, float *data, - CCMIOIndex start, CCMIOIndex end ); -/** Reads a three-dimensional array from the child node of 'parent' - with name 'name' into 'data'. See CCMIOReadOpt3f() for a complete - description. */ -extern CCMIOError CCMIOReadOpt3d( CCMIOError *err, CCMIOID parent, - char const *name, double *data, - CCMIOIndex start, CCMIOIndex end ); - -/** Writes a one-dimensional array to a child node of 'parent' with name 'name'. - See CCMIOWriteOpt1f() for a complete description. */ -extern CCMIOError CCMIOWriteOpt1i( CCMIOError *err, CCMIOID const parent, - char const *name, CCMIOSize const n, - int const *data, - CCMIOIndex start, CCMIOIndex end ); -/** Writes a one-dimensional array to a child node of 'parent' with name 'name'. - If the child node does not exist it will be created and in either case its - size and data type will be automatically set to the proper values. - \param parent The parent entity. - \param name Name of the child node. - \param n The total number of elements to be written. - If not writing the entire array this is the number - of elements that will be ultmately be written. - \param data The data to be written. - \param start When writing partial arrays, where to start writing. - \param end When writing partial arrays, where to stop writing. - (The write will be from data[start] to data[start-1]) - Note: When writing partial arrays, the first block of the array you - write must have start equal to kCCMIOStart. */ -extern CCMIOError CCMIOWriteOpt1f( CCMIOError *err, CCMIOID parent, - char const *name, CCMIOSize n, - float const *data, - CCMIOIndex start, CCMIOIndex end ); -/** Writes a one-dimensional array to a child node of 'parent' with name 'name'. - See CCMIOWriteOpt1f() for a complete description. */ -extern CCMIOError CCMIOWriteOpt1d( CCMIOError *err, CCMIOID parent, - char const *name, CCMIOSize n, - double const *data, - CCMIOIndex start, CCMIOIndex end ); -/** Writes a two-dimensional array to a child node of 'parent' with name 'name'. - See CCMIOWriteOpt2f() for a complete description. */ -extern CCMIOError CCMIOWriteOpt2i( CCMIOError *err, CCMIOID const parent, - char const *name, CCMIOIndex x, CCMIOIndex y, - int const *data, - CCMIOIndex start, CCMIOIndex end ); -/** Writes a two-dimensional array to a child node of 'parent' with name 'name'. - If the child node does not exist it will be created and in either case its - size and data type will be automatically set to the proper values. - 'data' is expected to be an array of data[x][y] elements. Note that - although the CCM specification specifies dimension in FORTRAN ordering, - the API expects C ordering. Thus a C array data[x][y] must be called - as CCMIOWriteOpt2f(..., x, y, ...), even though the dimensions will be - reversed on disk. - \param parent The parent node. - \param name Name of the child entity. - \param x The size of the first C dimension. - \param y The size of the second C dimension. - \param data The data to be written. - \param start The offset of the element pointed to by 'data'. Must - Be in units of of the first element; so if - float data[10][3]; - then start can be in the range [0, 9]. - \param end The element one beyond the end. So to write from [2, 5], - start = 2, end = 6, which writes from data[2][0] - to data[5][3]. - Note: When writing partial arrays, the first block of the array you - write must have start equal to kCCMIOStart. */ -extern CCMIOError CCMIOWriteOpt2f( CCMIOError *err, CCMIOID parent, - char const *name, CCMIOIndex x, CCMIOIndex y, - float const *data, - CCMIOIndex start, CCMIOIndex end ); -/** Writes a two-dimensional array to a child node of 'parent' with name 'name'. - See CCMIOWriteOpt2f() for a complete description. */ -extern CCMIOError CCMIOWriteOpt2d( CCMIOError *err, CCMIOID parent, - char const *name, CCMIOIndex x, CCMIOIndex y, - double const *data, - CCMIOIndex start, CCMIOIndex end ); -/** Writes a three-dimensional array to a child node of 'parent' with name - 'name'. See CCMIOWriteOpt3f() for a complete description. */ -extern CCMIOError CCMIOWriteOpt3i( CCMIOError *err, CCMIOID parent, - char const *name, - CCMIOIndex x, CCMIOIndex y, CCMIOIndex z, - int const *data, - CCMIOIndex start, CCMIOIndex end ); -/** Writes a three-dimensional array to a child node of 'parent' with name - 'name'. If the child node does not exist it will be created and in either - case its size and data type will be automatically set to the proper values. - 'data' is expected to be an array of data[x][y] elements. Note that - although the CCM specification specifies dimension in FORTRAN ordering, - the API expects C ordering. Thus a C array data[x][y] must be called - as CCMIOWriteOpt3f(..., x, y, z, ...), even though the dimensions will be - reversed on disk. - \param parent The parent node. - \param name Name of the child entity. - \param isC TRUE if 'data' is in C array order, - FALSE if in Fortran array order. - \param x The size of the first dimension. - \param y The size of the second dimension. - \param z The size of the third dimension. - \param data The data to be written. - \param start The offset of the element pointed to by 'data'. Must - be in units of of the first element; so if - float data[10][3][3]; - then start can be in the range [0, 9]. - \param end The element one beyond the end. So to write from [2, 5], - start = 2, end = 6, which writes from data[2][0][0] - to data[5][3][3]. - Note: When writing partial arrays, the first block of the array you - write must have start equal to kCCMIOStart. */ -extern CCMIOError CCMIOWriteOpt3f( CCMIOError *err, CCMIOID parent, - char const *name, - CCMIOIndex x, CCMIOIndex y, CCMIOIndex z, - float const *data, CCMIOIndex start, - CCMIOIndex end ); -/** Writes a three-dimensional array to a child node of 'parent' with name - 'name'. See CCMIOWriteOpt3f() for a complete description. */ -extern CCMIOError CCMIOWriteOpt3d( CCMIOError *err, CCMIOID parent, - char const *name, - CCMIOIndex x, CCMIOIndex y, CCMIOIndex z, - double const *data, CCMIOIndex start, - CCMIOIndex end ); - -/** Returns information about the optional node. - \param parant The parent node. - \param name Name of the child entity. - \param type Returns the data type of the child. Can be NULL if - the information is not desired. - \param x Returns the size of the first dimension (1 if the - node is a scalar). Can be NULL. - \param y Returns the size of the third dimension (0 if the - node is one dimensional). Can be NULL. - \param z Returns the size of the first dimension (0 if the - node is less than three dimensions). Can be NULL. */ -extern CCMIOError CCMIOGetOptInfo( CCMIOError *err, CCMIOID parent, - char const *name, CCMIODataType *type, - CCMIOIndex *x, CCMIOIndex *y, - CCMIOIndex *z ); - -/* \} */ -/* \{ \name Intermediate API - \ingroup intermediate */ - -/** Marks the entity as invalid. Further CCMIO calls will fail, until - a call (such as CCMIOGetEntity()) writes a valid entity into it. */ -extern void CCMIOInvalidateEntity( CCMIOID *entity ); - -/** Returns TRUE if the entity is valid, FALSE otherwise. Note that - unitialized entities will likely return TRUE, even though they are not - actually valid. Use CCMIOInvalidateEntity() to initialize them. */ -extern int CCMIOIsValidEntity( CCMIOID entity ); - -/** Returns TRUE if the two entities are from the same file, - FALSE otherwise. */ -extern int CCMIOIsFromSameFile( CCMIOID entity1, CCMIOID entity2 ); - -/** Creates a new entity. - \param parent For top-level entities this may be any CCMIOID in the same - file, but for child entities this must be the actual - parent. - \param type The type of entity to be created. - \param description An optional description of the entity. Passing NULL - will omit a description. - \param id The CCMIOID of the created entity. */ -extern CCMIOError CCMIONewEntity( CCMIOError *err, CCMIOID parent, - CCMIOEntity type, char const *description, - CCMIOID *id ); - -/** Retrieves an entity. Although it is mostly an internal function, it is - necessary for retrieving the cell and internal face entities. - \param parent For top-level entities this may be any CCMIOID in the - same file, but for child entities this must be the - actual parent. - \param type The type of entity to be retrieved. - \param idVal For entites that may have siblings, this specifies - the ID number of the entity (this is most useful - internally). For entities that may not have siblings - (e.g. cells and internal faces) this value is ignored. - \param id The CCMIOID of the created entity. */ -extern CCMIOError CCMIOGetEntity( CCMIOError *err, CCMIOID parent, - CCMIOEntity type, int idVal, CCMIOID *id ); - -/** Creates a new entity identified by an index number. - Although almost all entities are internally identified by an ID number, this - number is unimportant for most entities and is only used internally. Some - entities, however, are most easily identified with a number and for these - entities (kCCMIOBoundaryFaces, kCCMIOCellType, and kCCMIOBoundaryRegion) the - ID number is provided by the creator. The entities, called indexed - entities, can be created with this function. - \param parent The CCMIOID of the parent entity. - \param idVal The boundary ID number. - \param which May be kCCMIOBoundaryFaces, kCCMIOCellType, or - kCCMIOBoundaryRegion. - \param description An optional description (NULL for no description) - \param id The CCMIOID to the new entity. */ -extern CCMIOError CCMIONewIndexedEntity( CCMIOError *err, CCMIOID parent, - CCMIOEntity which, int idVal, - char const *description, CCMIOID *id ); - -/** Returns the index (i.e. the id) of the given indexed entity. (See - CCMIONewIndexedEntity() for more details and a list of valid entities.) */ -extern CCMIOError CCMIOGetEntityIndex( CCMIOError *err, CCMIOID id , int *n ); - -/** Creates a new state. If a state with that name exists, its contents, - including processor entities, will be cleared. - \param root The root node of the file (returned by CCMIOOpenFile()). - \param name The name of the new state (limited to - kCCMIOMaxStringLength characters, not including a - terminating NULL). - \param problemDescription The CCMIOID of the problemDescription entity - relevant to this state, or NULL if there is none. - \param state The CCMIOID of the new entity. - \param description An optional description string - (NULL for no description) */ -extern CCMIOError CCMIONewState( CCMIOError *err, CCMIOID root, - char const *name, CCMIOID *problemDescription, - char const *description, CCMIOID *state ); - -/** Retrieves a state. - \param root The root node of the file (returned by CCMIOOpenFile()). - \param name The name of the state (limited to - \def kCCMIOMaxStringLength characters, not including a - terminating NULL). - \param problemDescription Returns the CCMIOID of the problemDescription - entity relevant to this state, or an invalid entity - (check with CCMIOIsValidEntity()) if there is none. - If NULL is passed to this parameter, no - problemDescription will be looked for. - \param state The CCMIOID of the entity. */ -extern CCMIOError CCMIOGetState( CCMIOError *err, CCMIOID root, - char const *name, CCMIOID *problemDescription, - CCMIOID *state ); - -/** Writes the problem description node to the state. Note that there is - not an CCMIOReadState(); this functionality is incorporated in - CCMIOGetState(). - \param description Optional character string describing the state. - Pass NULL for no description (note that this will - remove any existing description). */ -extern CCMIOError CCMIOWriteState( CCMIOError *err, CCMIOID state, - CCMIOID problemDescription, - char const *description ); - -/** Creates a new field entity. - \param phase The FieldPhase entity. - \param name The name of the new field (limited to - \def kCCMIOMaxStringLength characters, not including a - terminating NULL). - \param shortName The short name that prostar will use. Must be - a unique string among all short names in the fieldSet. - Only the first kCCMIOProstarShortNameLength characters - will be written. - \param dim The number of dimensions (\def kCCMIOScalar, - \def kCCMIOVector, \def kCCMIOTensor). - \param field The CCMIOID of the new entity. */ -extern CCMIOError CCMIONewField( CCMIOError *err, CCMIOID phase, - char const *name, char const *shortName, - CCMIODimensionality dim, CCMIOID *field ); - -/** Retrieves a field entity. - \param phase The FieldPhase entity. - \param name The name of the field (limited to - kCCMIOMaxStringLength characters, not including a - terminating NULL). - \param dim Returns the number of dimensions - kCCMIOTensor). - \param field The CCMIOID of the field entity. */ -extern CCMIOError CCMIOGetField( CCMIOError *err, CCMIOID phase, - char const *name, CCMIODimensionality *dim, - CCMIOID *field ); - -/** Reads information about a field. Note that this does not read the \em - data of the node; use CCMIOReadFieldData(f|v|i)() for that. This is for - determining the name of the field when using CCMIONextEntity(). - \param field The CCMIOID of the field. - \param name Returns the name of the field. Must be allocated to at - least kCCMIOMaxStringLength + 1 characters. - \param shortName Returns the short name of the field. Must be allocated - to at least kCCMIOProstarShortName + 1 characters. - \param dim Returns the dimensions of the field. - \param datatype Returns the type of data. Only valid for scalar data; - Vector and tensor components are not required to be the - same data type (\ref kCCMIOUnknownType will be returned - for non-scalar data). May be NULL if the - information is not desired. */ -extern CCMIOError CCMIOReadField( CCMIOError *err, CCMIOID field, char *name, - char *shortName, CCMIODimensionality *dim, - CCMIODataType *datatype ); - -/** Creates a new prostar set. The sets can be written with CCMIOWriteOpti(). - If called on a pre-existing set, all contents of the original set will - be removed. - \param name The name of the set. This is limited to - \ref kCCMIOMaxStringLength. - \param longName The name of the set; length is not limited. - If no long name is desired, NULL may be passed here, - and the short name will be used. - \param setID The CCMIOID of the new prostar set. Can be NULL if - not desired. */ -CCMIOError CCMIONewProstarSet( CCMIOError *err, CCMIOID root, const char *name, - const char *longName, CCMIOID *setID ); - -/** Gets a prostar set. - \param name The name of the set. - \param longNameSize The size of the long name, not including the C string - terminator. Can be NULL if the size is not desired. - \param longName The long name. Can be NULL if the information is not - desired. - \param setsAvailableFlag Lists the available sets. The sets can be read - using CCMIOReadOpti(). Can be NULL if not desired. - \parma setID The CCMIOID of the prostar set. Can be NULL if not - desired. */ -CCMIOError CCMIOGetProstarSet( CCMIOError *err, CCMIOID root, const char *name, - int *longNameSize, char *longName, - unsigned int *setsAvailableFlag, - CCMIOID *setID ); - -/** Deletes the entity and all of its children. Note that deleting - a processor without calling CCMIOClearProcessor() first will not delete - entites that become unused as a result of the delete (e.g. the mesh and - post data referred to by that processor) and may lead to wasted disk space. - However, calling CCMIODeleteEntity on a state entity is safe. */ -extern CCMIOError CCMIODeleteEntity( CCMIOError *err, CCMIOID id ); - -/** Returns the next child entity of the parent or \def kCCMIONoNodeError - if there are no more. - \param parent The CCMIOID of the parent node. When iterating over - top-level entites (like a Map), any CCMIOID from the - same file may be used. - \param type The type of entity to iterator over. - \param i The counter value. This should always be set to 0 - (zero) to retrieve the first child. It will be - automatically incremented. - \param next Returns the CCMIOID of the next child entity. */ -extern CCMIOError CCMIONextEntity( CCMIOError *err, CCMIOID parent, - CCMIOEntity type, int *i, CCMIOID *next ); - -/** Returns the number of elements and the maximum element ID in the specified - entity. Either 'n' or 'max' may be NULL if the information is not - desired. */ -extern CCMIOError CCMIOEntitySize( CCMIOError *err, CCMIOID id, CCMIOSize *n, - CCMIOIndex *max ); - -/** Gets the name of the entity. Although this is not useful for most entities, - it may be convenient for named entities (kCCMIOState, kCCMIOField). - \param name Returns the name of the entity. Must be at least - kCCMIOMaxStringLength + 1. */ -extern CCMIOError CCMIOEntityName( CCMIOError *err, CCMIOID id, char *name ); - -/** Gets the label of the entity. - \deprecated Use CCMIOEntityDescription() instead. - \param size Returns the length of the label (not including a - terminating NULL). May be NULL if the information - is not required. - \param name Returns the label. Must be at least 'size' + 1 bytes. - If there is no label, this will be the empty string. - May be NULL if the information is not required. */ -extern CCMIOError CCMIOEntityLabel( CCMIOError *err, CCMIOID id, - CCMIOSize *size, char *label ); - -/** Gets the description (if any) of the specified entity. - \param size Returns the size of the string. May be NULL if the - information is not desired. - \param desc Returns the description string. This must be allocated - to at least as large as the number of characters + 1 - and may be NULL if the information is not desired. */ -extern CCMIOError CCMIOEntityDescription( CCMIOError *err, CCMIOID id, - CCMIOSize *size, char *desc ); - -/** Returns the CCMIO node corresponding to this entity. */ -extern CCMIOError CCMIOGetEntityNode( CCMIOError *err, CCMIOID id, - CCMIONode *node ); - -/** Returns the data type of the main data of the entity. Currently only - valid for vertices. */ -extern CCMIOError CCMIOEntityDataType( CCMIOError *err, CCMIOID id, - CCMIODataType *type ); - -/** Writes the map data. - \param id The CCMIOID of the map. - \param n The total number of elements to be written. - \param max The maximum element value. - \param data The map data. - \param start The offset of the starting data. - \param end The offset of the ending data. Data from start to - end - 1 will be written. If end is kCCMIOEnd, - data will be writen from 'start' to the end of the data. - - To write the whole array, set start to kCCMIOStart and end to kCCMIOEnd. - - Note: When writing partial arrays, the first block of the array you - write must have start equal to kCCMIOStart. */ -extern CCMIOError CCMIOWriteMap( CCMIOError *err, CCMIOID id, - CCMIOSize n, CCMIOSize max, - int const *data, - CCMIOIndex start, CCMIOIndex end ); - -/** Reads the map data. - \param id The CCMIOID of the map. - \param data The map data. Must be pre-allocated to the correct - number of elements (given by CCMIOEntitySize()). */ -extern CCMIOError CCMIOReadMap( CCMIOError *err, CCMIOID id, int *data, - CCMIOIndex start, CCMIOIndex end ); - -/** Reads the vertex data. - \param id The CCMIOID of the vertices. - \param dims Returns the dimensionality of the vertex (i.e. 2 or 3). - May be NULL if the information is not desired. - \param scale Returns the scaling factor. - May be NULL if the information is not desired. - \param mapID Returns the CCMIOID of the map corresponding to this - entity. May be NULL if the information is not desired. - \param vertices A two dimensional array of size [nVerts][dims]. Must be - pre-allocated to the correct size. May be NULL if - the information is not desired. - \param start The offset (in units of vertices) of the starting - vertex. - \param end The offset (in units of vertices) of the ending vertex. - Data from start to end - 1 will be read. If end is - kCCMIOEnd, data will be read from 'start' to the - end of the data.*/ -extern CCMIOError CCMIOReadVerticesf( CCMIOError *err, CCMIOID id, - int *dims, float *scale, - CCMIOID *mapID, float *vertices, - CCMIOIndex start, CCMIOIndex end ); -/** Reads the vertex data. - \param id The CCMIOID of the vertices. - \param dims Returns the dimensionality of the vertex (i.e. 2 or 3). - May be NULL if the information is not desired. - \param scale Returns the scaling factor. - May be NULL if the information is not desired. - \param mapID Returns the CCMIOID of the map corresponding to this - entity. May be NULL if the information is not desired. - \param vertices A two dimensional array of size [nVerts][dims]. Must be - pre-allocated to the correct size. May be NULL if - the information is not desired. - \param start The offset (in units of vertices) of the starting - vertex. - \param end The offset (in units of vertices) of the ending vertex. - Data from start to end - 1 will be read. If end is - kCCMIOEnd, data will be read from 'start' to the - end of the data.*/ -extern CCMIOError CCMIOReadVerticesd( CCMIOError *err, CCMIOID id, - int *dims, float *scale, - CCMIOID *mapID, double *vertices, - CCMIOIndex start, CCMIOIndex end ); -/** Writes the vertex data. - \param id The CCMIOID of the vertices. - \param dims Returns the dimensionality of the vertex (i.e. 2 or 3). - \param scale Returns the scaling factor. - \param mapID Returns the CCMIOID of the map corresponding to this - entity. - \param vertices A two dimensional array of size [nVerts][dims]. - \param start The offset (in units of vertices) of the starting - vertex. - \param end The offset (in units of vertices) of the ending - vertex. Data from start to end - 1 will be read. If - end is kCCMIOEnd, data will be written from 'start' - to the end of the data. - - To write the whole array, set start to kCCMIOStart and end to kCCMIOEnd. - - Note: When writing partial arrays, the first block of the array you - write must have start equal to zero. */ -extern CCMIOError CCMIOWriteVerticesf( CCMIOError *err, CCMIOID id, - int dims, float scale, - CCMIOID mapID, float const *vertices, - CCMIOIndex start, CCMIOIndex end ); -/** Writes the vertex data. - \param id The CCMIOID of the vertices. - \param dims Returns the dimensionality of the vertex (i.e. 2 or 3). - \param scale Returns the scaling factor. - \param mapID Returns the CCMIOID of the map corresponding to this - entity. - \param vertices A two dimensional array of size [nVerts][dims]. - \param start The offset (in units of vertices) of the starting - vertex. - \param end The offset (in units of vertices) of the ending - vertex. Data from start to end - 1 will be read. If - end is kCCMIOEnd, data will be written from 'start' - to the end of the data. - - To write the whole array, set start to kCCMIOStart and end to kCCMIOEnd. - - Note: When writing partial arrays, the first block of the array you - write must have start equal to zero. */ -extern CCMIOError CCMIOWriteVerticesd( CCMIOError *err, CCMIOID id, - int dims, float scale, - CCMIOID mapID, double const *vertices, - CCMIOIndex start, CCMIOIndex end ); - -/** Reads the cell data. - \param id The CCMIOID of the cell entity. - \param mapID Returns the CCMIOID of the map corresponding to this - entity. May be NULL if the information is not desired. - \param cellTypes Returns an array of cell type information. May be - NULL if the information is not desired. - \param start The beginning cell. - \param end The ending cell. Data from 'start' to 'end' -1 will - be read. If end is zero, data will be read from 'start' - to the end of the data. */ -extern CCMIOError CCMIOReadCells( CCMIOError *err, CCMIOID id, CCMIOID *mapID, - int *cellTypes, CCMIOIndex start, - CCMIOIndex end ); - -/** Writes the cell data - \param id The CCMIOID of the cell entity. - \param mapID The CCMIOID of the map corresponding to this entity. - \param cellTypes Returns an array of cell type information. - \param start The beginning cell. - \param end The ending cell. Data from 'start' to 'end' -1 will - be read. If end is zero, data will be written from - 'start' to the end of the data. - Note: When writing partial arrays, the first block of the array you - write must have start equal to kCCMIOStart. */ -extern CCMIOError CCMIOWriteCells( CCMIOError *err, CCMIOID id, CCMIOID mapID, - int *cellTypes, CCMIOIndex start, - CCMIOIndex end ); - -/** Reads the face data. - \param entity The face entity. - \param which Either kCCMIOInternalFaces or kCCMIOBoundaryFaces. - \param mapID Returns the CCMIOID of the map associated with these - faces. May be NULL if the information is not desired. - \param streamSize Returns the total number of elements in the - vertexStream. May be NULL if the information is not - desired. - \param vertexStream Returns the vertices in the faces in the form
- nVerts v1 v2 ... vn
- nVerts v1 v2 ... vn
-    ...

- Note that if the stream is being buffered (with - 'start' and 'end'), only a piece of the stream will - be returned, and may be in the middle of a face. - \param start The beginning element. - \param end The ending element. Data from 'start' to 'end' -1 will - be read. If end is zero, data will be read from - 'start' to the end of the data. - - To read the whole array, set start to kCCMIOStart and end to kCCMIOEnd. */ -extern CCMIOError CCMIOReadFaces( CCMIOError *err, CCMIOID entity, - CCMIOEntity which, CCMIOID *mapID, - CCMIOSize *streamSize, int *vertexStream, - CCMIOIndex start, CCMIOIndex end ); - -/** Writes the face data. See CCMIOReadFaces() for a description of the - parameters. - \param streamSize The total number of integers in the vertex stream. - \param vertexStream The stream of vertices that compose a face. This - should be in the form:
- nVerts v1 v2 ... vn
- nVerts v1 v2 ... vn
-    ...

- - Note: When writing partial arrays, the first block of the array you - write must have start equal to zero. */ -extern CCMIOError CCMIOWriteFaces( CCMIOError *err, CCMIOID entity, - CCMIOEntity which, CCMIOID mapID, - CCMIOSize streamSize, - int const *vertexStream, - CCMIOIndex start, CCMIOIndex end ); - -/** Reads the faces' cell associations with the faces. - \param entity The face entity. - \param which Either kCCMIOInternalFaces or kCCMIOBoundaryFaces. - \param mapID Returns the CCMIOID of the map associated with these - faces. May be NULL if the information is not desired. - \param cells If reading internal faces, this is a two dimensional - array with size [nFaces][2]. If reading boundary faces - it is a one dimensional array of size nFaces. Must be - pre-allocated to the correct size. May be NULL if the - information is not desired. - \param start The beginning face. - \param end The ending face. Data from 'start' to 'end' -1 will - be read. If end is zero, data will be read from - 'start' to the end of the data. - - To read the whole array, set start to kCCMIOStart and end to kCCMIOEnd. - - Note: When writing partial arrays, the first block of the array you - write must have start equal to kCCMIOStart. */ -CCMIOError CCMIOReadFaceCells( CCMIOError *err, CCMIOID entity, - CCMIOEntity which, int *cells, - CCMIOIndex start, CCMIOIndex end ); - -/** Writes the face data. See CCMIOReadFaces() for a description of the - parameters. - - Note: When writing partial arrays, the first block of the array you - write must have start equal to zero. */ -CCMIOError CCMIOWriteFaceCells( CCMIOError *err, CCMIOID entity, - CCMIOEntity which, CCMIOID mapID, - int const *cells, CCMIOIndex start, - CCMIOIndex end ); - -/** Writes the processor information. - \param processor The CCMIOID of the processor entity. - \param verticesFile The name of the file that the vertices are - stored in. NULL indicates the current file. - \param vertices The CCMIOID of the vertices entity. If NULL, - vertices information will be unchanged. - \param topologyFile The name of the file that the mesh is - stored in. NULL indicates the current file. - \param topology The CCMIOID of the mesh entity. If NULL, - mesh information will be unchanged. - \param initialFieldFile The name of the file that the inital field is - stored in. NULL indicates the current file. - \param initialField The CCMIOID of the initial field set entity. - If NULL, the initial field information will be - unchanged. - \param solutionFile The name of the file that the solution data is - stored in. NULL indicates the current file. - \param vertices The CCMIOID of the solution data field set entity. - If NULL, vertices information will be unchanged. -*/ -extern CCMIOError CCMIOWriteProcessor( CCMIOError *err, CCMIOID processor, - char const *verticesFile, CCMIOID *vertices, - char const *topologyFile, CCMIOID *topology, - char const *initialFieldFile, CCMIOID *initialField, - char const *solutionFile, CCMIOID *solution); - -/** Reads the processor information. The returned entities may be in a - a different file and this will need to be closed with CCMIOClose, but since - the node might be the root of the current file, they should not be closed - until the end. 'positions' and 'solution' may be NULL if the information - is not desired. */ -extern CCMIOError CCMIOReadProcessor( CCMIOError *err, CCMIOID processor, - CCMIOID *vertices, CCMIOID *topology, - CCMIOID *initialField, CCMIOID *solution); - -/** Clears the relevant information from the processor. If this information - is not used elsewhere, it will be removed from the file. - \param state The state that is the parent of this processor. - \param processor The processor to clear. - \param clearVertices If TRUE, vertex information will be cleared. - If FALSE, it will be untouched. - \param clearTopology If TRUE, topology information will be cleared. - If FALSE, it will be untouched. - \param clearInitialField If TRUE, initial field information will be - cleared. If FALSE, it will be untouched. - \param clearSolution If TRUE, solution post data will be cleared. - If FALSE, it will be untouched. - \param clearLagrangian If TRUE, any Lagrangian data will be cleared. - If FALSE, it will be untouched. */ -extern CCMIOError CCMIOClearProcessor( CCMIOError *err, CCMIOID state, - CCMIOID processor, - int clearVertices, int clearTopology, - int clearInitialField, int clearSolution, - int clearLagrangian ); - -/** Writes Lagrangian data. - \param positionsFile The file that contains the positions node, - NULL for this file. - \param positions The node that contains the positions. This node - must be a kCCMIOVertices node. (Vertices and - positions ultimately store the same data) This - node may be NULL if no position data is to be - written. - \param solutionFile The file containing the solution node, or - NULL for this file. - \param solution The solution node (field set entity). May be - NULL if not solution data is to be written. */ -extern CCMIOError CCMIOWriteLagrangianData( CCMIOError *err, CCMIOID lagrangian, - char const *positionsFile, - CCMIOID *positions, - char const *solutionFile, - CCMIOID *solution ); - -/** Reads the Langrangian information. The returned entities may be in a - a different file and this will need to be closed with CCMIOClose, but since - the node might be the root of the current file, they should not be closed - until the end. 'positions' and 'solution' may be NULL if the information - is not desired. */ -extern CCMIOError CCMIOReadLagrangianData( CCMIOError *err, CCMIOID lagrangian, - CCMIOID *positions, - CCMIOID *solution ); - -/** Writes one component of a vector or tensor data field. - \param fieldID The postdata field. - \param component The component (\ref kCCMIOVectorX to - \ref kCCMIOVectorZ and \ref kCCMIOTensorXX - to \ref kCCMIOTensorZZ). All components - should be specified. If a component - is not specified, the application is free - to use whatever default value it feels is - correct. - \param componentField The component field ID. */ -extern CCMIOError CCMIOWriteMultiDimensionalFieldData( CCMIOError *err, - CCMIOID fieldID, - CCMIOComponent component, - CCMIOID componentField ); - -/** Gets the field ID of one component of a vector or tensor data field. - Although applications should specify all components, if there - is a \ref kCCMIONoNodeErr reading the entity, the application - should assume that this component was not written and should use - a proper default value (presumably 0.0). If the file is from an older - version of the library that stores multiple dimensions in one node, - a \ref kCCMIOVersionErr is returned. In this case CCMIOReadFieldData*() - will read a multiple dimensional array, instead of just one component. - - \param fieldID The postdata field. - \param component The component (\ref kCCMIOVectorX to - \ref kCCMIOVectorZ and \ref kCCMIOTensorXX - to \ref kCCMIOTensorZZ). - \param componentField The component field ID. */ -extern CCMIOError CCMIOReadMultiDimensionalFieldData( CCMIOError *err, - CCMIOID fieldID, - CCMIOComponent component, - CCMIOID *componentField ); - -/** Writes scalar data for a field. Vector or tensor data should be written - as individual components and each component written with - CCMIOWriteMultiDimensionalFieldData(). Note that if - CCMIOWriteMultiDimensionalFieldData() returns a kCCMIOVersionErr, - this function will read an old-style field, which will return all components - of the array at once, so the 'data' array will need to be 3 or 9 - (depending on whether vector or tensor data is being read) times longer. - \param fieldData The CCMIOID of the field entity. - \param mapID The CCMIOID of the map corresponding to this field. - \param loc What type of data this node is (cell, vertex, face) - \param data The data. - \param start The offset of the element pointed to by 'data'. Must - Be in units of of the first element; so if - float data[10][3][3]; - then start can be in the range [0, 9]. - \param end The element one beyond the end. So to write from [2, 5], - start = 2, end = 6, which writes from data[2][0][0] - to data[5][3][3]. - - Note: When writing partial arrays, the first block of the array you - write must have start equal to kCCMIOStart. */ -extern CCMIOError CCMIOWriteFieldDataf( CCMIOError *err, CCMIOID fieldData, - CCMIOID mapID, CCMIODataLocation loc, - float *data, CCMIOIndex start, - CCMIOIndex end ); -/** Writes the data for a field. See CCMIOWriteFieldDataf() for a description - of the paramaters. */ -extern CCMIOError CCMIOWriteFieldDatad( CCMIOError *err, CCMIOID fieldData, - CCMIOID mapID, CCMIODataLocation loc, - double *data, CCMIOIndex start, - CCMIOIndex end ); - -/** Writes the data for a field. See CCMIOWriteFieldDataf() for a description - of the paramaters. */ -extern CCMIOError CCMIOWriteFieldDatai( CCMIOError *err, CCMIOID fieldData, - CCMIOID mapID, CCMIODataLocation loc, - int *data, CCMIOIndex start, - CCMIOIndex end ); - -/** Writes data for a field that is constant. Note that it is possible for - one type of data (e.g. \ref kCCMIOCellValues) to be constant and another - type to be specified. (Whether this is meaningful is another issue.) - \param fieldData The CCMIOID of the field entity. - \param mapID The CCMIOID of the map corresponding to this field. - \param loc What type of data this node is (cell, vertex, face) - \param value The constant value. */ -extern CCMIOError CCMIOWriteConstantFieldDataf( CCMIOError *err, - CCMIOID fieldData, - CCMIOID mapID, - CCMIODataLocation loc, - float value ); - -/** Writes data for a field that is constant. See - CCMIOWriteConstantFieldDataf() for a description of the parameters. */ -extern CCMIOError CCMIOWriteConstantFieldDatad( CCMIOError *err, - CCMIOID fieldData, - CCMIOID mapID, - CCMIODataLocation loc, - double value ); - -/** Writes data for a field that is constant. See - CCMIOWriteConstantFieldDataf() for a description of the parameters. */ -extern CCMIOError CCMIOWriteConstantFieldDatai( CCMIOError *err, - CCMIOID fieldData, - CCMIOID mapID, - CCMIODataLocation loc, - int value ); - -/** Reads scalar data from a field. The data is returned in single-precision - so if the original data is double-precision it will be converted. If - the data is a constant value, the entire array will be filled with that - value.

- Note: If the file pre-dates vector and tensor data being stored as - separate components (that is, if CCMIOReadMultiDimensionalArray() - returns a \ref kCCMIOVersion error), CCMIOReadFieldDataf() may be used - to read the data. If this is the case, CCMIOReadFieldDataf() will - automatically return the multidimensional data into 'data', and 'data' - must be big enough to accomodate it. - \param fieldData The CCMIOID of the field entity. - \param mapID Returns the CCMIOID of the map corresponding to this - field. May be NULL if not desired. - \param loc Returns the type of data this node is (cell, vertex, - face). May be NULL if not desired. - \param data The data, must be preallocated to [n], [n][3], - or [n][3][3] for kCCMIOScalar, kCCMIOVector, and - kCCMIOTensor data, respectively. - May be NULL if not desired. - \param start The offset of the element pointed to by 'data'. Must - Be in units of of the first element; so if - float data[10][3][3]; - then start can be in the range [0, 9]. - \param end The element one beyond the end. So to read from [2, 5], - start = 2, end = 6, which reads from data[2][0][0] - to data[5][3][3]. (Note that newer files will only - have scalar data)*/ -extern CCMIOError CCMIOReadFieldDataf( CCMIOError *err, CCMIOID fieldData, - CCMIOID *mapID, CCMIODataLocation *loc, - float *data, CCMIOIndex start, - CCMIOIndex end ); - -/** Reads the data from a field. The data is returned in double-precision - so if the original data is single-precision it will be converted. - See CCMIOReadFieldDataf() for a full description. */ -extern CCMIOError CCMIOReadFieldDatad( CCMIOError *err, CCMIOID fieldData, - CCMIOID *mapID, CCMIODataLocation *loc, - double *data, CCMIOIndex start, - CCMIOIndex end ); - -/** Reads the data from a field. The data is returned in double-precision - so if the original data is single-precision it will be converted. - See CCMIOReadFieldDataf() for a full description. */ -extern CCMIOError CCMIOReadFieldDatai( CCMIOError *err, CCMIOID fieldData, - CCMIOID *mapID, CCMIODataLocation *loc, - int *data, CCMIOIndex start, - CCMIOIndex end ); - -/** Writes the solver restart entity. - \param restartInfo The restart entity. - \param solverName The name of the solver that is writing this node. - only the first \ref kCCMIOMaxStringLength characters - are meaningful. - \param iteration The iteration number. - \param time The time (in solver units, with 0.0 being the - initial time). - \param timeUnits A string describing the units of time. If NULL, - the units default to "s". - \param startAngle The starting angle of the mesh. Should be 0.0 if - the mesh is not rotating. */ -extern CCMIOError CCMIOWriteRestartInfo( CCMIOError *err, CCMIOID restartInfo, - char const *solverName, int iteration, - float time, char const *timeUnits, - float startAngle ); - -/** Reads the solver restart entity. Any pointer may be NULL if the - information is not desired. */ -extern CCMIOError CCMIOReadRestartInfo( CCMIOError *err, CCMIOID restartInfo, - char *solverName, int *iteration, - float *time, char *timeUnits, - float *startAngle ); - - - - - /* I changed this routine to include a parameter for the number of faces to - * speed it up so that there isn't a database read for every buffer write. - * WRO 22-Oct-2004 */ - - /** \internal - Writes the face data. See CCMIOReadFaces() for a description of the - parameters. - - Note: When writing partial arrays, the first block of the array you - write must have start equal to zero. */ -extern CCMIOError CCMIOV2WriteFaceCells( - CCMIOError *err, CCMIOID entity, - CCMIOEntity which, - CCMIOSize nFace, int const *cells, - CCMIOIndex start, CCMIOIndex end ); - -/* \} */ - -#ifdef __cplusplus -} -#endif -#endif /* CCMIO_H */ - - -/* Automatic setting of emacs local variables. */ -/* Local Variables: */ -/* mode: C++ */ -/* tab-width: 8 */ -/* End: */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmio.pro b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmio.pro deleted file mode 100644 index a5b7ce9611..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmio.pro +++ /dev/null @@ -1,31 +0,0 @@ -TEMPLATE = lib -windows-vc.net:TEMPLATE = vclib -TARGET = ccmio -PATHTOSRC = ../ - -include($$PATHTOSRC/config/ccm.pro) -include(version.pro) - -HEADERS += \ - ccmio.h \ - ccmiocore.h \ - ccmiotypes.h \ - ccmioprivate.h \ - ccmioutility.h \ - vector.h \ - ccmioversion.h - -SOURCES += \ - ccmio.c \ - ccmiocore.c \ - ccmioprivate.c \ - ccmioutility.c \ - vector.c \ - ccmioversion.c - -aix64_5.1-pwr4:dll:LIBS += -L../lib/$$MK_BUILDNAME/$$RELEASEMODE -ladf -aix_5.1-pwr4:dll:LIBS += -L../lib/$$MK_BUILDNAME/$$RELEASEMODE -ladf -windows-x86-gcc:dll:LIBS += -L../lib/$$MK_BUILDNAME/$$RELEASEMODE -ladf -windows-x86:dll:LIBS += ../lib/$$MK_BUILDNAME/$$RELEASEMODE/adf501000.dll -windows-x86:dll:QMAKE_LFLAGS_RELEASE -= $$QMAKE_LFLAGS_RELEASE -windows-vc.net:INCLUDEPATH += ..\libadf diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmiocore.ADFChildrenIDs.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmiocore.ADFChildrenIDs.c deleted file mode 100644 index 2d1d63bc0a..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmiocore.ADFChildrenIDs.c +++ /dev/null @@ -1,559 +0,0 @@ -#ifndef CCMIO_CORE_C -#define CCMIO_CORE_C - -/*@@ - * Program: Star File Format Library - $RCSfile: ccmiocore.c,v $ - * Author: Geoff Prewett - * Date: July 28, 2003 - * - * - * Star File Format Library - Copyright (C) 2003 by adapco, Ltd. - * - * This program is the property of adapco, Ltd. and contains - * confidential and proprietary information. The unauthorized use, - * distribution, or duplication of this program is prohibited. - * All rights reserved. - * - * $Id: ccmiocore.c,v 1.6 2005/01/11 21:51:20 wo Exp $ - */ - -#ifndef MAKEDEPEND -#include -#include -#include -#include -#endif - -#include "libadf/ADF.h" -#include "ccmio.h" -#include "ccmiocore.h" -#include "ccmioprivate.h" -#include "ccmioversion.h" - -const char kCCMIODefaultTitle[] = ""; - -#ifdef __cplusplus -extern "C" { -#endif -/** Opens the data file. The file will be created if it does not already exist. - \param filename Name of the file to open. - \param mode Either kCCMIORead or kCCMIOWrite. - \param root Returns the root node of the file. */ -CCMIOError CCMIOOpen( const char *filename, CCMIOIOType mode, CCMIONode *root ) -{ - int ver; - ADFError adfErr; - CCMIOError err = kCCMIONoErr; - - if (!root) return(kCCMIOBadParameterErr); - - ADF_Database_Open(filename, (mode == kCCMIORead) ? "READ_ONLY" : "UNKNOWN", - "NATIVE", &root->node, &adfErr); - root->parent = root->node; - if (IsADFError(adfErr)) - return(ADFToCCMIOError(adfErr)); - - /* If there isn't a version, set one */ - if (CCMIOGetVersion(NULL, *root, &ver) != kCCMIONoErr) - { - if (mode == kCCMIORead) - return(err = kCCMIOCorruptFileErr); - CCMIOSetVersion(&err, *root, kCCMIOVersion); - CCMIOSetTitle(&err, *root, kCCMIODefaultTitle); - } - return(err); -} - -CCMIOError CCMIOClose( CCMIONode root ) -{ - ADFError adfErr; - - ADF_Database_Close(root.node, &adfErr); - return(ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOGetNode( CCMIOError *err, CCMIONode parent, const char *path, - CCMIONode *node ) -{ - char *end, *parentStr; - int size; - ADFError adfErr; - - CHECK_ERROR(err); - if (!node || !path) return(*err = kCCMIOBadParameterErr); - - if (*path == '/') /* Always make paths relative to 'parent' */ - path++; - - if ((end = strrchr(path, '/')) == NULL) - node->parent = parent.node; - else - { - size = end - path; /* The '/' will become the '\0' */ - parentStr = (char *)malloc((size + 1) * sizeof(char)); - memcpy(parentStr, path, size); - parentStr[size] = '\0'; - ADF_Get_Node_ID(parent.node, parentStr, &node->parent, &adfErr); - free(parentStr); - if (IsADFError(adfErr)) - return(*err = ADFToCCMIOError(adfErr)); - } - ADF_Get_Node_ID(parent.node, path, &node->node, &adfErr); - - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOGetNumberOfChildren( CCMIOError *err, CCMIONode parent, int *n ) -{ - ADFError adfErr; - CHECK_ERROR_AND_CLEAR_PTR(err, n, 0); - - ADF_Number_of_Children(parent.node, n, &adfErr); - return(*err = ADFToCCMIOError(adfErr)); -} - -#if 0 -CCMIOError CCMIOGetNextChild( CCMIOError *err, CCMIONode parent, int *n, - CCMIONode *child ) -{ - char name[ADF_NAME_LENGTH + 1]; - int nNodes; - ADFError adfErr; - - CHECK_ERROR(err); - if (!n || !child) return(*err = kCCMIOBadParameterErr); - - /* ADF uses FORTRAN indexing, so add 1 to *n to convert. */ - ADF_Children_Names(parent.node, *n + 1, 1, ADF_NAME_LENGTH, &nNames, name, - &adfErr); - if (nNames == 0) - return(*err = kCCMIONoNodeErr); - else if (nNames != 1) - return(*err = kCCMIOInternalErr); - if (IsADFError(adfErr)) - return(*err = ADFToCCMIOError(adfErr)); - - ADF_Get_Node_ID(parent.node, name, &child->node, &adfErr); - child->parent = parent.node; - *n += 1; - - return(*err = ADFToCCMIOError(adfErr)); -} -#else -#define kChildIDCacheSize 2048 -CCMIOError CCMIOGetNextChild( CCMIOError *err, CCMIONode parent, int *n, - CCMIONode *child ) -{ - static double parentNodeCache = 0.0; - static int nChildrenCache = 0; - static double childIDCache[kChildIDCacheSize]; - int nNodes; - ADFError adfErr; - - CHECK_ERROR(err); - if (!n || !child) return(*err = kCCMIOBadParameterErr); - if (*n < 0) return(*err = kCCMIOBadParameterErr); -// if (*n < 0) -// printf("asdf"); - - if (parentNodeCache != parent.node) - { - parentNodeCache = parent.node; - CCMIOGetNumberOfChildren(err, parent, &nChildrenCache); - if (*err != kCCMIONoErr) - return(*err); - if (nChildrenCache == 0) - return(*err = kCCMIONoNodeErr); - ADF_Children_IDs(parent.node, 1, kChildIDCacheSize, &nNodes, - &childIDCache, &adfErr); - if (IsADFError(adfErr)) - return(*err = ADFToCCMIOError(adfErr)); - } - else if (*n > kChildIDCacheSize) - return(*err = kCCMIOInternalErr); /* TODO: fix this */ - - if (*n >= nChildrenCache) - return(*err = kCCMIONoNodeErr); - child->parent = parent.node; - child->node = childIDCache[*n]; - *n += 1; - - return(*err); -} -#endif - -CCMIOError CCMIOGetName( CCMIOError *err, CCMIONode node, char *name ) -{ - ADFError adfErr; - - CHECK_ERROR_AND_CLEAR_PTR(err, name, 0); - if (!name) return(*err = kCCMIOBadParameterErr); - - *name = '\0'; /* in case of error... */ - ADF_Get_Name(node.node, name, &adfErr); - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOSetName( CCMIOError *err, CCMIONode node, const char *name ) -{ - ADFError adfErr; - - CHECK_ERROR(err); - if (!name) return(*err = kCCMIOBadParameterErr); - - ADF_Put_Name(node.parent, node.node, name, &adfErr); - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOGetLabel( CCMIOError *err, CCMIONode node, char *label ) -{ - ADFError adfErr; - - CHECK_ERROR_AND_CLEAR_PTR(err, label, 0); - - *label = '\0'; /* in case of error... */ - ADF_Get_Label(node.node, label, &adfErr); - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOSetLabel( CCMIOError *err, CCMIONode node, const char *label ) -{ - ADFError adfErr; - - CHECK_ERROR(err); - if (!label) return(*err = kCCMIOBadParameterErr); - - ADF_Set_Label(node.node, label, &adfErr); - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOCreateNode( CCMIOError *err, CCMIONode parent, int openDup, - const char *name, const char *label, - CCMIONode *node ) -{ - ADFError adfErr; - CCMIONode tmpNode; - - CHECK_ERROR(err); - if (!name) return(*err = kCCMIOBadParameterErr); - if (!node) node = &tmpNode; - - node->parent = parent.node; - ADF_Create(parent.node, name, &node->node, &adfErr); - if (adfErr == 26 && openDup) /* Duplicate node err */ - { - if (!CCMIOGetNode(err, parent, name, node)) - return(*err); - } - else if (IsADFError(adfErr)) - return(*err = ADFToCCMIOError(adfErr)); - - if (label) - ADF_Set_Label(node->node, label, &adfErr); - - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOCreateLink( CCMIOError *err, CCMIONode parent, const char *name, - const char *filename, const char *destName, - CCMIONode *node ) -{ - ADFError adfErr; - - CHECK_ERROR(err); - if (!name || !filename || !destName || !node) - return(*err = kCCMIOBadParameterErr); - - ADF_Link(parent.node, name, filename, destName, &node->node, &adfErr); - node->parent = parent.node; - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIODeleteNode( CCMIOError *err, CCMIONode node ) -{ - ADFError adfErr; - CHECK_ERROR(err); - - ADF_Delete(node.parent, node.node, &adfErr); - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIODeleteAllChildren( CCMIOError *err, CCMIONode node ) -{ - int i, n; - CCMIONode child; - CHECK_ERROR(err); - - CCMIOGetNumberOfChildren(err, node, &n); - for (i = 0; n > 0 && !(*err); ) - { - CCMIOGetNextChild(err, node, &i, &child); - CCMIODeleteNode(err, child); - i = 0; /* CCMIOGetNextChild increments this, but we want to delete - the first child each time */ - CCMIOGetNumberOfChildren(err, node, &n); - } - return(*err); -} - -CCMIOError CCMIOMoveNode( CCMIOError *err, CCMIONode node, CCMIONode newParent ) -{ - ADFError adfErr; - CHECK_ERROR(err); - - ADF_Move_Child(node.parent, node.node, newParent.node, &adfErr); - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOGetDimensions( CCMIOError *err, CCMIONode node, int *nDims, - int **dims ) -{ - ADFError adfErr; - - if (dims) *dims = NULL; - { /* CHECK_ERROR declares a variable, so it needs its own scope */ - CHECK_ERROR(err); - if (!nDims) return(*err = kCCMIOBadParameterErr); - - ADF_Get_Number_of_Dimensions(node.node, nDims, &adfErr); - if (IsADFError(adfErr)) - return(*err = ADFToCCMIOError(adfErr)); - - if (dims) - { - *dims = (int *)malloc((*nDims) * sizeof(int)); - ADF_Get_Dimension_Values(node.node, *dims, &adfErr); - } - if (adfErr == 27) /* Node has zero size, which is OK */ - return(*err); - return(*err = ADFToCCMIOError(adfErr)); - } /* end CHECK_ERROR scope */ -} - -CCMIOError CCMIOGetDataType( CCMIOError *err, CCMIONode node, - CCMIODataType *type ) -{ - char dataStr[ADF_DATA_TYPE_LENGTH + 1]; - ADFError adfErr; - - CHECK_ERROR(err); - if (!type) return(kCCMIOBadParameterErr); - - ADF_Get_Data_Type(node.node, dataStr, &adfErr); - if (IsADFError(adfErr)) - return(*err = ADFToCCMIOError(adfErr)); - *type = CCMIOGetCCMIODataType(dataStr); - - return(*err); -} - -CCMIOError CCMIOGetDataSize( CCMIOError *err, CCMIONode node, - unsigned int *bytes ) -{ - int i, n[ADF_MAX_DIMENSIONS], dims; - CCMIODataType type; - ADFError adfErr; - - CHECK_ERROR(err); - if (!bytes) return(*err = kCCMIOBadParameterErr); - - *bytes = 0; - if (CCMIOGetDataType(err, node, &type)) - return(*err); - *bytes = CCMIOGetDataTypeSize(type); - - ADF_Get_Number_of_Dimensions(node.node, &dims, &adfErr); - if (IsADFError(adfErr)) return(*err = ADFToCCMIOError(adfErr)); - - ADF_Get_Dimension_Values(node.node, n, &adfErr); - if (adfErr == 32 /* No data */ || adfErr == 27 /* Dimension is zero */) - { - *bytes = 0; - return(*err = kCCMIONoErr); - } - if (IsADFError(adfErr)) - return(*err = ADFToCCMIOError(adfErr)); - for (i = 0; i < dims; i++) - *bytes *= n[i]; - return(*err); -} - -CCMIOError CCMIOSetDataType( CCMIOError *err, CCMIONode node, - CCMIODataType type, ... ) -{ - va_list args; - CHECK_ERROR(err); - - va_start(args, type); - CCMIOvSetDataType(err, node, type, args); - va_end(args); - return(*err); -} - -CCMIOError CCMIOvSetDataType( CCMIOError *err, CCMIONode node, - CCMIODataType type, va_list args ) -{ - int n = 0, dims[ADF_MAX_DIMENSIONS + 1]; - ADFError adfErr; - - CHECK_ERROR(err); - n = ParseArgs(args, dims); - if (n == 0) - return(*err = kCCMIOBadParameterErr); - - /* ADF does not like zero-size dimensions, so empty strings need a bit - of tweaking -- set the node to dim 0, i.e. no data. */ - if (type == kCCMIOString && n == 1 && dims[0] == 0) - n = 0; - ADF_Put_Dimension_Information(node.node, CCMIOGetDataTypeADFName(type), n, - dims, &adfErr); - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOSetDataTypev( CCMIOError *err, CCMIONode node, - CCMIODataType type, int nDims, const int *dims ) -{ - int i, adfErr, dimsCopy[ADF_MAX_DIMENSIONS+1]; - CHECK_ERROR(err); - if (nDims > ADF_MAX_DIMENSIONS) return(*err = kCCMIOBadParameterErr); - - for (i = 0; i < nDims; ++i) - dimsCopy[i] = dims[i]; - -#if StoreCStyleArrays - FortranToCArray(n, dimsCopy); -#endif - /* ADF does not like zero-size dimensions, so empty strings need a bit - of tweaking -- set the node to dim 0, i.e. no data. */ - if (type == kCCMIOString && nDims == 1 && dimsCopy[0] == 0) - nDims = 0; - ADF_Put_Dimension_Information(node.node, CCMIOGetDataTypeADFName(type), nDims, - dimsCopy, &adfErr); - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOReadDataPoint( CCMIOError *err, CCMIONode node, void *data, ...) -{ - int i, n = 0; - int start[ADF_MAX_DIMENSIONS + 1], end[ADF_MAX_DIMENSIONS + 1]; - int stride[ADF_MAX_DIMENSIONS + 1]; - int nDims = 1, dim = 1, memStart = 1, memEnd = 1, memStride = 1; - va_list argp; - ADFError adfErr; - - CHECK_ERROR(err); - if (!data) return(*err = kCCMIOBadParameterErr); - - va_start(argp, data); - n = ParseArgs(argp, start); - va_end(argp); - - if (n == 0) - return(*err = kCCMIOBadParameterErr); - - for (i = 0; i < n; ++i) - { - start[i]++; /* FORTRAN arrays begin at 1 not zero */ - end[i] = start[i]; - stride[i] = 1; - } - - ADF_Read_Data(node.node, start, end, stride, nDims, &dim, &memStart, - &memEnd, &memStride, (char *) data, &adfErr); - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOReadData( CCMIOError *err, CCMIONode node, void *data, - CCMIODataType expected, int dimsExpected ) -{ - ADFError adfErr; - - CHECK_ERROR(err); - if (!data) return(*err = kCCMIOBadParameterErr); - - if (dimsExpected <= 0) /* We always expect at least one dimension,*/ - dimsExpected = 1; /* even if the dimension's size is zero */ - *err = IsSameFormat(node, expected, dimsExpected); - if (*err != kCCMIONoErr) - return(*err); - - ADF_Read_All_Data(node.node, (char *) data, &adfErr); - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOWriteDataPoint( CCMIOError *err, CCMIONode node, - void *data, ... ) -{ - int i, n = 0; - int start[ADF_MAX_DIMENSIONS + 1], end[ADF_MAX_DIMENSIONS + 1]; - int stride[ADF_MAX_DIMENSIONS + 1]; - int nDims = 1, dim = 1, memStart = 1, memEnd = 1, memStride = 1; - va_list argp; - ADFError adfErr; - - CHECK_ERROR(err); - if (!data) return(*err = kCCMIOBadParameterErr); - - va_start(argp, data); - n = ParseArgs(argp, start); - va_end(argp); - /* n == 0 is not an error; it just means that instead of leaving - the node with no data, you have set it to have a specific type - of data, of which you are giving it nothing. (e.g. an empty - string, instead of no data). ADF does not see the difference, - so return now. */ - if (n == 0) - return(kCCMIONoErr); - - for (i = 0; i < n; ++i) - { - start[i]++; /* FORTRAN arrays begin at 1 not zero */ - end[i] = start[i]; - stride[i] = 1; - } - - ADF_Write_Data(node.node, start, end, stride, nDims, &dim, &memStart, - &memEnd, &memStride, (char *) data, &adfErr); - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOWriteData( CCMIOError *err, CCMIONode node, const void *data ) -{ - ADFError adfErr; - - CHECK_ERROR(err); - if (!data) return(*err = kCCMIOBadParameterErr); - - ADF_Write_All_Data(node.node, (const char *) data, &adfErr); - return(*err = ADFToCCMIOError(adfErr)); -} - -int CCMIOAreNodesEqual( CCMIONode node1, CCMIONode node2 ) -{ - return(node1.node == node2.node && node1.parent == node2.parent); -} - -CCMIOError CCMIOGetRootNode( CCMIOError *err, CCMIONode node, CCMIONode *root ) -{ - ADFError adfErr; - CHECK_ERROR(err); - if (!root) return(*err = kCCMIOBadParameterErr); - - ADF_Get_Root_ID(node.node, &root->node, &adfErr); - if (IsADFError(adfErr)) - return(*err = kCCMIOBadParameterErr); - root->parent = root->node; - return(*err); -} - -#ifdef __cplusplus - } -#endif -#endif /* CCMIO_CORE_C */ - - -/* Automatic setting of emacs local variables. */ -/* Local Variables: */ -/* mode: C++ */ -/* tab-width: 8 */ -/* End: */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmiocore.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmiocore.c deleted file mode 100644 index 3246d09d05..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmiocore.c +++ /dev/null @@ -1,689 +0,0 @@ -#ifndef CCMIO_CORE_C -#define CCMIO_CORE_C - -/*@@ - * Program: Star File Format Library - $RCSfile: ccmiocore.c,v $ - * Author: Geoff Prewett - * Date: July 28, 2003 - * - * - * Star File Format Library - Copyright (C) 2003 by adapco, Ltd. - * - * This program is the property of adapco, Ltd. and contains - * confidential and proprietary information. The unauthorized use, - * distribution, or duplication of this program is prohibited. - * All rights reserved. - * - * $Id: ccmiocore.c,v 1.12 2006/06/06 15:50:44 geoffp Exp $ - */ - -#ifndef MAKEDEPEND -#include -#include -#include -#include -#endif - -#include "libadf/ADF.h" -#include "ccmio.h" -#include "ccmiocore.h" -#include "ccmioprivate.h" -#include "ccmioversion.h" -#include "ccmioutility.h" - -const char kCCMIODefaultTitle[] = ""; - -#ifdef __cplusplus -extern "C" { -#endif - -CCMIOError CCMIOGetDimensionsCore( CCMIOError *err, CCMIONode node, int *nDims, - CCMIOIndex *dims ); -CCMIOError CCMIOSetDataTypeCore( CCMIOError *err, CCMIONode node, - CCMIODataType type, int nDims, - const CCMIOIndex *dims ); - -/** Opens the data file. The file will be created if it does not already exist. - \param filename Name of the file to open. - \param mode Either kCCMIORead or kCCMIOWrite. - \param root Returns the root node of the file. */ -CCMIOError CCMIOOpen( const char *filename, CCMIOIOType mode, CCMIONode *root ) -{ - int ver; - ADFError adfErr; - CCMIOError err = kCCMIONoErr; - - if (!root) return(kCCMIOBadParameterErr); - - ADF_Database_Open(filename, (mode == kCCMIORead) ? "READ_ONLY" : "UNKNOWN", - "NATIVE", &root->node, &adfErr); - root->parent = root->node; - if (IsADFError(adfErr)) - return(ADFToCCMIOError(adfErr)); - - /* If there isn't a version, set one */ - if (CCMIOGetVersion(NULL, *root, &ver) != kCCMIONoErr) - { - if (mode == kCCMIORead) - return(err = kCCMIOCorruptFileErr); - CCMIOSetVersion(&err, *root, kCCMIOVersion); - CCMIOSetTitle(&err, *root, kCCMIODefaultTitle); - } - return(err); -} - -CCMIOError CCMIOClose( CCMIONode root ) -{ - ADFError adfErr; - - ADF_Database_Close(root.node, &adfErr); - return(ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOGetNode( CCMIOError *err, CCMIONode parent, const char *path, - CCMIONode *node ) -{ - char const *end; - char *parentStr; - int size; - ADFError adfErr; - - CHECK_ERROR(err); - if (!node || !path) return(*err = kCCMIOBadParameterErr); - - if (*path == '/') /* Always make paths relative to 'parent' */ - path++; - - if ((end = strrchr(path, '/')) == NULL) - node->parent = parent.node; - else - { - size = end - path; /* The '/' will become the '\0' */ - parentStr = (char *)malloc((size + 1) * sizeof(char)); - memcpy(parentStr, path, size); - parentStr[size] = '\0'; - ADF_Get_Node_ID(parent.node, parentStr, &node->parent, &adfErr); - free(parentStr); - if (IsADFError(adfErr)) - return(*err = ADFToCCMIOError(adfErr)); - } - ADF_Get_Node_ID(parent.node, path, &node->node, &adfErr); - - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOGetNumberOfChildren( CCMIOError *err, CCMIONode parent, int *n ) -{ - ADFError adfErr; - CHECK_ERROR_AND_CLEAR_PTR(err, n, 0); - - ADF_Number_of_Children(parent.node, n, &adfErr); - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOGetNextChild( CCMIOError *err, CCMIONode parent, int *n, - CCMIONode *child ) -{ - char name[ADF_NAME_LENGTH + 1]; - int nNames; - ADFError adfErr; - - CHECK_ERROR(err); - if (!n || !child) return(*err = kCCMIOBadParameterErr); - - /* ADF uses FORTRAN indexing, so add 1 to *n to convert. */ - ADF_Children_Names(parent.node, *n + 1, 1, ADF_NAME_LENGTH, &nNames, name, - &adfErr); - if (nNames == 0) - return(*err = kCCMIONoNodeErr); - else if (nNames != 1) - return(*err = kCCMIOInternalErr); - if (IsADFError(adfErr)) - return(*err = ADFToCCMIOError(adfErr)); - - ADF_Get_Node_ID(parent.node, name, &child->node, &adfErr); - child->parent = parent.node; - *n += 1; - - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOGetName( CCMIOError *err, CCMIONode node, char *name ) -{ - ADFError adfErr; - - CHECK_ERROR_AND_CLEAR_PTR(err, name, 0); - if (!name) return(*err = kCCMIOBadParameterErr); - - *name = '\0'; /* in case of error... */ - ADF_Get_Name(node.node, name, &adfErr); - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOSetName( CCMIOError *err, CCMIONode node, const char *name ) -{ - ADFError adfErr; - - CHECK_ERROR(err); - if (!name) return(*err = kCCMIOBadParameterErr); - - ADF_Put_Name(node.parent, node.node, name, &adfErr); - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOGetLabel( CCMIOError *err, CCMIONode node, char *label ) -{ - ADFError adfErr; - - CHECK_ERROR_AND_CLEAR_PTR(err, label, 0); - - *label = '\0'; /* in case of error... */ - ADF_Get_Label(node.node, label, &adfErr); - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOSetLabel( CCMIOError *err, CCMIONode node, const char *label ) -{ - ADFError adfErr; - - CHECK_ERROR(err); - if (!label) return(*err = kCCMIOBadParameterErr); - - ADF_Set_Label(node.node, label, &adfErr); - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOCreateNode( CCMIOError *err, CCMIONode parent, int openDup, - const char *name, const char *label, - CCMIONode *node ) -{ - ADFError adfErr; - CCMIONode tmpNode; - - CHECK_ERROR(err); - if (!name) return(*err = kCCMIOBadParameterErr); - if (!node) node = &tmpNode; - - node->parent = parent.node; - ADF_Create(parent.node, name, &node->node, &adfErr); - if (adfErr == 26 && openDup) /* Duplicate node err */ - { - if (!CCMIOGetNode(err, parent, name, node)) - return(*err); - } - else if (IsADFError(adfErr)) - return(*err = ADFToCCMIOError(adfErr)); - - if (label) - ADF_Set_Label(node->node, label, &adfErr); - - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOCreateLink( CCMIOError *err, CCMIONode parent, const char *name, - const char *filename, const char *destName, - CCMIONode *node ) -{ - ADFError adfErr; - - CHECK_ERROR(err); - if (!name || !filename || !destName || !node) - return(*err = kCCMIOBadParameterErr); - - ADF_Link(parent.node, name, filename, destName, &node->node, &adfErr); - node->parent = parent.node; - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIODeleteNode( CCMIOError *err, CCMIONode node ) -{ - ADFError adfErr; - CHECK_ERROR(err); - - ADF_Delete(node.parent, node.node, &adfErr); - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIODeleteAllChildren( CCMIOError *err, CCMIONode node ) -{ - int i, n; - CCMIONode child; - CHECK_ERROR(err); - - CCMIOGetNumberOfChildren(err, node, &n); - for (i = 0; n > 0 && !(*err); ) - { - CCMIOGetNextChild(err, node, &i, &child); - CCMIODeleteNode(err, child); - i = 0; /* CCMIOGetNextChild increments this, but we want to delete - the first child each time */ - CCMIOGetNumberOfChildren(err, node, &n); - } - return(*err); -} - -CCMIOError CCMIOMoveNode( CCMIOError *err, CCMIONode node, CCMIONode newParent ) -{ - ADFError adfErr; - CHECK_ERROR(err); - - ADF_Move_Child(node.parent, node.node, newParent.node, &adfErr); - return(*err = ADFToCCMIOError(adfErr)); -} - -/* Requires: nDims is a valid pointer. - dims is an array of ADF_MAX_DIMENSIONS, or a NULL pointer - Ensures: dims is set to the dimensions of the node (if it is a regular - node this will just be the dimensions of the node; if it is - an extended node, these will be the dimensions of the extended - data.) */ -CCMIOError CCMIOGetDimensionsCore( CCMIOError *err, CCMIONode node, int *nDims, - CCMIOIndex *dims ) -{ - int i, adfDims[ADF_MAX_DIMENSIONS]; - ADFError adfErr; - CCMIONode nodeEx; - - { /* CHECK_ERROR declares a variable, so it needs its own scope */ - CHECK_ERROR(err); - if (!nDims) return(*err = kCCMIOBadParameterErr); - *nDims = 0; - - if (CCMIOGetNode(NULL, node, kCCMIOExtendedDataSize, &nodeEx) ==kCCMIONoErr) - { /* This node is an extendend node */ - /* Check that this node is really a 1D array like it should be */ - i = 0; - ADF_Get_Number_of_Dimensions(nodeEx.node, &i, &adfErr); - if (IsADFError(adfErr) || i != 1) - return(*err = kCCMIOCorruptFileErr); - - /* Now find out how big it is */ - ADF_Get_Dimension_Values(nodeEx.node, adfDims, &adfErr); - if (IsADFError(adfErr)) - return(*err = kCCMIOCorruptFileErr); - *nDims = adfDims[0]; - - /* Now read in the number of dimensions */ - if (dims) - { - if (sizeof(CCMIOIndex) > sizeof(int)) - ADF_Read_All_Data(nodeEx.node, (char *)dims, &adfErr); - else - { - unsigned long long dims64[ADF_MAX_DIMENSIONS]; - ADF_Read_All_Data(nodeEx.node, (char *)dims64, &adfErr); - for (i = 0; i < *nDims; ++i) - dims[i] = dims64[i]; - } - if (IsADFError(adfErr)) - return(*err = kCCMIOCorruptFileErr); - } - } - else - { /* Just a regular node; call the regular ADF functions */ - ADF_Get_Number_of_Dimensions(node.node, nDims, &adfErr); - if (IsADFError(adfErr)) - return(*err = ADFToCCMIOError(adfErr)); - - if (dims) - { - ADF_Get_Dimension_Values(node.node, adfDims, &adfErr); - if (adfErr == 32 /* No data */ || - adfErr == 27 /* Dimension is zero */) - { - *nDims = 0; - dims[0] = 0; - } - else if (IsADFError(adfErr)) - return(*err = ADFToCCMIOError(adfErr)); - - for (i = 0; i < *nDims; ++i) - dims[i] = (CCMIOIndex)adfDims[i]; - } - } - - return(*err); - } /* end CHECK_ERROR scope */ -} - -CCMIOError CCMIOGetDimensions( CCMIOError *err, CCMIONode node, int *nDims, - CCMIOIndex **dims ) -{ - if (dims) *dims = NULL; - { /* CHECK_ERROR declares a variable, so it needs its own scope */ - CHECK_ERROR(err); - if (!nDims) return(*err = kCCMIOBadParameterErr); - - CCMIOGetDimensionsCore(err, node, nDims, NULL); - - if (dims) - { - *dims = (CCMIOIndex *)malloc((*nDims) * sizeof(CCMIOIndex)); - /* According to the online ADF documentation, - ADF_Get_Number_of_Dimensions (called inside CCMIOGetDimensionsCore) - returns err 27 if the number of dimensions is zero. According to - the actual code, it doesn't. This appears to not be a problem - anywhere except on AIX, where malloc(0) produces a NULL pointer. - Apparently all the other systems actually give us a pointer. - So, if *nDims is zero and we got a NULL pointer, allocate a - non-zero one. */ - if (*nDims == 0 && !(*dims)) - *dims = (CCMIOIndex *)malloc(sizeof(CCMIOIndex)); - CCMIOGetDimensionsCore(err, node, nDims, *dims); - } - - return(*err); - } /* end CHECK_ERROR scope */ -} - -CCMIOError CCMIOGetDataType( CCMIOError *err, CCMIONode node, - CCMIODataType *type ) -{ - char dataStr[ADF_DATA_TYPE_LENGTH + 1]; - ADFError adfErr; - - CHECK_ERROR(err); - if (!type) return(kCCMIOBadParameterErr); - - ADF_Get_Data_Type(node.node, dataStr, &adfErr); - if (IsADFError(adfErr)) - return(*err = ADFToCCMIOError(adfErr)); - *type = CCMIOGetCCMIODataType(dataStr); - - return(*err); -} - -CCMIOError CCMIOGetDataSize( CCMIOError *err, CCMIONode node, - CCMIOSize *bytes ) -{ - int i, dims; - CCMIOIndex n[ADF_MAX_DIMENSIONS]; - CCMIODataType type; - - CHECK_ERROR(err); - if (!bytes) return(*err = kCCMIOBadParameterErr); - - *bytes = 0; - if (CCMIOGetDataType(err, node, &type)) - return(*err); - *bytes = CCMIOGetDataTypeSize(type); - - CCMIOGetDimensionsCore(err, node, &dims, n); - if (*err != kCCMIONoErr || dims == 0) - { - *bytes = 0; - return(*err = kCCMIONoErr); - } - for (i = 0; i < dims; i++) - *bytes *= n[i]; - return(*err); -} - -CCMIOError CCMIOSetDataType( CCMIOError *err, CCMIONode node, - CCMIODataType type, ... ) -{ - va_list args; - CHECK_ERROR(err); - - va_start(args, type); - CCMIOvSetDataType(err, node, type, args); - va_end(args); - return(*err); -} - -CCMIOError CCMIOSetDataTypeCore( CCMIOError *err, CCMIONode node, - CCMIODataType type, int nDims, - const CCMIOIndex *dims ) -{ - int i, adfDims[ADF_MAX_DIMENSIONS]; - CCMIOIndex itemSize, itemsPerNode; - CCMIOSize size; - ADFError adfErr; - CCMIONode nodeEx; - - CHECK_ERROR(err); - - /* ADF does not like zero-size dimensions, so empty strings need a bit - of tweaking -- set the node to dim 0, i.e. no data. */ - if (type == kCCMIOString && nDims == 1 && dims[0] == 0) - nDims = 0; - - size = CCMIOGetDataTypeSize(type); - for (i = 0; i < nDims; ++i) - size *= dims[i]; - if (nDims == 0 || dims[0] == 0) - { - itemSize = 0; - itemsPerNode = 0; - } - else - { - itemSize = CCMIOGetDataTypeSize(type); - if (nDims > 1) - itemSize *= dims[0]; - itemsPerNode = kCCMIOMaxADFNodeSize /itemSize;/*This will be truncated*/ - if (itemsPerNode == 0) - return(*err = kCCMIOArrayDimensionToLargeErr); - } - - for (i = 0; i < nDims; ++i) - adfDims[i] = (int)dims[i]; - - /* Delete any extended data nodes. They will be recreated if necessary when - the data is written. Note that resetting an existing node's data type - can potentially be a bit slow. */ - i = 0; - while (CCMIOGetNextChildWithLabel(NULL, node, kCCMIOExtendedDataLabel, - &i, &nodeEx) == kCCMIONoErr) - CCMIODeleteNode(err, nodeEx); - - /* Now we can set the size */ - if (size <= kCCMIOMaxADFNodeSize) - { - ADF_Put_Dimension_Information(node.node, CCMIOGetDataTypeADFName(type), - nDims, adfDims, &adfErr); - *err = ADFToCCMIOError(adfErr); - } - else - { - int j; - /* This can't be a CCMIOIndex because it *must* be 64-bits (since - that's the data type of the node, and CCMIOIndex might change) */ - unsigned long long dimArray64[ADF_MAX_DIMENSIONS]; - - /* Setup the main node */ - adfDims[nDims - 1] = itemsPerNode; - ADF_Put_Dimension_Information(node.node, CCMIOGetDataTypeADFName(type), - nDims, adfDims, &adfErr); - - - /* Create the extended size node */ - CCMIOCreateNode(err, node, TRUE, kCCMIOExtendedDataSize, - kCCMIOExtendedDataLabel, &nodeEx); - if (*err != kCCMIONoErr) - return(*err); - ADF_Put_Dimension_Information(nodeEx.node, - CCMIOGetDataTypeADFName(kCCMIOInt64), - 1, &nDims, &adfErr); - if (IsADFError(adfErr)) - return(*err = ADFToCCMIOError(adfErr)); - for (j = 0; j < ADF_MAX_DIMENSIONS && j < nDims; ++j) - dimArray64[j] = dims[j]; - ADF_Write_All_Data(nodeEx.node, (char *)dimArray64, &adfErr); - if (IsADFError(adfErr)) - return(*err = ADFToCCMIOError(adfErr)); - } - - return(*err); -} - -CCMIOError CCMIOvSetDataType( CCMIOError *err, CCMIONode node, - CCMIODataType type, va_list args ) -{ - int n = 0; - CCMIOIndex dims[ADF_MAX_DIMENSIONS + 1]; - - CHECK_ERROR(err); - n = ParseArgs(args, dims); - if (n == 0) - return(*err = kCCMIOBadParameterErr); - - /* ADF does not like zero-size dimensions, so empty strings need a bit - of tweaking -- set the node to dim 0, i.e. no data. */ - if (type == kCCMIOString && n == 1 && dims[0] == 0) - n = 0; - - CCMIOSetDataTypeCore(err, node, type, n, dims); - - return(*err); -} - -CCMIOError CCMIOSetDataTypev( CCMIOError *err, CCMIONode node, - CCMIODataType type, int nDims, - const CCMIOIndex *dims ) -{ - int i; - CCMIOIndex dimsCopy[ADF_MAX_DIMENSIONS+1]; - CHECK_ERROR(err); - if (nDims > ADF_MAX_DIMENSIONS) return(*err = kCCMIOBadParameterErr); - - for (i = 0; i < nDims; ++i) - dimsCopy[i] = dims[i]; - -#if StoreCStyleArrays - FortranToCArray(n, dimsCopy); -#endif - /* ADF does not like zero-size dimensions, so empty strings need a bit - of tweaking -- set the node to dim 0, i.e. no data. */ - if (type == kCCMIOString && nDims == 1 && dimsCopy[0] == 0) - nDims = 0; - - CCMIOSetDataTypeCore(err, node, type, nDims, dims); - return(*err); -} -/* -CCMIOError CCMIOReadDataPoint( CCMIOError *err, CCMIONode node, void *data, ...) -{ - int i, n = 0; - int start[ADF_MAX_DIMENSIONS + 1], end[ADF_MAX_DIMENSIONS + 1]; - int stride[ADF_MAX_DIMENSIONS + 1]; - int nDims = 1, dim = 1, memStart = 1, memEnd = 1, memStride = 1; - va_list argp; - ADFError adfErr; - - CHECK_ERROR(err); - if (!data) return(*err = kCCMIOBadParameterErr); - - va_start(argp, data); - n = ParseArgs(argp, start); - va_end(argp); - - if (n == 0) - return(*err = kCCMIOBadParameterErr); - - for (i = 0; i < n; ++i) - { - start[i]++; // FORTRAN arrays begin at 1 not zero - end[i] = start[i]; - stride[i] = 1; - } - - ADF_Read_Data(node.node, start, end, stride, nDims, &dim, &memStart, - &memEnd, &memStride, (char *) data, &adfErr); - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOReadData( CCMIOError *err, CCMIONode node, void *data, - CCMIODataType expected, int dimsExpected ) -{ - ADFError adfErr; - - CHECK_ERROR(err); - if (!data) return(*err = kCCMIOBadParameterErr); - - if (dimsExpected <= 0) // We always expect at least one dimension, - dimsExpected = 1; // even if the dimension's size is zero - *err = IsSameFormat(node, expected, dimsExpected); - if (*err != kCCMIONoErr) - return(*err); - - ADF_Read_All_Data(node.node, (char *) data, &adfErr); - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOWriteDataPoint( CCMIOError *err, CCMIONode node, - void *data, ... ) -{ - int i, n = 0; - int start[ADF_MAX_DIMENSIONS + 1], end[ADF_MAX_DIMENSIONS + 1]; - int stride[ADF_MAX_DIMENSIONS + 1]; - int nDims = 1, dim = 1, memStart = 1, memEnd = 1, memStride = 1; - va_list argp; - ADFError adfErr; - - CHECK_ERROR(err); - if (!data) return(*err = kCCMIOBadParameterErr); - - va_start(argp, data); - n = ParseArgs(argp, start); - va_end(argp); - // n == 0 is not an error; it just means that instead of leaving - // the node with no data, you have set it to have a specific type - // of data, of which you are giving it nothing. (e.g. an empty - // string, instead of no data). ADF does not see the difference, - // so return now. - if (n == 0) - return(kCCMIONoErr); - - for (i = 0; i < n; ++i) - { - start[i]++; // FORTRAN arrays begin at 1 not zero - end[i] = start[i]; - stride[i] = 1; - } - - ADF_Write_Data(node.node, start, end, stride, nDims, &dim, &memStart, - &memEnd, &memStride, (char *) data, &adfErr); - return(*err = ADFToCCMIOError(adfErr)); -} - -CCMIOError CCMIOWriteData( CCMIOError *err, CCMIONode node, const void *data ) -{ - ADFError adfErr; - - CHECK_ERROR(err); - if (!data) return(*err = kCCMIOBadParameterErr); - - ADF_Write_All_Data(node.node, (const char *) data, &adfErr); - return(*err = ADFToCCMIOError(adfErr)); -} -*/ -int CCMIOAreNodesEqual( CCMIONode node1, CCMIONode node2 ) -{ - return(node1.node == node2.node && node1.parent == node2.parent); -} - -CCMIOError CCMIOGetRootNode( CCMIOError *err, CCMIONode node, CCMIONode *root ) -{ - ADFError adfErr; - CHECK_ERROR(err); - if (!root) return(*err = kCCMIOBadParameterErr); - - ADF_Get_Root_ID(node.node, &root->node, &adfErr); - if (IsADFError(adfErr)) - return(*err = kCCMIOBadParameterErr); - root->parent = root->node; - return(*err); -} - -#ifdef __cplusplus - } -#endif -#endif /* CCMIO_CORE_C */ - - -/* Automatic setting of emacs local variables. */ -/* Local Variables: */ -/* mode: C++ */ -/* tab-width: 8 */ -/* End: */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmiocore.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmiocore.h deleted file mode 100644 index 971641b335..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmiocore.h +++ /dev/null @@ -1,263 +0,0 @@ -#ifndef CCMIO_CORE_H -#define CCMIO_CORE_H - -/*@@ - * Program: Star File Format Library - $RCSfile: ccmiocore.h,v $ - * Author: Geoff Prewett - * Date: July 28, 2003 - * - * - * Star File Format Library - Copyright (C) 2003 by adapco, Ltd. - * - * This program is the property of adapco, Ltd. and contains - * confidential and proprietary information. The unauthorized use, - * distribution, or duplication of this program is prohibited. - * All rights reserved. - * - * $Id: ccmiocore.h,v 1.8 2006/06/06 12:09:54 jal Exp $ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#define kCCMIOBadNode 0.0 - -#ifndef MAKEDEPEND -#include -#endif - -#include "libccmio/ccmiotypes.h" - -/* \{ - \name Core functions - \brief The minimal set of functions. - \ingroup core */ - -/** Opens the data file. The file will be created if it does not already exist. - \param filename Name of the file to open. - \param mode Mode to open the file: kCCMIORead or kCCMIOWrite. - \param root Returns the root node of the file. */ -extern CCMIOError CCMIOOpen( char const *filename, CCMIOIOType mode, - CCMIONode *root ); - -/** Closes the data file - \param root Root node of the file to be closed. */ -extern CCMIOError CCMIOClose( CCMIONode root ); - -/** Finds a node, given a node path - \param err Error input and output. If the incoming error is - not \ref kCCMIONoErr, the function will do nothing. - Is set to the function's return value on exit. - \param parent The node that the root of the path begins with (need - not be the actual root node). - \param path A unix-like path containing the names of nodes. - The beginning / is optional. - (e.g. "/solver/brep/topology/endpoints"). - \param node Returns the node (invalid if it does not exist). */ -extern CCMIOError CCMIOGetNode( CCMIOError *err, CCMIONode parent, - char const *path, CCMIONode *node ); - -/** Returns the number of children in the parent node. */ -extern CCMIOError CCMIOGetNumberOfChildren( CCMIOError *err, CCMIONode parent, - int *n ); - -/** Returns the next child node. Note that there is no guarantee that - the order of the children will always be the same. - \param err Error input and output. If the incoming error is - not \ref kCCMIONoErr, the function will do nothing. - Is set to the function's return value on exit. - \param parent Parent node of the prospective children. - \param n Which child (i.e. return the nth child). n will be - incremented upon successful completion of the function. - If there is no nth child, a kCCMIONoNodeErr error will be - returned. - \param child The nth child, or NULL if the nth child does not exist. -*/ -extern CCMIOError CCMIOGetNextChild( CCMIOError *err, CCMIONode parent, int *n, - CCMIONode *child ); - -/** Returns the name of the node - \param err Error input and output. If the incoming error is - not \ref kCCMIONoErr, the function will do nothing. - Is set to the function's return value on exit. - \param node The node whose name is to be returned. - \param name Returns the name of the node. Must be at least - kCCMIOMaxStringLength + 1 bytes. */ -extern CCMIOError CCMIOGetName( CCMIOError *err, CCMIONode node, char *name ); - -/** Sets the name of an existing node - \param err Error input and output. If the incoming error is - not \ref kCCMIONoErr, the function will do nothing. - Is set to the function's return value on exit. - \param node The node whose name is to be set. - \param name The name of the node. If the file type (e.g. ADF) - limits lengths of names, the name will be truncated. */ -extern CCMIOError CCMIOSetName( CCMIOError *err, CCMIONode node, - char const *name ); - -/** Returns the label of the node - \param err Error input and output. If the incoming error is - not \ref kCCMIONoErr, the function will do nothing. - Is set to the function's return value on exit. - \param node The node whose label is to be returned. - \param label Returns the label of the node. This string must be - at least kCCMIOMaxStringLength + 1 bytes. */ -extern CCMIOError CCMIOGetLabel( CCMIOError *err, CCMIONode node, char *label ); - -/** Sets the label of an existing node. */ -extern CCMIOError CCMIOSetLabel( CCMIOError *err, CCMIONode node, - char const *label ); - -/** Creates a new node - \param err Error input and output. If the incoming error is - not \ref kCCMIONoErr, the function will do nothing. - Is set to the function's return value on exit. - \param parent The parent node of the new node. - \param openDup If TRUE, a \ref kCCMIODuplicateNodeErr will not be returned - in an attempt to create a sibling with the same name; - instead, CCMIOGetNode() will be called on the original node - If FALSE, the error will be returned and the value of - node is undefined. - \param name The name of the node. If the file type (e.g. ADF) - limits lengths of names, the name will be truncated. - \param label The label of the name. This may be trunctated like - the name. - \param node Returns the new node. NULL may be passed in if no - return is required. */ -extern CCMIOError CCMIOCreateNode( CCMIOError *err, CCMIONode parent, - int openDup, char const *name, - char const *label, CCMIONode *node ); - -/** Creates a new link - \param err Error input and output. If the incoming error is - not \ref kCCMIONoErr, the function will do nothing. - Is set to the function's return value on exit. - \param parent The parent node of the new link. - \param name The name of the node. See CCMIOCreateNode() for more - details on this parameter. - \param filename Filename that the link points to. - \param destName Path to the node to be linked to. - \param node Returns the new node (invalid in case of an error). - NULL may be passed in if no return is required. */ -extern CCMIOError CCMIOCreateLink( CCMIOError *err, CCMIONode parent, - char const *name, char const *filename, - char const *destName, CCMIONode *node ); - -/** Deletes the node */ -extern CCMIOError CCMIODeleteNode( CCMIOError *err, CCMIONode node ); - -/** Deletes all children of the node, but not the node itself */ -extern CCMIOError CCMIODeleteAllChildren( CCMIOError *err, CCMIONode node ); - -/** Moves the node underneath newParent */ -extern CCMIOError CCMIOMoveNode( CCMIOError *err, CCMIONode node, - CCMIONode newParent ); - -/** Returns the number of items in the node's data - \param err Error input and output. If the incoming error is - not \ref kCCMIONoErr, the function will do nothing. - Is set to the function's return value on exit. - \param node The node to use - \param nDims Returns the number of dimensions. 0 means no data. - \param dims Returns the number of elements of each dimension. Note - that this array is allocated by the library and must be - freed by the user. */ -extern CCMIOError CCMIOGetDimensions( CCMIOError *err, CCMIONode node, - int *nDims, CCMIOIndex **dims ); - -/** Returns the number of bytes of the data */ -extern CCMIOError CCMIOGetDataSize( CCMIOError *err, CCMIONode node, - CCMIOSize *bytes ); - -/** Returns the data type for the node */ -extern CCMIOError CCMIOGetDataType( CCMIOError *err, CCMIONode node, - CCMIODataType *type); - -/** Sets the datatype of the node. - \param err Error input and output. If the incoming error is - not \ref kCCMIONoErr, the function will do nothing. - Is set to the function's return value on exit. - \param node The node - \param type The datatype - \param ... The number and size of the dimensions (passed as - CCMIOIndex), terminated with a \ref kCCMIOEndArgs. - For instance an array of "int ary[5][10];" - would be "CCMIOReadDataPoint(node, data, 5ul, 10ul, kCCMIOEndArgs)". - A single dimension of size 1 is equivalent to a scalar - value. */ -extern CCMIOError CCMIOSetDataType( CCMIOError *err, CCMIONode node, - CCMIODataType type, ... ); -extern CCMIOError CCMIOvSetDataType( CCMIOError *err, CCMIONode node, - CCMIODataType type, va_list args ); -extern CCMIOError CCMIOSetDataTypev( CCMIOError *err, CCMIONode node, - CCMIODataType type, - int nDims, CCMIOIndex const *dims ); - -/** Returns all the data in the node - \param err Error input and output. If the incoming error is - not \ref kCCMIONoErr, the function will do nothing. - Is set to the function's return value on exit. - \param node The node to use - \param data Pointer to memory large enough to hold the entire - data; note that this is \em not allocated by the - library. The data is returned as FORTRAN data. - \param expected The expected type. A \ref kCCMIOWrongDataTypeErr error - is returned if the node's data is not of the expected - type and no data is written. - \param dimsExpected The number of dimensions that are expected. A - kCCMIOWrongDataType error is returned if the node's data - has a different number of dimensions. A scalar and - a one-dimensional array both have dimensions of 1. -extern CCMIOError CCMIOReadData( CCMIOError *err, CCMIONode node, void *data, - CCMIODataType expected, int dimsExpected ); -*/ -/** Returns one element of data. No datatype checking is performed. - \param err Error input and output. If the incoming error is - not \ref kCCMIONoErr, the function will do nothing. - Is set to the function's return value on exit. - \param node The node whose data to return. - \param data Pointer to memory large enough to hold one element - \param ... Var-arg list that is the C-style index into the - array. Scalar values can be read by using a single - value of 0, although CCMIOReadData() is preferred. - At least one parameter must be passed to - the list. Note that the list must be terminated - with \ref kCCMIOEndArgs. -extern CCMIOError CCMIOReadDataPoint( CCMIOError *err, CCMIONode node, - void *data, ...); -*/ -/** Write one element of data. No datatype checking is performed. - See CCMIOReadDataPoint() for a discussion of the parameters. The var-arg - list must be terminated with \ref kCCMIOEndArgs. - Note: for performance reasons, the datatype of 'data' is unknown to - the function, so CCMIOWriteDataPoint() cannot be used to write strings, as it - does not know when 'data' is a string. For string data use CCMIOWriteData. - Note: When writing scalar data with CCMIOWriteDataPoint(), a dimension of 0 - should be used: "CCMIOWriteDataPoint(err, node, data, 0, kCCMIOEndArgs)", - although CCMIOWriteData() is preferred. -extern CCMIOError CCMIOWriteDataPoint( CCMIOError *err, CCMIONode node, - void *data, ... ); -*/ -/** Writes the entire node's data. Requires that the node's datatype and size - were correctly set with CCMIOSetDataType(). -CCMIOError CCMIOWriteData( CCMIOError *err, CCMIONode node, void const *data ); -*/ -/** Returns TRUE if node1 == node2, FALSE otherwise. */ -int CCMIOAreNodesEqual( CCMIONode node1, CCMIONode node2 ); - -/** Returns the root node, or \ref kCCMIOBadParameterErr if 'node' is not valid.*/ -CCMIOError CCMIOGetRootNode( CCMIOError *err, CCMIONode node, CCMIONode *root ); - -/*\}*/ -#ifdef __cplusplus - } -#endif -#endif /* CCMIO_CORE_H */ - - -/* Automatic setting of emacs local variables. */ -/* Local Variables: */ -/* mode: C++ */ -/* tab-width: 8 */ -/* End: */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioprivate.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioprivate.c deleted file mode 100644 index 5cc01a2016..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioprivate.c +++ /dev/null @@ -1,321 +0,0 @@ -#ifndef CCMIO_PRIVATE_C -#define CCMIO_PRIVATE_C - -/*@@ - * Program: Star File Format Library - $RCSfile: ccmioprivate.c,v $ - * Author: Geoff Prewett - * Date: July 31, 2003 - * - * - * Star File Format Library - Copyright (C) 2003 by adapco, Ltd. - * - * This program is the property of adapco, Ltd. and contains - * confidential and proprietary information. The unauthorized use, - * distribution, or duplication of this program is prohibited. - * All rights reserved. - * - * $Id: ccmioprivate.c,v 1.7 2006/06/05 21:12:16 geoffp Exp $ - */ - -#ifndef MAKEDEPEND -#include -#endif - -#include "ccmiocore.h" -#include "ccmioprivate.h" -#include "libadf/ADF.h" - -#if Debugging -#ifndef MAKEDEPEND -#include -#endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -static int Sum( int n, int start, int vals[] ); - -/* -------------------------------------------------------------------------- */ -struct _CCMIOTypeInfo { - char name[8]; - unsigned int size; -}; -struct _CCMIOTypeInfo gCCMIOTypeTable[(int)kCCMIOLastType] = { - { "R4", 4 }, { "R8", 8 }, { "I4", 4 }, { "I8", 8 }, { "C1", 1 }, { "MT", 0 }}; - -unsigned int CCMIOGetDataTypeSize( CCMIODataType type ) -{ - return(gCCMIOTypeTable[(int)type].size); -} - -const char* CCMIOGetDataTypeADFName( CCMIODataType type ) -{ - return(gCCMIOTypeTable[(int)type].name); -} - -CCMIODataType CCMIOGetCCMIODataType( const char *dataStr ) -{ - int i; - char str[3]; /* We will not be using fancy ADF data strings... */ - - memcpy(str, dataStr, 2); - str[2] = '\0'; - - for (i = 0; i < (int)kCCMIOLastType; ++i) - { - if (strcmp(str, gCCMIOTypeTable[i].name) == 0) - return((CCMIODataType)i); - } - return(kCCMIOBadType); -} - -/* -------------------------------------------------------------------------- */ -void MakeInvalidNode( CCMIONode *node ) -{ - node->node = 0.0; - node->parent = 0.0; -} - -int IsRootNode( CCMIONode node ) -{ - if (node.node == node.parent) - return(TRUE); - return(FALSE); -} - -CCMIOError IsSameFormat( CCMIONode node, CCMIODataType type, int dimSize ) -{ - char typeStr[ADF_DATA_TYPE_LENGTH + 1]; - int err, n; - - ADF_Get_Data_Type(node.node, typeStr, &err); - if (IsADFError(err)) return(ADFToCCMIOError(err)); - if (strcmp(gCCMIOTypeTable[(int)type].name, typeStr) != 0) - return(kCCMIOWrongDataTypeErr); - - ADF_Get_Number_of_Dimensions(node.node, &n, &err); - if (IsADFError(err)) return(ADFToCCMIOError(err)); - if (n != dimSize && n > 0) - /* n of zero means "no data" to ADF, but to us it means - one dimension with zero size; dimSize is never < 1. */ - return(kCCMIOWrongDataTypeErr); - return(kCCMIONoErr); -} - -int IsADFError( int adfErr ) -{ - if (adfErr == -1) - return(FALSE); - return(TRUE); -} - -int ParseArgs( va_list args, CCMIOIndex *out ) -{ - int n = 0, val; - while((val = va_arg(args, CCMIOIndex)) != kCCMIOEndArgs && - n < kCCMIOMaxDimension) - out[n++] = val; - if (n == 0) - return(n); - -#if StoreCStyleArrays - FortranToCArray(n, out); -#endif -#if Debugging - if (n >= kCCMIOMaxDimension) - fprintf(stderr, "ParseArgs: probably did not end a call to a var-arg CCMIO function with kCCMIOEndArgs!\n"); -#endif - - return(n); -} - -#if StoreCStyleArrays -void FortranToCArray( int size, int *ary ) -{ - int i, tmp; - - for (i = 0; i < size / 2; ++i) - { - tmp = ary[i]; - ary[i] = ary[size - i - 1]; - ary[size - i - 1] = tmp; - } -} -#endif /* StoreCStyleArrays */ - -int CalcOffset( int n, int coord[], int dimWidth[] ) -{ - int i, offset; - -#if StoreCStyleArrays - offset = coord[n - 1]; - for (i = n - 2; i >= 0; --i) - offset += coord[i] * Sum(n - i, i + 1, dimWidth); - return(offset); -#else - offset = coord[0]; - for (i = 1; i < n; ++i) - offset += coord[i] * Sum(i, i - 1, dimWidth); - return(offset); -#endif /* StoreCStyleArrays */ -} - -CCMIOError GetADFNodeDimensions( CCMIOError *err, CCMIONode node, - int *nDims, int *dims ) -{ - int i, adfDims[ADF_MAX_DIMENSIONS]; - ADFError adfErr; - - CHECK_ERROR(err); - - ADF_Get_Number_of_Dimensions(node.node, nDims, &adfErr); - if (IsADFError(adfErr)) - return(*err = ADFToCCMIOError(adfErr)); - - if (dims) - { - ADF_Get_Dimension_Values(node.node, adfDims, &adfErr); - if (adfErr == 32 /* No data */ || adfErr == 27 /* Dimension is zero */) - { - *nDims = 0; - dims[0] = 0; - } - else if (IsADFError(adfErr)) - return(*err = ADFToCCMIOError(adfErr)); - - for (i = 0; i < *nDims; ++i) - dims[i] = (unsigned long)adfDims[i]; - } - - return(*err); -} - -CCMIOSize GetADFNodeDataSize( CCMIOError *err, CCMIONode node ) -{ - int i, n, dims[ADF_MAX_DIMENSIONS]; - CCMIOSize bytes; - CCMIODataType type; - - CHECK_ERROR(err); - - bytes = 0; - if (CCMIOGetDataType(err, node, &type)) - return(*err); - bytes = CCMIOGetDataTypeSize(type); - - GetADFNodeDimensions(err, node, &n, dims); - if (*err != kCCMIONoErr || n == 0) - { - bytes = 0; - return(*err = kCCMIONoErr); - } - for (i = 0; i < n; i++) - bytes *= dims[i]; - return(bytes); -} - -CCMIOError ADFToCCMIOError( int adfErr ) -{ - static int errorConversionTable[62][2] = { - { 0, kCCMIOInternalErr }, /* Not and ADF err; placeholder only */ - { 1, kCCMIOBadParameterErr }, /* Int value less than minimum */ - { 2, kCCMIOBadParameterErr }, /* Int value greater than maximum */ - { 3, kCCMIOBadParameterErr }, /* String too short */ - { 4, kCCMIOBadParameterErr }, /* String too long */ - { 5, kCCMIOCorruptFileErr }, /* String length corrupted */ - { 6, kCCMIOInternalErr }, /* Too many ADF files open */ - { 7, kCCMIOInternalErr }, /* ADF file status not recognized */ - { 8, kCCMIOPermissionErr }, /* ADF file open err */ - { 9, kCCMIOBadParameterErr }, /* ADF file not open */ - { 10, kCCMIOBadParameterErr }, /* ADF file out of legal range */ - { 11, kCCMIOInternalErr }, /* Block/offset out of legal range */ - { 12, kCCMIOInternalErr }, /* NULL string pointer */ - { 13, kCCMIOIOErr }, /* FSEEK error */ - { 14, kCCMIOIOErr }, /* FWRITE error */ - { 15, kCCMIOIOErr }, /* FREAD error */ - { 16, kCCMIOInternalErr }, /* Memory corruption */ - { 17, kCCMIOInternalErr }, /* Bad disk boundary */ - { 18, kCCMIOInternalErr }, /* Requested new file already exists */ - { 19, kCCMIOCorruptFileErr }, /* ADF file format not recognized */ - { 20, kCCMIOCorruptFileErr }, /* Attempt to free RootNode info */ - { 21, kCCMIOCorruptFileErr }, /* Attempt to free FreeChunkTable info*/ - { 22, kCCMIOInternalErr }, /* Requested old file doesn't exist */ - { 23, kCCMIOInternalErr }, /* Code unimplemented */ - { 24, kCCMIOCorruptFileErr }, /* Bad subnode entries */ - { 25, kCCMIONoMemoryErr }, /* Out of memory */ - { 26, kCCMIODuplicateNodeErr }, /* Tried to create a duplicate child */ - { 27, kCCMIOCorruptFileErr }, /* Node has no dimensions */ - { 28, kCCMIOCorruptFileErr }, /* Node has illegal dimensions */ - { 29, kCCMIONoNodeErr }, /* Child is not child of parent */ - { 30, kCCMIOInternalErr }, /* Datatype is too long */ - { 31, kCCMIOInternalErr }, /* Bad datatype */ - { 32, kCCMIOInternalErr }, /* NULL pointer */ - { 33, kCCMIONoDataErr }, /* Node has no data */ - { 34, kCCMIOInternalErr }, /* Couldn't zero out memory */ - { 35, kCCMIOInternalErr }, /* Not enough data for request */ - { 36, kCCMIOInternalErr }, /* Bad end value */ - { 37, kCCMIOInternalErr }, /* Bad stride value */ - { 38, kCCMIOBadParameterErr }, /* Minimum val is greater than maximum*/ - { 39, kCCMIOInternalErr }, /* Format of this machine is unknown */ - { 40, kCCMIOInternalErr }, /* Conversion to/from unknown machine format */ - { 41, kCCMIOInternalErr }, /* No conversion necessary */ - { 42, kCCMIOInternalErr }, /* Data format not supported on this machine */ - { 43, kCCMIOIOErr }, /* File close error */ - { 44, kCCMIOInternalErr }, /* Numeric overflow/underflow in conversion */ - { 45, kCCMIOInternalErr }, /* Bad start value */ - { 46, kCCMIOBadParameterErr }, /* Value of zero not allowed */ - { 47, kCCMIOBadParameterErr }, /* Bad dimension value */ - { 48, kCCMIOInternalErr }, /* Error state must be zero or one */ - { 49, kCCMIOInternalErr }, /* Dimension specs for memory and disk unequal*/ - { 50, kCCMIOBadParameterErr }, /* Link depth too large; recursive link? */ - { 51, kCCMIOInternalErr }, /* Node is not a link */ - { 52, kCCMIOBadLinkErr }, /* Node linked to does not exist */ - { 53, kCCMIOBadLinkErr }, /* ADF file linked to does not exist */ - { 54, kCCMIOBadParameterErr }, /* Node ID of 0.0 is invalid */ - { 55, kCCMIOCorruptFileErr }, /*Incomplete data when reading multiple blocks*/ - { 56, kCCMIOBadParameterErr }, /* Node name contains invalid characters */ - { 57, kCCMIOInternalErr }, /* ADF file version incompatible */ - { 58, kCCMIOBadParameterErr }, /* Nodes are not from same file */ - { 59, kCCMIOInternalErr }, /* Priority stack err */ - { 60, kCCMIOInternalErr }, /* Machine and file formats incompatible */ - { 61, kCCMIOIOErr } /* Flush error */ - }; - -#if Debugging - /* This didn't turn out to be as useful as I thought. Mostly you just - get a lot of ADF error 29, which is usually expected as it is often used - to terminate loops */ -/* - if (IsADFError(adfErr)) - fprintf(stderr, "Converting ADF error %d to CCMIO error %d.\n", adfErr, - errorConversionTable[adfErr][1]); -*/ -#endif - if (adfErr == -1) - return(kCCMIONoErr); - return ((CCMIOError) errorConversionTable[adfErr][1]); -} - -/* -------------------------------------------------------------------------- */ -int Sum( int n, int start, int vals[] ) -{ - int i, result = 0; - - for (i = start; i < n; ++i) - result += vals[i]; - return(result); -} - -#ifdef __cplusplus -} -#endif -#endif /* CCMIO_PRIVATE_C */ - - -/* Automatic setting of emacs local variables. */ -/* Local Variables: */ -/* mode: C++ */ -/* tab-width: 8 */ -/* End: */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioprivate.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioprivate.h deleted file mode 100644 index 79d6c9463a..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioprivate.h +++ /dev/null @@ -1,116 +0,0 @@ -#ifndef CCMIO_PRIVATE_H -#define CCMIO_PRIVATE_H - -/*@@ - * Program: Star File Format Library - $RCSfile: ccmioprivate.h,v $ - * Author: Geoff Prewett - * Date: July 31, 2003 - * - * - * Star File Format Library - Copyright (C) 2003 by adapco, Ltd. - * - * This program is the property of adapco, Ltd. and contains - * confidential and proprietary information. The unauthorized use, - * distribution, or duplication of this program is prohibited. - * All rights reserved. - * - * $Id: ccmioprivate.h,v 1.7 2006/06/05 21:12:16 geoffp Exp $ - */ - -#ifndef MAKEDEPEND -#include -#endif - -#include "libccmio/ccmio.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define StoreCStyleArrays 0 /* If set to 1, stores arrays in the - ADF file in C order (by reversing - the dimensions) */ - -#define kCCMIOMaxADFNodeSize 2147479552 /* 2 GB - 4096 (1 ADF block size)*/ -/* Test the extended ADF feature with these sizes (keep the node size small!) */ -/*#define kCCMIOMaxADFNodeSize 100000000 */ -/*#define kCCMIOMaxADFNodeSize 7000000 */ -/*#define kCCMIOMaxADFNodeSize 6000000 */ -/*#define kCCMIOMaxADFNodeSize 128 */ -/*#define kCCMIOMaxADFNodeSize 110 */ -/*#define kCCMIOMaxADFNodeSize 36 */ -/*#define kCCMIOMaxADFNodeSize 24 */ /* Use this for the ccmtest test also */ -/*#define kCCMIOMaxADFNodeSize 100000 */ -#define kCCMIOExtendedDataSize "ExtendedSize" -#define kCCMIOExtendedDataName "ExtendedData" -#define kCCMIOExtendedDataLabel "extendedData" - -typedef int ADFError; - -/** Writes an invalid CCMIO node in 'node'. */ -void MakeInvalidNode( CCMIONode *node ); - -/** Returns TRUE if 'node' is the root node, FALSE otherwise. */ -int IsRootNode( CCMIONode node ); - -/** Returns the size of the specified datatype */ -unsigned int CCMIOGetDataTypeSize( CCMIODataType type ); - -/** Returns an ADF typename string from the specified type */ -char const* CCMIOGetDataTypeADFName( CCMIODataType type ); - -/** Returns an CCMIODataType from an ADF string. */ -CCMIODataType CCMIOGetCCMIODataType( char const *dataStr ); - -/** Checks to see if the node has the same datatype and dimension - size as specified */ -CCMIOError IsSameFormat( CCMIONode node, CCMIODataType type, int dimSize ); - -/** Parses a va_list of dimension arguments */ -int ParseArgs( va_list args, CCMIOIndex *out ); - -#if StoreCStyleArrays -/** Converts an array of Fortran dimensions to C dimensions (i.e. reverses - them */ -void FortranToCArray( int size, int *ary ); -#endif /* StoreCStyleArrays */ - -/** Takes a coordinate and size of array and returns the offset - of the index into the array (if StoreCStyleArrays is enabled then - the array is assumed to be in C-ordering, otherwise it is in FORTRAN - ordering). */ -int CalcOffset( int n, int coord[], int dimWidth[] ); - -/** Like CCMIOGetDimensions, except only gives the dimensions of the node - passed in; does not take into account extended data */ -CCMIOError GetADFNodeDimensions( CCMIOError *err, CCMIONode node, - int *nDims, int *dims ); - -/** Like CCMIOGetDataSize, except only returns the size (in bytes) of the node - passed in; does not take into account extended data */ -CCMIOSize GetADFNodeDataSize( CCMIOError *err, CCMIONode node ); - -/** Returns 1 if adfErr is an ADF error, 0 otherwise. */ -int IsADFError( int adfErr ); - -/** Returns the appropriate CCMIOError from the specified adfErr */ -CCMIOError ADFToCCMIOError( int adfErr ); - -/* This is defined in ccmioread.c */ -CCMIOError CCMIOExtendedADFIO( CCMIOError *err, CCMIONode node, - CCMIOIOType ioType, CCMIODataType dataType, - int nDims, CCMIOIndex const *dims, - char *data, CCMIOIndex start, CCMIOIndex end ); - - -#ifdef __cplusplus -} -#endif -#endif /* CCMIO_PRIVATE_H */ - - -/* Automatic setting of emacs local variables. */ -/* Local Variables: */ -/* mode: C++ */ -/* tab-width: 8 */ -/* End: */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioread.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioread.c deleted file mode 100644 index 92c5a66018..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioread.c +++ /dev/null @@ -1,564 +0,0 @@ -/*@@ - * Program: Star File Format Library - $RCSfile: ccmioread.c,v $ - * Author: Geoff Prewett - * Date: January 5, 2004 - * - * - * Star File Format Library - Copyright (C) 2004 by adapco, Ltd. - * - * This program is the property of adapco, Ltd. and contains - * confidential and proprietary information. The unauthorized use, - * distribution, or duplication of this program is prohibited. - * All rights reserved. - * - * $Id: ccmioread.c,v 1.18 2006/06/30 16:58:44 geoffp Exp $ - */ - -/* This file is not intended to be compiled directly. Instead it - implements a "template" function. The macros TYPE, TYPE_ABBREV, and CCMIOTYPE - must be defined before inclusion and this file must be included for - each type of "template" that will be instantiated. A poor man's template - function. */ - -/* ------------ Global section (not templated) ------------------------------ */ -#ifndef CCMIO_READ_GLOBAL_DEF -#define CCMIO_READ_GLOBAL_DEF -typedef void (*ADF_RW_All_Data_Func)(const double, char*, int *); -typedef void (*ADF_RW_Block_Data_Func)(const double, const long, const long, - char*, int *); - -CCMIOError CCMIOExtendedADFIO( CCMIOError *err, CCMIONode node, - CCMIOIOType ioType, CCMIODataType dataType, - int nDims, CCMIOIndex const *dims, - char *data, CCMIOIndex start, CCMIOIndex end ) -{ - int i, thisNodeNDims, thisNodeDims[ADF_MAX_DIMENSIONS]; - CCMIOIndex nItems, itemSize = 1, idx2bytes, itemsPerNode; - CCMIOSize dataTypeSize; - ADFError adfErr = NO_ERROR; - ADF_RW_All_Data_Func ADF_RW_All_Data = &ADF_Read_All_Data; - ADF_RW_Block_Data_Func ADF_RW_Block_Data = &ADF_Read_Block_Data; - - CHECK_ERROR(err); - - if (start == kCCMIOStart && ioType == kCCMIOWrite) - if (CCMIOSetDataTypev(err, node, dataType, nDims, dims) != kCCMIONoErr) - return(*err); - - /* start and end are in conceptual units. For example, for a 2D array - verts[100][3], there are 100 units (each of size three), but map[100] - also has 100 units (size one). This is complicated a bit because - ADF is in FORTRAN order, so the order of the dimensions is reversed - from C. */ - nItems = dims[nDims - 1]; - for (i = 0; i < nDims - 1; ++i) - itemSize *= dims[i]; - - /* start and end are 0-based indices. ADF uses 1-based indices - (i.e. FORTRAN indexing), so they will need to be converted before - we actually do I/O. */ - if (end == 0 || end > nItems) - end = nItems; - if (start > end) - return(*err = kCCMIOBadParameterErr); - - if (ioType == kCCMIOWrite) - { - ADF_RW_All_Data = (ADF_RW_All_Data_Func)&ADF_Write_All_Data; - ADF_RW_Block_Data = &ADF_Write_Block_Data; - } - - dataTypeSize = CCMIOGetDataTypeSize(dataType); - idx2bytes = dataTypeSize; - if (nDims > 1) - idx2bytes *= dims[0]; - if (ioType == kCCMIOWrite) - itemsPerNode = kCCMIOMaxADFNodeSize / idx2bytes; - else - { - /* We need to read the dimensions of the main node to find - the items per node, in case a different version of the library - used a different value for kCCMIOMaxADFNodeSize */ - if (GetADFNodeDimensions(NULL, node, &thisNodeNDims, thisNodeDims) - != kCCMIONoErr) - return(*err = kCCMIOCorruptFileErr); - itemsPerNode = thisNodeDims[nDims - 1]; - } - - if (end <= itemsPerNode) - { - if (start == 0 && (end == nItems || end == itemsPerNode)) - (*ADF_RW_All_Data)(node.node, data, &adfErr); - else - (*ADF_RW_Block_Data)(node.node, (long)start * itemSize + 1, - (long)end * itemSize, - data, &adfErr); - } - else - { - int i; - char nodeExName[kCCMIOMaxStringLength + 1]; - CCMIOIndex dimsCopy[ADF_MAX_DIMENSIONS]; - CCMIONode nodeEx; - - /* Note: this check must go here instead of after the assignment to - itemsPerNode because an empty string needs to have nDims = 1 and - dims[0] = 0, which would return an incorrect error. If we put - it here, an empty string cannot reach the check. */ - if (itemsPerNode == 0) - return (*err = kCCMIOArrayDimensionToLargeErr); - - for (i = 0; i < nDims; ++i) - dimsCopy[i] = dims[i]; - - while (start < end) - { - CCMIOIndex startNodeNum = start / itemsPerNode; - CCMIOIndex endNodeNum = (end - 1) / itemsPerNode; - CCMIOIndex whereDoesThisNodeStart = - (start / itemsPerNode) * itemsPerNode; - - /* Figure out which node we need to be reading from */ - if (start < itemsPerNode) - nodeEx = node; - else - { - snprintf(nodeExName, kCCMIOMaxStringLength, "%s-%u", - kCCMIOExtendedDataName, startNodeNum); - if (ioType == kCCMIOWrite) - { - CCMIOCreateNode(err, node, TRUE, nodeExName, - kCCMIOExtendedDataLabel, &nodeEx); - - if (dims[nDims-1] - whereDoesThisNodeStart < itemsPerNode) - dimsCopy[nDims - 1] = dims[nDims-1] - whereDoesThisNodeStart; - else - dimsCopy[nDims - 1] = itemsPerNode; - CCMIOSetDataTypev(err, nodeEx, dataType, nDims, dimsCopy); - if (*err !=kCCMIONoErr) - return(*err); - } - else - { - if (CCMIOGetNode(NULL, node, nodeExName, &nodeEx) - !=kCCMIONoErr) - return(*err = kCCMIOCorruptFileErr); - } - } - - /* Read/write the next section of data */ - if (startNodeNum == endNodeNum && end - start >= itemsPerNode) - { - (*ADF_RW_All_Data)(nodeEx.node, data, &adfErr); - data += (end - start + 1) * idx2bytes; /*data += size of node*/ - start += (end - start + 1) * dims[nDims - 1]; - } - else - { - CCMIOIndex thisNodeOffsetIdx = start - whereDoesThisNodeStart+1; - CCMIOIndex thisNodeEndIdx; - - if (end - start >= itemsPerNode || startNodeNum != endNodeNum) - /* Note that the starting index is 1 (ADF uses Fortran idx) - so we don't want to subtract 1 here... */ - thisNodeEndIdx = (startNodeNum + 1) * itemsPerNode; - else - thisNodeEndIdx = end; - thisNodeEndIdx = thisNodeEndIdx - whereDoesThisNodeStart; - - if (thisNodeOffsetIdx <= 1 && thisNodeEndIdx == itemsPerNode) - (*ADF_RW_All_Data)(nodeEx.node, data, &adfErr); - else - (*ADF_RW_Block_Data)(nodeEx.node, - ((long)(thisNodeOffsetIdx-1)*itemSize)+1, - (long)thisNodeEndIdx * itemSize, - data, &adfErr); - if (IsADFError(adfErr)) - return(*err = ADFToCCMIOError(adfErr)); - - start += thisNodeEndIdx - thisNodeOffsetIdx + 1; - data += (thisNodeEndIdx - thisNodeOffsetIdx + 1) * idx2bytes; - } - } - } - return(*err = ADFToCCMIOError(adfErr)); -} -#endif /* CCMIO_READ_GLOBAL_DEF */ -/* -------------------- end global section ---------------------------------- */ - -/* Need to use nested macros because concatenation (and stringification) - do not expand their arguments. But STRCAT does, so then it can pass it - onto MAKE_NAME to get concatenated. */ -#define STRCAT(X, Y) MAKE_NAME(X, Y) -#define MAKE_NAME(X, Y) X##Y - -#define CONVERT STRCAT(ConvertTo,TYPE) -TYPE CONVERT( const void *data, CCMIODataType type ) -{ - if (type == kCCMIOInt32) - return((TYPE)(*(int *)data)); - if (type == kCCMIOFloat32) - return((TYPE)(*(float *)data)); - if (type == kCCMIOFloat64) - return((TYPE)(*(double *)data)); - return((TYPE)0xbad0bad0); -} - -#define OLDREAD STRCAT(CCMIOOldRead,TYPE_ABBREV) -CCMIOError OLDREAD( CCMIOError *err, CCMIONode node, int dimension, - int swapDims, TYPE *data, CCMIOIndex start, - CCMIOIndex end ) -{ - CCMIOIndex size; - int nDims, adfErr; - CCMIOIndex i, j, k, *dims; - CCMIODataType nodeType; - CHECK_ERROR(err); - - CCMIOGetDimensions(err, node, &nDims, &dims); - if (nDims != dimension) - { - free(dims); - return(*err = kCCMIOWrongDataTypeErr); - } - CCMIOGetDataType(err, node, &nodeType); - CCMIOGetDataSize(err, node, &size); - - if (swapDims) - { - if (end == 0 || end > (unsigned int)dims[nDims - 1]) - end = dims[0]; - } - else - { - if (end == 0 || end > (unsigned int)dims[nDims - 1]) - end = dims[nDims - 1]; - } - - /* This needs to be fixed if old files are going to be supported. */ - { - char *buffer = (char*) malloc(size); - unsigned int typeSize = CCMIOGetDataTypeSize(nodeType); - TYPE *cBuffer; - if (!buffer) - { - free(dims); - return(*err = kCCMIONoMemoryErr); - } - /*You'd think it wouldn't be necessary to allocate an entire new buffer. - Unfortunately, the original algorithm is completely messed up and - requires it. */ - cBuffer = (TYPE *)malloc(size / typeSize * sizeof(TYPE)); - if (!cBuffer) - { - free(dims); free(buffer); - return(*err = kCCMIONoMemoryErr); - } - - ADF_Read_All_Data(node.node, (char *) buffer, &adfErr); - if (!IsADFError(adfErr)) - { - int l; /* This needs to be signed so that the loop terminates */ - unsigned int delta, itemSize = 1; - - if (swapDims) - { - for (i = 1; i < (unsigned int)nDims; ++i) - itemSize *= dims[i]; - } - else - { - for (l = (unsigned int)nDims - 2; l >= 0; --l) - itemSize *= dims[l]; - } - delta = itemSize * (end - start); - - if (nDims == 2) - { - for (i = 0; i < dims[0]; ++i) - for (j = 0; j < dims[1]; ++j) - cBuffer[i*dims[1] + j] = CONVERT(buffer + typeSize * (dims[0] * j + i), nodeType); - } - else if (nDims == 3) - { - for (i = 0; i < dims[0]; ++i) - for (j = 0; j < dims[1]; ++j) - for (k = 0; k < dims[2]; ++k) - cBuffer[i + j * dims[0] + k * dims[1] * dims[2]] = CONVERT(buffer + typeSize*(i*dims[1]*dims[2] + j*dims[0] + k), nodeType); - } - - for (i = 0, j = itemSize*start; i < delta; ++i, ++j) - data[i] = cBuffer[j]; - - } - free(buffer); - free(cBuffer); - } - free(dims); - return(*err = ADFToCCMIOError(adfErr)); -} - -#define READ STRCAT(CCMIORead,TYPE_ABBREV) -CCMIOError READ( CCMIOError *err, CCMIONode node, int dimension, TYPE *data, - CCMIOIndex start, CCMIOIndex end ) -{ - unsigned int nItems, itemSize = 1; - int nDims; - CCMIOIndex *dims; - CCMIODataType nodeType; - - CHECK_ERROR(err); - - CCMIOGetDimensions(err, node, &nDims, &dims); - if (nDims != dimension) - { - free(dims); - return(*err = kCCMIOWrongDataTypeErr); - } - - CCMIOGetDataType(err, node, &nodeType); - if (nodeType == CCMIOTYPE) - CCMIOExtendedADFIO(err, node, kCCMIORead, CCMIOTYPE, nDims, dims, - (char *)data, start, end); - else - { - void *buffer; - unsigned int i, n, typeSize = CCMIOGetDataTypeSize(nodeType); - - /* start and end are in conceptual units. For example, for a 2D array - verts[100][3], there are 100 units (each of size three), but map[100] - also has 100 units (size one). This is complicated a bit because - ADF is in FORTRAN order, so the order of the dimensions is reversed - from C. */ - nItems = dims[nDims - 1]; - for (i = 0; (int)i < nDims - 1; ++i) - itemSize *= dims[i]; - - if (end == 0 || end > nItems) - end = nItems; - - if (start > end) - { - free(dims); - return(*err = kCCMIOBadParameterErr); - } - - buffer = malloc((end - start + 2) * itemSize * typeSize); - if (!buffer) - { - free(dims); - return(*err = kCCMIONoMemoryErr); - } - if (CCMIOExtendedADFIO(err, node, kCCMIORead, nodeType, nDims, dims, - (char *)buffer, start, end) == kCCMIONoErr) - { - n = (end - start) * itemSize; - for (i = 0; i < n; ++i) - data[i] = CONVERT((char *)buffer + i * typeSize, nodeType); - } - free(buffer); - } - - free(dims); - return(*err); -} - -#define WRITE STRCAT(CCMIOWrite,TYPE_ABBREV) -CCMIOError WRITE( CCMIOError *err, CCMIONode node, int nDims, - const CCMIOIndex *dims, const TYPE *data, - CCMIOIndex start, CCMIOIndex end ) -{ - CHECK_ERROR(err); - - CCMIOExtendedADFIO(err, node, kCCMIOWrite, CCMIOTYPE, nDims, dims, - (char *)data, start, end); - - return(*err); -} - -#define READ_1D STRCAT(CCMIORead1,TYPE_ABBREV) -CCMIOError READ_1D( CCMIOError *err, CCMIONode node, TYPE *data, - CCMIOIndex start, CCMIOIndex end ) -{ - return(READ(err, node, 1, data, start, end)); -} - -#define WRITE_1D STRCAT(CCMIOWrite1,TYPE_ABBREV) -CCMIOError WRITE_1D( CCMIOError *err, CCMIONode node, CCMIOIndex n, - const TYPE *data, CCMIOIndex start, CCMIOIndex end ) -{ -/* long dims[] = { n }; Sun compilers don't like this code */ - CCMIOIndex dims[1]; - dims[0] = n; - - return(WRITE(err, node, 1, dims, data, start, end)); -} - -#define READ_2D STRCAT(CCMIORead2,TYPE_ABBREV) -CCMIOError READ_2D( CCMIOError *err, CCMIONode node, TYPE *data, - CCMIOIndex start, CCMIOIndex end ) -{ - return(READ(err, node, 2, data, start, end)); -} - -#define WRITE_2D STRCAT(CCMIOWrite2,TYPE_ABBREV) -CCMIOError WRITE_2D( CCMIOError *err, CCMIONode node, - CCMIOIndex x, CCMIOIndex y, - const TYPE *data, CCMIOIndex start, CCMIOIndex end ) -{ -/* long dims[] = { x, y }; Sun compilers don't like this */ - CCMIOIndex dims[2]; - dims[0] = x; - dims[1] = y; - - return(WRITE(err, node, 2, dims, data, start, end)); -} - -#define READ_3D STRCAT(CCMIORead3,TYPE_ABBREV) -CCMIOError READ_3D( CCMIOError *err, CCMIONode node, TYPE *data, - CCMIOIndex start, CCMIOIndex end ) -{ - return(READ(err, node, 3, data, start, end)); -} - -#define WRITE_3D STRCAT(CCMIOWrite3,TYPE_ABBREV) -CCMIOError WRITE_3D( CCMIOError *err, CCMIONode node, - CCMIOIndex x, CCMIOIndex y, CCMIOIndex z, - const TYPE *data, CCMIOIndex start, CCMIOIndex end ) -{ -/* long dims[] = { x, y, z }; Sun compilers do not like this */ - CCMIOIndex dims[3]; - dims[0] = x; - dims[1] = y; - dims[2] = z; - - return(WRITE(err, node, 3, dims, data, start, end)); -} - -#define READOPT STRCAT(CCMIOReadOpt,TYPE_ABBREV) -CCMIOError READOPT( CCMIOError *err, CCMIOID parent, const char *name, - TYPE *data ) -{ - char buffer[64]; /* This ought to be big enough for any type */ - int adfErr; - CCMIONode node; - CCMIODataType type; - CHECK_ERROR_AND_CLEAR_PTR(err, data, 0); - - CCMIOGetNode(err, parent.node, name, &node); - CCMIOGetDataType(err, node, &type); - ADF_Read_Block_Data(node.node, 1, 1, buffer, &adfErr); - *err = ADFToCCMIOError(adfErr); - if (*err == kCCMIONoErr) - *data = CONVERT(buffer, type); - - return(*err); -} - -#define READOPT_1D STRCAT(CCMIOReadOpt1,TYPE_ABBREV) -CCMIOError READOPT_1D( CCMIOError *err, CCMIOID parent, const char *name, - TYPE *data, CCMIOIndex start, CCMIOIndex end ) -{ - CCMIONode node; - CHECK_ERROR(err); - if (!data) return(*err = kCCMIOBadParameterErr); - - CCMIOGetNode(err, parent.node, name, &node); - return(READ_1D(err, node, data, start, end)); -} - -#define READOPT_2D STRCAT(CCMIOReadOpt2,TYPE_ABBREV) -CCMIOError READOPT_2D( CCMIOError *err, CCMIOID parent, const char *name, - TYPE *data, CCMIOIndex start, CCMIOIndex end ) -{ - CCMIONode node; - CHECK_ERROR(err); - if (!data) return(*err = kCCMIOBadParameterErr); - - CCMIOGetNode(err, parent.node, name, &node); - if (parent.version < 20300) - { - int nDims, swap = FALSE; - CCMIOIndex *dims; - CCMIOGetDimensions(err, node, &nDims, &dims); - if (nDims == 2 && dims[0] > dims[1]) - swap = TRUE; - free(dims); - return(OLDREAD(err, node, 2, swap, data, start, end)); - } - return(READ_2D(err, node, data, start, end)); -} - -#define READOPT_3D STRCAT(CCMIOReadOpt3,TYPE_ABBREV) -CCMIOError READOPT_3D( CCMIOError *err, CCMIOID parent, const char *name, - TYPE *data, CCMIOIndex start, CCMIOIndex end ) -{ - CCMIONode node; - CHECK_ERROR(err); - if (!data) return(*err = kCCMIOBadParameterErr); - - CCMIOGetNode(err, parent.node, name, &node); - if (parent.version < 20300) - { - int nDims, swap = FALSE; - CCMIOIndex *dims; - CCMIOGetDimensions(err, node, &nDims, &dims); - if (nDims == 2 && (dims[0] > dims[1] || dims[0] > dims[2])) - swap = TRUE; - free(dims); - return(OLDREAD(err, node, 2, swap, data, start, end)); - } - return(READ_3D(err, node, data, start, end)); -} - -#define WRITEOPT_1D STRCAT(CCMIOWriteOpt1,TYPE_ABBREV) -CCMIOError WRITEOPT_1D( CCMIOError *err, const CCMIOID parent, - const char *name, const CCMIOIndex n, const TYPE *data, - const CCMIOIndex start, const CCMIOIndex end ) -{ - static CCMIONode node; - CHECK_ERROR(err); - if (!data) return(*err = kCCMIOBadParameterErr); - - if (start == 0) - CCMIOCreateNode(err, parent.node, TRUE, name, name, &node); - - return(WRITE_1D(err, node, n, data, start, end)); -} -#define WRITEOPT_2D STRCAT(CCMIOWriteOpt2,TYPE_ABBREV) -CCMIOError WRITEOPT_2D( CCMIOError *err, const CCMIOID parent, - const char *name, - const CCMIOIndex x, const CCMIOIndex y, - const TYPE *data, - const CCMIOIndex start, const CCMIOIndex end ) -{ - static CCMIONode node; - CHECK_ERROR(err); - if (!data) return(*err = kCCMIOBadParameterErr); - - if (start == 0) - CCMIOCreateNode(err, parent.node, TRUE, name, name, &node); - - return(WRITE_2D(err, node, y, x, data, start, end)); -} - -#define WRITEOPT_3D STRCAT(CCMIOWriteOpt3,TYPE_ABBREV) -CCMIOError WRITEOPT_3D( CCMIOError *err, CCMIOID parent, const char *name, - CCMIOIndex x, CCMIOIndex y, CCMIOIndex z, - const TYPE *data, - CCMIOIndex start, CCMIOIndex end ) -{ - CCMIONode node; - CHECK_ERROR(err); - if (!data) return(*err = kCCMIOBadParameterErr); - - CCMIOCreateNode(err, parent.node, TRUE, name, name, &node); - return(WRITE_3D(err, node, z, y, x, data, start, end)); -} - - -/* Automatic setting of emacs local variables. */ -/* Local Variables: */ -/* mode: C++ */ -/* tab-width: 8 */ -/* End: */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmiotypes.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmiotypes.h deleted file mode 100644 index 18ba8e542b..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmiotypes.h +++ /dev/null @@ -1,159 +0,0 @@ -#ifndef CCMIO_TYPES_H -#define CCMIO_TYPES_H - -/*@@ - * Program: Star File Format Library - $RCSfile: ccmiotypes.h,v $ - * Author: Geoff Prewett - * Date: July 28, 2003 - * - * - * Star File Format Library - Copyright (C) 2003 by adapco, Ltd. - * - * This program is the property of adapco, Ltd. and contains - * confidential and proprietary information. The unauthorized use, - * distribution, or duplication of this program is prohibited. - * All rights reserved. - * - * $Id: ccmiotypes.h,v 1.11 2006/06/05 21:12:16 geoffp Exp $ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef DEBUG - #define Debugging 1 -#else - #define Debugging 0 -#endif - -#ifndef TRUE - #define TRUE 1 - #define FALSE 0 -#endif - -/** Please see \ref errorpage for details on the use of CCMIOError. */ -typedef enum { - kCCMIONoErr = 0, - kCCMIONoFileErr, - kCCMIOPermissionErr, - kCCMIOCorruptFileErr, - kCCMIOBadLinkErr, - kCCMIONoNodeErr, - kCCMIODuplicateNodeErr, - kCCMIOWrongDataTypeErr, - kCCMIONoDataErr, - kCCMIOWrongParentErr, - kCCMIOBadParameterErr, - kCCMIONoMemoryErr, - kCCMIOIOErr, - kCCMIOTooManyFacesErr, - kCCMIOVersionErr, - kCCMIOArrayDimensionToLargeErr, - kCCMIOInternalErr - } CCMIOError; - -typedef enum { kCCMIOFloat32 = 0, kCCMIOFloat64, kCCMIOInt32, - kCCMIOInt64 /* Internal use only */, - kCCMIOString, kCCMIOUnknownType, kCCMIOBadType, - kCCMIOLastType } CCMIODataType; - -struct _CCMIONode { - double node; - double parent; -}; - -#define kCCMIOEndArgs -1 - -/*typedef unsigned long long CCMIOIndex; - typedef unsigned long long CCMIOSize; */ -typedef unsigned int CCMIOIndex; -typedef unsigned int CCMIOSize; - -typedef enum { kCCMIORead, kCCMIOWrite } CCMIOBufferType; -typedef CCMIOBufferType CCMIOIOType; - -typedef enum { kCCMIOReadData, kCCMIONewData, kCCMIOAddData } CCMIOOpenType; - -typedef struct _CCMIONode CCMIONode; - -#define IGNORE_ERROR(err) \ - CCMIOError dummyErr = kCCMIONoErr; \ - if (!err) err = &dummyErr; - -#define CHECK_ERROR(err) \ - CCMIOError dummyErr = kCCMIONoErr; \ - if (!err) err = &dummyErr; \ - if (*err != kCCMIONoErr) return(*err); - -#define CHECK_ERROR_AND_CLEAR_PTR(err, ptr, null) \ - CCMIOError dummyErr = kCCMIONoErr; \ - if (!err) err = &dummyErr; \ - if (!ptr) return(*err = kCCMIOBadParameterErr); \ - else *ptr = null; \ - if (*err != kCCMIONoErr) return(*err); - -#ifdef _WIN32 - #ifndef snprintf - #if !defined(__NUTC__) - #define snprintf _snprintf - #endif - #endif -#endif -#if defined(__hpux__) || defined(__hpux) || defined(hpux) || defined(__alpha) || defined(__alpha__) - #define kHasSNPrintf 0 -#else - #define kHasSNPrintf 1 -#endif - -typedef enum { kCCMIODimNull = 0, kCCMIOScalar = 1, kCCMIOVector, kCCMIOTensor } CCMIODimensionality; -typedef enum { kCCMIOVertex = 0, kCCMIOCell, kCCMIOFace } CCMIODataLocation; - -/* Defines for CCMIOGetProstarSet() */ -#define kCCMIOCellSet (1 << 0) -#define kCCMIOVertexSet (1 << 1) -#define kCCMIOBoundarySet (1 << 2) -#define kCCMIOBlockSet (1 << 3) -#define kCCMIOSplineSet (1 << 4) -#define kCCMIOCoupleSet (1 << 5) - -/* Keep in sync with gEntityNames and gTypeNames in ccmio.c */ -typedef enum { kCCMIONull = -1, kCCMIOMap = 0, kCCMIOVertices, kCCMIOTopology, - kCCMIOInternalFaces, kCCMIOBoundaryFaces, kCCMIOCells, - kCCMIOProblemDescription, kCCMIOFieldSet, kCCMIOField, - kCCMIOFieldData, kCCMIOState, kCCMIOProcessor, kCCMIOCellType, - kCCMIOBoundaryRegion, kCCMIOLagrangianData, kCCMIOInterfaces, - kCCMIOFieldPhase, kCCMIORestart, kCCMIORestartData, - kCCMIOReferenceData, kCCMIOModelConstants, kCCMIOProstarSet, - kCCMIOMaxEntity } CCMIOEntity; - -typedef enum { kCCMIOVectorX = 0, kCCMIOVectorY, kCCMIOVectorZ, - kCCMIOTensorXX = 0, kCCMIOTensorXY, kCCMIOTensorXZ, - kCCMIOTensorYX, kCCMIOTensorYY, kCCMIOTensorYZ, - kCCMIOTensorZX, kCCMIOTensorZY, kCCMIOTensorZZ } CCMIOComponent; - -typedef struct { - CCMIONode root; - CCMIONode node; - int id; - CCMIOEntity type; - int version; -} CCMIOID; - -#define kCCMIOMaxDimension 4 -#define kCCMIOMaxStringLength 32 -#define kCCMIOProstarShortNameLength 8 -#define kCCMIOStart 0ul -#define kCCMIOEnd 0ul - -#ifdef __cplusplus - } -#endif -#endif /* CCMIO_TYPES_H */ - - -/* Automatic setting of emacs local variables. */ -/* Local Variables: */ -/* mode: C++ */ -/* tab-width: 8 */ -/* End: */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioutility.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioutility.c deleted file mode 100644 index b7759b53ea..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioutility.c +++ /dev/null @@ -1,358 +0,0 @@ -#ifndef CCMIO_UTILITY_C -#define CCMIO_UTILITY_C - -/*@@ - * Program: Star File Format Library - $RCSfile: ccmioutility.c,v $ - * Author: Geoff Prewett - * Date: August 28, 2003 - * - * - * Star File Format Library - Copyright (C) 2003 by adapco, Ltd. - * - * This program is the property of adapco, Ltd. and contains - * confidential and proprietary information. The unauthorized use, - * distribution, or duplication of this program is prohibited. - * All rights reserved. - * - * $Id: ccmioutility.c,v 1.13 2006/06/06 12:09:54 jal Exp $ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "ccmioutility.h" -#include "ccmiocore.h" -#include "ccmioprivate.h" -#include "libadf/ADF.h" /* Only for ADF_MAX_DIMENSIONS */ - -#ifndef MAKEDEPEND -#include -#include -#include -#include -#ifdef _WIN32 - #include - #include - #define getcwd _getcwd - #define mktemp _mktemp -#else - #include - #include /* for rindex() */ -#endif -#endif - -/* Visual C++ 6 and HP compilers can't tell that a static const int is the - same as a #define */ -#define kMaxPath 10000 /* This does not seem to be defined - in a reasonable location, so just - make it big enough for everyone. */ - -static CCMIOError CCMIOWriteNodeCore( CCMIOError *err, CCMIONode parent, - const char *name, CCMIODataType type, - void *value ); -static CCMIOError CCMIOReadNodeCore( CCMIOError *err, CCMIONode parent, - const char *name, CCMIODataType type, - void *value ); - -CCMIOError CCMIOWriteNodei( CCMIOError *err, CCMIONode parent, const char *name, - int value ) -{ - return(CCMIOWriteNodeCore(err, parent, name, kCCMIOInt32, (void *)&value)); -} - -CCMIOError CCMIOWriteNodef( CCMIOError *err, CCMIONode parent, const char *name, - float value ) -{ - return(CCMIOWriteNodeCore(err, parent, name, kCCMIOFloat32, (void *)&value)); -} - -CCMIOError CCMIOWriteNoded( CCMIOError *err, CCMIONode parent, const char *name, - double value ) -{ - return(CCMIOWriteNodeCore(err, parent, name, kCCMIOFloat64, (void *)&value)); -} - -CCMIOError CCMIOWriteNodeCore( CCMIOError *err, CCMIONode parent, - const char *name, CCMIODataType type, - void *value ) -{ - CCMIOIndex dims = 1; - CCMIONode child; - CHECK_ERROR(err); - - CCMIOCreateNode(err, parent, TRUE, name, name, &child); - CCMIOSetDataType(err, child, type, 1ul, kCCMIOEndArgs); - CCMIOExtendedADFIO(err, child, kCCMIOWrite, type, 1, &dims, - (char *)value, kCCMIOStart, kCCMIOEnd); - return(*err); -} - -CCMIOError CCMIOWriteNodestr( CCMIOError *err, CCMIONode parent, - const char *name, const char *value ) -{ - CCMIOIndex dims = strlen(value); - CCMIONode child; - CHECK_ERROR(err); - - CCMIOCreateNode(err, parent, TRUE, name, name, &child); - CCMIOSetDataType(err, child, kCCMIOString, dims, kCCMIOEndArgs); - CCMIOExtendedADFIO(err, child, kCCMIOWrite, kCCMIOString, 1, &dims, - (char *)value, kCCMIOStart, kCCMIOEnd); - return(*err); -} - -CCMIOError CCMIOReadNodei( CCMIOError *err, CCMIONode parent, const char *name, - int *value ) -{ - if (value) *value = 0; - return(CCMIOReadNodeCore(err, parent, name, kCCMIOInt32, (void *)value)); -} - -CCMIOError CCMIOReadNodef( CCMIOError *err, CCMIONode parent, const char *name, - float *value ) -{ - if (value) *value = 0; - return(CCMIOReadNodeCore(err, parent, name, kCCMIOFloat32, (void *)value)); -} - -CCMIOError CCMIOReadNoded( CCMIOError *err, CCMIONode parent, const char *name, - double *value ) -{ - if (value) *value = 0; - return(CCMIOReadNodeCore(err, parent, name, kCCMIOFloat64, (void *)value)); -} - -CCMIOError CCMIOReadNodeCore( CCMIOError *err, CCMIONode parent, - const char *name, CCMIODataType type, void *value) -{ - CCMIOIndex dims = 1; - CCMIONode child; - CHECK_ERROR(err); - if (!value) return(*err = kCCMIOBadParameterErr); - - CCMIOGetNode(err, parent, name, &child); - CCMIOExtendedADFIO(err, child, kCCMIORead, type, 1, &dims, - (char *)value, kCCMIOStart, kCCMIOEnd); - return(*err); -} - -CCMIOError CCMIOReadNodestr( CCMIOError *err, CCMIONode parent, - const char *name, char **value ) -{ - { - CCMIONode child; - CHECK_ERROR_AND_CLEAR_PTR(err, value, 0); - - CCMIOGetNode(err, parent, name, &child); - if (*err == kCCMIONoErr) - { - CCMIOSize size; - - CCMIOGetDataSize(err, child, &size); - *value = (char *)malloc((size + 1) * sizeof(char)); - CCMIOExtendedADFIO(err, child, kCCMIORead, kCCMIOString, 1, &size, - (char *)*value, kCCMIOStart, kCCMIOEnd); - if (*err == kCCMIONoDataErr) - { - (*value)[0] = '\0'; - *err = kCCMIONoErr; - } - else - (*value)[size] = '\0'; - } - return(*err); - } -} - -/* CCMIORead*() and CCMIOWrite*() are actually included in ccmio.c, in order to - limit the amount of fake templating. */ - -CCMIOError CCMIOGetNextChildWithLabel( CCMIOError *err, CCMIONode parent, - const char *label, int *n, - CCMIONode *child ) -{ - char nodeLabel[kCCMIOMaxStringLength + 1]; - CHECK_ERROR(err); - if (!child || !n) return(*err = kCCMIOBadParameterErr); - - do { - CCMIOGetNextChild(err, parent, n, child); - if ((*err) == kCCMIONoErr) - { - CCMIOGetLabel(err, *child, nodeLabel); - if (strcmp(label, nodeLabel) == 0) - return(*err); - } - } while ((*err) == kCCMIONoErr); - - return(*err); -} - -CCMIOError CCMIOCompress( CCMIOError *err, char *filename ) -{ - char *dirPtr, *tmpFilename, *moved = NULL; - char basename[kMaxPath + 1]; - unsigned int bytes = 0, i; - CCMIONode origRoot, copyRoot; - CHECK_ERROR(err); - if (!filename) return(*err = kCCMIOBadParameterErr); - -#if (defined(_WIN32) && !defined(__NUTC__)) - if ((dirPtr = strrchr(filename, '\\')) == NULL) -#else - if ((dirPtr = rindex(filename, '/')) == NULL) -#endif - { - if (!getcwd(basename, kMaxPath)) - return(*err = kCCMIOIOErr); - bytes = strlen(basename); - } - else - { - bytes = dirPtr - filename; - if (bytes > kMaxPath) - bytes = kMaxPath; - strncpy(basename, filename, bytes); - basename[bytes] = '\0'; - } - - basename[bytes++] = '/'; - for (i = 0; i < 6; ++i) - basename[bytes++] = 'X'; - basename[bytes] = '\0'; - tmpFilename = strdup(basename); - if (!mktemp(tmpFilename)) - return(*err = kCCMIOIOErr); - - *err = CCMIOOpen(filename, kCCMIORead, &origRoot); - if ((*err) != kCCMIONoErr) - goto error; - *err = CCMIOOpen(tmpFilename, kCCMIOWrite, ©Root); - if ((*err) != kCCMIONoErr) - { - CCMIOClose(origRoot); - goto error; - } - - CCMIOCopyNode(err, origRoot, copyRoot, TRUE); - - CCMIOClose(copyRoot); - CCMIOClose(origRoot); - - /* Rename the original file (just in case the rename of the new file fails), - rename the temporary file to the original name, and delete the moved - file */ - if ((*err) == kCCMIONoErr) - { - moved = strdup(basename); - if (!mktemp(moved)) - goto error; - errno = 0; - rename(filename, moved); - if (errno) - goto error; - rename(tmpFilename, filename); - if (errno) - { - rename(moved, filename); - goto error; - } - remove(moved); - } - else - goto error; - - free(moved); - free(tmpFilename); - return(*err); - - error: - remove(tmpFilename); - free(moved); - free(tmpFilename); - return(*err = kCCMIOIOErr); -} - -CCMIOError CCMIOCopyNode( CCMIOError *err, CCMIONode origNode, - CCMIONode copyNode, int copyExists ) -{ - char *bytes = NULL; - char name[kCCMIOMaxStringLength + 1], label[kCCMIOMaxStringLength + 1]; - int adfErr, n = 0, nDims, dims[ADF_MAX_DIMENSIONS]; - unsigned int size; - CCMIONode copyParent, origChild; - CCMIODataType type; - CHECK_ERROR(err); - - CCMIOGetName(err, origNode, name); - CCMIOGetLabel(err, origNode, label); - CCMIOGetDataType(err, origNode, &type); - /* Can't call CCMIOGetDimensions or CCMIOGetDataSize here, because - we are doing a low-level copy of just this node, not any of the - extended data nodes. We'll copy those when we copy the children. */ - GetADFNodeDimensions(err, origNode, &nDims, dims); - size = GetADFNodeDataSize(err, origNode); - - if (size) - { - bytes = (char*)malloc(size); - if (!bytes) - { - free(dims); - return(*err = kCCMIONoMemoryErr); - } - ADF_Read_All_Data(origNode.node, bytes, &adfErr); - if (IsADFError(adfErr)) - return(*err = ADFToCCMIOError(adfErr)); - } - - if (copyExists) - { - /* Can't set the name of the root node, because it doesn't have a - parent */ - CCMIONode rootNode; - CCMIOGetRootNode(err, copyNode, &rootNode); - if (!CCMIOAreNodesEqual(copyNode, rootNode)) - CCMIOSetName(err, copyNode, name); - - CCMIOSetLabel(err, copyNode, name); - } - else - { - copyParent = copyNode; - /* Need to pass TRUE because CCMIOOpen always creates a "general" - node; otherwise we will get duplicate node errors */ - CCMIOCreateNode(err, copyParent, TRUE, name, label, ©Node); - } - /* Can't call CCMIOSetDataTypev() for the same reason as above */ - ADF_Put_Dimension_Information(copyNode.node, CCMIOGetDataTypeADFName(type), - nDims, dims, &adfErr); - *err = ADFToCCMIOError(adfErr); - if (size && *err == kCCMIONoErr) - { - ADF_Write_All_Data(copyNode.node, bytes, &adfErr); - if (IsADFError(adfErr)) - return(*err = ADFToCCMIOError(adfErr)); - } - - free(bytes); - - while (CCMIOGetNextChild(err, origNode, &n, &origChild) == kCCMIONoErr) - CCMIOCopyNode(err, origChild, copyNode, FALSE); - if ((*err) == kCCMIONoNodeErr) - *err = kCCMIONoErr; - - return(*err); -} -#ifdef __cplusplus -} -#endif -#endif /* CCMIO_UTILITY_C */ - - -/* Automatic setting of emacs local variables. */ -/* Local Variables: */ -/* mode: C++ */ -/* tab-width: 8 */ -/* End: */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioutility.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioutility.h deleted file mode 100644 index dc4702cd63..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioutility.h +++ /dev/null @@ -1,186 +0,0 @@ -#ifndef CCMIO_UTILITY_H -#define CCMIO_UTILITY_H - -/*@@ - * Program: Star File Format Library - $RCSfile: ccmioutility.h,v $ - * Author: Geoff Prewett - * Date: August 28, 2003 - * - * - * Star File Format Library - Copyright (C) 2003 by adapco, Ltd. - * - * This program is the property of adapco, Ltd. and contains - * confidential and proprietary information. The unauthorized use, - * distribution, or duplication of this program is prohibited. - * All rights reserved. - * - * $Id: ccmioutility.h,v 1.9 2006/06/05 21:12:16 geoffp Exp $ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "libccmio/ccmiotypes.h" - -/* \{ - \name Utility functions - \brief Condenses common tasks - \ingroup core */ - -/** Creates a child node of parent with given name and value */ -extern CCMIOError CCMIOWriteNodei( CCMIOError *err, CCMIONode parent, - char const *name, int value ); - -/** Creates a child node of parent with given name and value */ -extern CCMIOError CCMIOWriteNodef( CCMIOError *err, CCMIONode parent, - char const *name, float value ); - -/** Creates a child node of parent with given name and value */ -extern CCMIOError CCMIOWriteNoded( CCMIOError *err, CCMIONode parent, - char const *name, double value ); - -/** Creates a child node of parent with given name and string value */ -extern CCMIOError CCMIOWriteNodestr( CCMIOError *err, CCMIONode parent, - char const *name, char const *value ); - -/** Reads the value of a child node; returns \def kCCMIOWrongDataTypeErr if - the type of the node is not \def kCCMIOInt32. */ -extern CCMIOError CCMIOReadNodei( CCMIOError *err, CCMIONode parent, - char const *name, int *value ); - -/** Reads the value of a child node; returns \def kCCMIOWrongDataTypeErr if - the type of the node is not \def kCCMIOFloat32. */ -extern CCMIOError CCMIOReadNodef( CCMIOError *err, CCMIONode parent, - char const *name, float *value ); - -/** Reads the value of a child node; returns \def kCCMIOWrongDataTypeErr if - the type of the node is not \def kCCMIOFloat64. */ -extern CCMIOError CCMIOReadNoded( CCMIOError *err, CCMIONode parent, - char const *name, double *value ); - -/** Reads the value of a child node; returns \def kCCMIOWrongDataTypeErr if - the type of the node is not \def kCCMIOString. The string returned is - allocated by the library and must be freed by the application. */ -extern CCMIOError CCMIOReadNodestr( CCMIOError *err, CCMIONode parent, - char const *name, char **value ); - -/* CCMIORead*() and CCMIOWrite*() are actually included in ccmio.c, in order - to limit the amount of fake templating. */ - -/** Reads the entire contents of the node into the array provided. The array - must be the proper size (which can be determined with - CCMIOGetDimensions()). If actual node data is stored in a different format - than requested, it will be converted. For multidimensional arrays, the - parameter isC specifies whether the data should be returned in Fortran or C - order. Since data is stored in Fortran order on disk, returning C order - involves an extra copy. */ -extern CCMIOError CCMIORead1i( CCMIOError *err, CCMIONode node, int *data, - CCMIOIndex start, CCMIOIndex end ); -extern CCMIOError CCMIORead1f( CCMIOError *err, CCMIONode node, float *data, - CCMIOIndex start, CCMIOIndex end ); -extern CCMIOError CCMIORead1d( CCMIOError *err, CCMIONode node, double *data, - CCMIOIndex start, CCMIOIndex end ); -extern CCMIOError CCMIORead2i( CCMIOError *err, CCMIONode node, int *data, - CCMIOIndex start, CCMIOIndex end ); -extern CCMIOError CCMIORead2f( CCMIOError *err, CCMIONode node, float *data, - CCMIOIndex start, CCMIOIndex end ); -extern CCMIOError CCMIORead2d( CCMIOError *err, CCMIONode node, double *data, - CCMIOIndex start, CCMIOIndex end ); -extern CCMIOError CCMIORead3i( CCMIOError *err, CCMIONode node, int *data, - CCMIOIndex start, CCMIOIndex end ); -extern CCMIOError CCMIORead3f( CCMIOError *err, CCMIONode node, float *data, - CCMIOIndex start, CCMIOIndex end ); -extern CCMIOError CCMIORead3d( CCMIOError *err, CCMIONode node, double *data, - CCMIOIndex start, CCMIOIndex end ); - -/** Writes the entire array to the node. The node's size and data type will - be automatically set to the proper values. See CCMIORead*() for comments on - the isC parameter. */ -extern CCMIOError CCMIOWrite1i( CCMIOError *err, CCMIONode node, CCMIOIndex n, - int const *data, CCMIOIndex start, - CCMIOIndex end ); -extern CCMIOError CCMIOWrite1f( CCMIOError *err, CCMIONode node, CCMIOIndex n, - float const *data, CCMIOIndex start, - CCMIOIndex end ); -extern CCMIOError CCMIOWrite1d( CCMIOError *err, CCMIONode node, CCMIOIndex n, - double const *data, CCMIOIndex start, - CCMIOIndex end ); -extern CCMIOError CCMIOWrite2i( CCMIOError *err, CCMIONode node, - CCMIOIndex x, CCMIOIndex y, - int const *data, - CCMIOIndex start, CCMIOIndex end ); -extern CCMIOError CCMIOWrite2f( CCMIOError *err, CCMIONode node, - CCMIOIndex x, CCMIOIndex y, - float const *data, - CCMIOIndex start, CCMIOIndex end ); -extern CCMIOError CCMIOWrite2d( CCMIOError *err, CCMIONode node, - CCMIOIndex x, CCMIOIndex y, - double const *data, - CCMIOIndex start, CCMIOIndex end ); -extern CCMIOError CCMIOWrite3i( CCMIOError *err, CCMIONode node, - CCMIOIndex x, CCMIOIndex y, - CCMIOIndex z, int const *data, - CCMIOIndex start, CCMIOIndex end ); -extern CCMIOError CCMIOWrite3f( CCMIOError *err, CCMIONode node, - CCMIOIndex x, CCMIOIndex y, - CCMIOIndex z, float const *data, - CCMIOIndex start, CCMIOIndex end ); -extern CCMIOError CCMIOWrite3d( CCMIOError *err, CCMIONode node, - CCMIOIndex x, CCMIOIndex y, - CCMIOIndex z, double const *data, - CCMIOIndex start, CCMIOIndex end ); - -/** \internal */ -CCMIOError CCMIOOldReadf( CCMIOError *err, CCMIONode node, int dimension, - int swapDims, float *data, CCMIOIndex start, - CCMIOIndex end ); -/** \internal */ -CCMIOError CCMIOOldReadd( CCMIOError *err, CCMIONode node, int dimension, - int swapDims, double *data, CCMIOIndex start, - CCMIOIndex end ); -/** \internal */ -CCMIOError CCMIOOldReadi( CCMIOError *err, CCMIONode node, int dimension, - int swapDims, int *data, CCMIOIndex start, - CCMIOIndex end ); - -/** Recursively copies a node. origNode and copyNode need not be from - the same file. - \param origNode The node to be copied. - \param copyNode If copyExists is TRUE, then copyNode is the - node to be copied over. Otherwise, it - is the parent, and a copy of origNode will be - created as a child. - \param copyExists Determines the function of copyNode. */ -extern CCMIOError CCMIOCopyNode( CCMIOError *err, CCMIONode origNode, - CCMIONode copyNode, int copyExists ); -/** Same as CCMIOGetNextChild() (particularly with respect to the parameter n) - except that it only returns children with the specified label. */ -extern CCMIOError CCMIOGetNextChildWithLabel( CCMIOError *err, CCMIONode parent, - char const *label, int *n, - CCMIONode *child ); - -/** Compresses the CCMIO file specified. This is occasionally necessary becase - ADF (the underlying storage format) leaks disk space; ADF does not - completely recover the space when a node is delete or is rewritten with - less information. The compression is performed by copying the data to - a new ADF file, which is then renamed to the original name. - This function will correctly compress CCMIO files, and will probably, but - not necessarily, correctly compress ADF files. Also note that this function - requires temporary storage equal to the size of the original file in the - same filesystem as the original file and should not be called frequently, - as it may take a some time. */ -CCMIOError CCMIOCompress( CCMIOError *err, char *filename ); - -/* \} */ -#ifdef __cplusplus -} -#endif -#endif /* CCMIO_UTILITY_H */ - - -/* Automatic setting of emacs local variables. */ -/* Local Variables: */ -/* mode: C++ */ -/* tab-width: 8 */ -/* End: */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioverifymesh.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioverifymesh.c deleted file mode 100644 index 37ca9bbc2b..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioverifymesh.c +++ /dev/null @@ -1,574 +0,0 @@ -#ifndef CCMIOMESH_VERIFY_C -#define CCMIOMESH_VERIFY_C - -/*@@ - * Program: Star File Format Library - $RCSfile: ccmioverifymesh.c,v $ - * Author: Geoff Prewett - * Date: Sept 18, 2003 - * - * - * Star File Format Library - Copyright (C) 2003 by adapco, Ltd. - * - * This program is the property of adapco, Ltd. and contains - * confidential and proprietary information. The unauthorized use, - * distribution, or duplication of this program is prohibited. - * All rights reserved. - * - * $Id: ccmioverifymesh.c,v 1.4 2005/01/11 21:51:20 wo Exp $ - */ - -#ifndef MAKEDEPEND -#include -#include -#include -#include -#include /* tolower */ -#endif - -#include "ccmio.h" -#include "ccmiocore.h" -#include "ccmioutility.h" -#include "ccmiomesh.h" -#include "ccmiopost.h" -#include "ccmioverifymesh.h" - -typedef struct { - int valid; - int scratch; - char meshID[32]; - union { - CCMIOMeshVertexf vertex; - CCMIOMeshCell cell; - struct { - int isInternal; - CCMIOMeshFace face; - } face; - } u; -} Item; - -typedef struct { - int size; - Item *items; -} Data; - -#define ERR stdout -const float kBigCoord = 100000.0; -const float kSmallScale = 1e-4; -const float kBigScale = 1e4; -const char kMaxGlobalIDName[] = "maxGlobal%sID"; -const char kNBoundsName[] = "numBoundTypes"; -const float kMaxPostVal = 1e13; -const float kMinPostVal = -1e13; - -static const char gEntityNames[kCCMIOMeshLast][32] = { - "kCCMIOMeshVertexData", "kCCMIOMeshCellData", - "kCCMIOMeshNextBoundaryFaceData", "kCCMIOMeshInternalFaceData" }; - -static const char gNames[kCCMIOMeshLast][32] = - { "Vertex", "Cell", "Boundary face", "Internal face" }; - -static CCMIOError CountMeshEntities( CCMIOError *err, CCMIOProcessor proc, - int *nMeshes, - int *nVerts, int *maxVertID, - int *nCells, int *maxCellID, - int *nFaces, int *maxFaceID ); -static CCMIOError LoadAndCheckEntity( CCMIOError *err, CCMIOMesh mesh, - CCMIOPost post, CCMIOMeshEntity which, - Data *globalData, const char *meshID ); -static CCMIOError VerifyEntityPostData( CCMIOError *err, CCMIOPost post, - CCMIOMeshEntity which, int boundaryID, - int maxID, int *ids, int nExpected, - const char *meshID ); - -CCMIOError CCMIOCheckProcessorMesh( CCMIOError *err, CCMIOProcessor proc ) -{ - if (err && ((*err) != kCCMIONoErr)) - fprintf(ERR, "Error; mesh checking not performed\n"); - - { - int i, j, nMeshes, nVerts, nCells, nFaces, nBounds = 0; - int maxVertID, maxCellID, maxFaceID; - int iDom = 0, iSDom = 0; - char domName[kCCMIOMaxStringLength + 1], sdomName[kCCMIOMaxStringLength+1]; - Data vertices, cells, faces; - CCMIODomain domain; - CCMIOSubDomain sdom; - CCMIOMesh mesh; - CCMIOPost post; - CHECK_ERROR(err); - - fprintf(ERR, "Verifying mesh...\n"); - - /* Allocate all the arrays */ - CountMeshEntities(err, proc, &nMeshes, &nVerts, &maxVertID, &nCells, - &maxCellID, &nFaces, &maxFaceID); - vertices.items = (Item *)calloc(sizeof(Item), maxVertID + 1); - if (!vertices.items) - return(*err = kCCMIONoMemoryErr); - vertices.size = maxVertID; - cells.items = (Item *)calloc(sizeof(Item), maxCellID + 1); - if (!cells.items) - { - free(vertices.items); - return(*err = kCCMIONoMemoryErr); - } - cells.size = maxCellID; - faces.items = (Item *)calloc(sizeof(Item), maxFaceID + 1); - if (!faces.items) - { - free(vertices.items); - free(cells.items); - return(*err = kCCMIONoMemoryErr); - } - faces.size = maxFaceID; - - /* Read in the data */ - while (CCMIOProcessorGetNextDomainName(NULL, proc, &iDom, domName) - == kCCMIONoErr) - { - CCMIODomainOpen(err, proc, domName, FALSE, &domain); - iSDom = 0; - while (CCMIODomainGetNextSubDomainName(NULL, domain, &iSDom, - sdomName) == kCCMIONoErr) - { - char *name = sdomName; - int dimension; - float scale; -/* - printf("Reading mesh from domain %d, subdomain %d\n", domN, sdomN); -*/ - CCMIOSubDomainOpen(err, domain, sdomName, FALSE, &sdom); - CCMIOMeshOpen(err, sdom, kCCMIORead, &mesh); - CCMIOMeshEnable(err, mesh, kCCMIOMeshFloatVertex, TRUE); - CCMIOMeshGetDimension(err, mesh, &dimension); - if (dimension < 2 || dimension > 3) - fprintf(ERR, "Mesh %s has invalid dimension (%d)\n", name, - dimension); - CCMIOMeshGetScaleFactor(err, mesh, &scale); - if (scale < 0) - fprintf(ERR, "Mesh %s has negative scale factor!\n", name); - else if (scale < kSmallScale || scale > kBigScale) - fprintf(ERR, "Mesh %s has a suspicious scale factor (%f).\n", - name, scale); - - if (CCMIOPostOpen(NULL, sdom, kCCMIORead, &post) != kCCMIONoErr) - post = NULL; - if ((*err) != kCCMIONoErr) - fprintf(ERR, "Error %d after open and initial check of mesh.\n", - *err); - - LoadAndCheckEntity(err, mesh, post, kCCMIOMeshVertexData, &vertices, - name); - if ((*err) != kCCMIONoErr) - fprintf(ERR, "Error %d after loading vertices of mesh.\n",*err); - - LoadAndCheckEntity(err, mesh, post, kCCMIOMeshCellData, &cells, name); - if ((*err) != kCCMIONoErr) - fprintf(ERR, "Error %d after loading cells of mesh.\n",*err); - - LoadAndCheckEntity(err, mesh, post, kCCMIOMeshInternalFaceData, - &faces, name); - if ((*err) != kCCMIONoErr) - fprintf(ERR, "Error %d after loading internal faces of mesh.\n", - *err); - - if ((*err) == kCCMIONoErr) - { - int written; - - nBounds = 0; - while (LoadAndCheckEntity(err, mesh, post, - kCCMIOMeshNextBoundaryFaceData, - &faces, name) == kCCMIONoErr) - nBounds++; - *err = kCCMIONoErr; - CCMIOReadNodei(err, mesh->node, kNBoundsName, &written); - if (written != nBounds) - fprintf(ERR, "Mesh %s specifies %d boundaries but actually has %d.\n", name, written, nBounds); - else if (nBounds == 0) - fprintf(ERR, "Mesh %s has no boundary faces.\n", name); - } - CCMIOMeshClose(err, mesh); - CCMIOSubDomainClose(err, sdom); - if ((*err) != kCCMIONoErr) - { - fprintf(ERR, "Error reading mesh %s; some checks not performed.\n", name); - CCMIODomainClose(err, domain); - goto error; - } - } - CCMIODomainClose(err, domain); - } - - /* Check that all vertices are on some face */ - for (i = 0; i <= vertices.size; ++i) - vertices.items[i].scratch = 0; - for (i = 0; i <= faces.size; ++i) - { - if (!faces.items[i].valid) continue; - for (j = 0; j < faces.items[i].u.face.face.nVerts; ++j) - { - int vertID = faces.items[i].u.face.face.vertices[j]; - - if (vertID > vertices.size) - fprintf(ERR, "Face %d of mesh %s: Vertex %d (ID = %d) is out of range\n", faces.items[i].u.face.face.id, faces.items[i].meshID, j, vertID); - else if (!vertices.items[vertID].valid) - fprintf(ERR, "Face %d of mesh %s: Vertex %d (ID = %d) does not exist\n", faces.items[i].u.face.face.id, faces.items[i].meshID, j, vertID); - else - vertices.items[vertID].scratch++; - } - } - for (i = 0; i <= vertices.size; ++i) - { - if (vertices.items[i].valid && vertices.items[i].scratch == 0) - fprintf(ERR, "Vertex ID %d (mesh %s) is unused.\n", i, - vertices.items[i].meshID); - } - - /* Check that cell has at least four faces */ - for (i = 0; i <= cells.size; ++i) - cells.items[i].scratch = 0; - for (i = 0; i <= faces.size; ++i) - { - int cell1, cell2 = 0; - if (!faces.items[i].valid) continue; - - if (faces.items[i].u.face.isInternal) - { - cell1 = faces.items[i].u.face.face.u.internal.cell[0]; - cell2 = faces.items[i].u.face.face.u.internal.cell[1]; - } - else - cell1 = faces.items[i].u.face.face.u.boundary.cell; - - if (cell1 < 0 || cell1 > cells.size) - fprintf(ERR, "Face %d of mesh %s: Cell %d (ID = %d) is out of range\n", faces.items[i].u.face.face.id, faces.items[i].meshID, i, cell1); - else if (!cells.items[cell1].valid) - fprintf(ERR, "Face %d of mesh %s: Cell %d (ID = %d) does not exist\n", faces.items[i].u.face.face.id, faces.items[i].meshID, i, cell1); - else - cells.items[cell1].scratch++; - if (faces.items[i].u.face.isInternal) - { - if (cell2 < 0 || cell2 > cells.size) - fprintf(ERR, "Face %d of mesh %s: Cell %d (ID = %d) is out of range\n", faces.items[i].u.face.face.id, faces.items[i].meshID, i, cell2); - else if (!cells.items[cell2].valid) - fprintf(ERR, "Face %d of mesh %s: Cell %d (ID = %d) does not exist\n", faces.items[i].u.face.face.id, faces.items[i].meshID, i, cell2); - else - cells.items[cell2].scratch++; - } - } - for (i = 0; i <= cells.size; ++i) - { - if (cells.items[i].valid && cells.items[i].scratch < 4) - fprintf(ERR, "Cell ID %d (mesh %s) has fewer than 4 faces (%d).\n", - i, cells.items[i].meshID, cells.items[i].scratch); - } - - error: - free(vertices.items); - free(cells.items); - free(faces.items); - if ((*err) != kCCMIONoErr) - fprintf(ERR, "Error %d occurred during verification.\n", *err); - return(*err); - } /* end of CHECK_ERROR scope */ -} - -CCMIOError LoadAndCheckEntity( CCMIOError *err, CCMIOMesh mesh, CCMIOPost post, - CCMIOMeshEntity which, Data *globalData, - const char *meshID ) -{ - int i, n, id = 0, max, maxID = 0, *ids = NULL, boundaryID = 0; - CCMIONode node; - CCMIODataSet entity; - CCMIOMeshVertexf vertex; - CCMIOMeshCell cell; - CCMIOMeshFace face; - - CHECK_ERROR(err); - CCMIOMeshReadEntityOpen(err, mesh, which, &n, &max, &entity); - if ((*err) == kCCMIONoErr && post) - ids = (int *)calloc(sizeof(int), max + 1); /* ID list for post check */ - if ((*err) != kCCMIONoErr && which != kCCMIOMeshNextBoundaryFaceData) - { - fprintf(ERR, "Mesh %s has no %c%s data.\n", meshID, tolower(gNames[(int)which][0]), gNames[(int)which]+1); - return(*err); - } - for (i = 0; i < n && (*err) == kCCMIONoErr; ++i) - { - switch(which) - { - case kCCMIOMeshVertexData: - CCMIOMeshReadNextVertexf(err, entity, &vertex); - id = vertex.id; - if (fabsf(vertex.coord[0]) > kBigCoord || - fabsf(vertex.coord[1]) > kBigCoord || - fabsf(vertex.coord[2]) > kBigCoord) - fprintf(ERR, "Vertex %d (index %d) in mesh %s is out of range:\n (%f, %f, %f)\n", vertex.id, vertex.index, meshID, vertex.coord[0], vertex.coord[1], vertex.coord[2]); - break; - case kCCMIOMeshCellData: - CCMIOMeshReadNextCell(err, entity, &cell); - id = cell.id; - break; - case kCCMIOMeshInternalFaceData: - case kCCMIOMeshNextBoundaryFaceData: - CCMIOMeshReadNextFace(err, entity, &face); - id = face.id; - if (which == kCCMIOMeshNextBoundaryFaceData) - boundaryID = face.u.boundary.boundary; - if (face.nVerts < 3) - fprintf(ERR, "%s %d (index %d) in mesh %s has less than three vertices!\n", gNames[(int)which], face.id, face.index, meshID); - break; - } - if (id > globalData->size) - fprintf(ERR, "%s %d in mesh %s has an ID greater than maximum ID of all the meshes (%d).\n", gNames[(int)which], id, meshID, globalData->size); - else if (id == 0) - fprintf(ERR, "%s %d in mesh %s has ID of zero.\n", gNames[(int)which], id, meshID); - else if (id < 0) - fprintf(ERR, "%s %d in mesh %s has negative ID.\n", gNames[(int)which], id, meshID); - else - { - /* The same vertex may be in multiple meshes (but check that the - coordinates are the same). A boundary face may be in multiple - meshes if it originally was an internal face, but internal - faces and cells can only be in one mesh. */ - if (globalData->items[id].valid == TRUE) - { - if (which == kCCMIOMeshVertexData && - (vertex.coord[0] != globalData->items[id].u.vertex.coord[0] || - vertex.coord[1] != globalData->items[id].u.vertex.coord[1] || - vertex.coord[2] != globalData->items[id].u.vertex.coord[2])) - fprintf(ERR, "Vertex %d (mesh %s) has a different value than defined in mesh %s.\n", id, meshID, globalData->items[id].meshID); - else if (which == kCCMIOMeshCellData || - which == kCCMIOMeshInternalFaceData) - fprintf(ERR, "%s %d in mesh %s is already defined by mesh %s\n", gNames[(int)which], id, meshID, globalData->items[id].meshID); - else if (which == kCCMIOMeshNextBoundaryFaceData) - { - /* If we are adding a boundary face that already exists, - it must be an internal face that was split into two - boundary faces. Merge these back together (after - verifying that this is indeed what happened). */ - int j, equal = 0, cell; - if (face.nVerts != globalData->items[id].u.face.face.nVerts) - { - fprintf(ERR, "%s %d in mesh %s is already defined by mesh %s\n", gNames[(int)which], id, meshID, globalData->items[id].meshID); - fprintf(ERR, "\t(Boundary faces have different number of vertices (%d and %d)).\n", face.nVerts, globalData->items[id].u.face.face.nVerts); - continue; - } - for (j = 0; j < face.nVerts; ++j) - { - if (face.vertices[j] == globalData->items[id].u.face.face.vertices[j]) - equal++; - } - if (equal != face.nVerts) - { - fprintf(ERR, "%s %d in mesh %s is already defined by mesh %s\n", gNames[(int)which], id, meshID, globalData->items[id].meshID); - fprintf(ERR, "\t(Boundary faces have different vertices.\n"); - continue; - } - /* Everything is identical, convert to internal face */ - cell = globalData->items[id].u.face.face.u.boundary.cell; - globalData->items[id].u.face.isInternal = TRUE; - globalData->items[id].u.face.face.u.internal.cell[0] = cell; - globalData->items[id].u.face.face.u.internal.cell[1] = face.u.boundary.cell; - /* Continue, otherwise this will be overwritten */ - continue; - } - } - globalData->items[id].valid = TRUE; - strcpy(globalData->items[id].meshID, meshID); - if (which == kCCMIOMeshVertexData) - memcpy(&globalData->items[id].u.vertex,&vertex,sizeof(vertex)); - else if (which == kCCMIOMeshCellData) - memcpy(&globalData->items[id].u.cell, &cell, sizeof(cell)); - else - { - globalData->items[id].u.face.isInternal = (which == kCCMIOMeshInternalFaceData); - memcpy(&globalData->items[id].u.face.face, &face, sizeof(face)); - } - } - if (id > maxID) - maxID = id; - if (ids) - ids[id] = 1; - } - if (which == kCCMIOMeshVertexData || which == kCCMIOMeshCellData) - { - char name[kCCMIOMaxStringLength + 1]; - CCMIODataSetGetNode(err, entity, &node); -#if kHasSNPrintf - snprintf(name, kCCMIOMaxStringLength + 1, kMaxGlobalIDName, - gNames[(int)which]); -#else - sprintf(name, kMaxGlobalIDName, gNames[(int)which]); -#endif - CCMIOReadNodei(err, node, name, &max); - if (max != maxID && (*err) == kCCMIONoErr) - fprintf(ERR, "For %s in mesh %s:\n\t\tspecified maximum in file (%d) is not observed maximum (%d)\n", gEntityNames[(int)which], meshID, max, maxID); - } - CCMIOMeshEntityClose(err, entity); - if ((*err) != kCCMIONoErr && (*err) != kCCMIONoNodeErr) - fprintf(ERR, "Error reading entity %s.\n", gEntityNames[(int)which]); - if (post && VerifyEntityPostData(NULL, post, which, boundaryID, maxID, ids, - n, meshID) != kCCMIONoErr) - fprintf(ERR, "Error reading post data of mesh '%s'.\n", meshID); - free(ids); - - return(*err); -} - -CCMIOError CountMeshEntities( CCMIOError *err, CCMIOProcessor proc,int *nMeshes, - int *nVerts, int *maxVertID, - int *nCells, int *maxCellID, - int *nFaces, int *maxFaceID ) -{ - int n, maxID, iDom = 0, iSDom = 0; - char domName[kCCMIOMaxStringLength + 1], sdomName[kCCMIOMaxStringLength + 1]; - CCMIODomain domain; - CCMIOSubDomain sdom; - CCMIOMesh mesh; - - if (nMeshes) *nMeshes = 0; - if (nVerts) *nVerts = 0; - if (maxVertID) *maxVertID = 0; - if (nCells) *nCells = 0; - if (maxCellID) *maxCellID = 0; - if (nFaces) *nFaces = 0; - if (maxFaceID) *maxFaceID = 0; - - { - CHECK_ERROR(err); - while (CCMIOProcessorGetNextDomainName(err, proc, &iDom, domName) - == kCCMIONoErr) - { - CCMIODomainOpen(err, proc, domName, FALSE, &domain); - iSDom = 0; - while (CCMIODomainGetNextSubDomainName(err, domain, &iSDom, - sdomName) == kCCMIONoErr) - { - CCMIOSubDomainOpen(err, domain, sdomName, FALSE, &sdom); - CCMIOMeshOpen(err, sdom, kCCMIORead, &mesh); - *nMeshes += 1; - - CCMIOMeshGetEntitySize(err, mesh, kCCMIOMeshVertexData, &n, &maxID); - *nVerts += n; - if (maxID > *maxVertID) - *maxVertID = maxID; - - CCMIOMeshGetEntitySize(err, mesh, kCCMIOMeshCellData, &n, &maxID); - *nCells += n; - if (maxID > *maxCellID) - *maxCellID = maxID; - - CCMIOMeshGetEntitySize(err, mesh, kCCMIOMeshInternalFaceData, - &n, &maxID); - *nFaces += n; - if (maxID > *maxFaceID) - *maxFaceID = maxID; - - CCMIOMeshClose(err, mesh); - CCMIOSubDomainClose(err, sdom); - } - if ((*err) == kCCMIONoNodeErr) - *err = kCCMIONoErr; - CCMIODomainClose(err, domain); - } - } /* End of CHECK_ERROR scope */ - if ((*err) == kCCMIONoNodeErr) - *err = kCCMIONoErr; - - return(*err); -} - -CCMIOError VerifyEntityPostData( CCMIOError *err, CCMIOPost post, - CCMIOMeshEntity which, - int boundaryID, int maxID, int *ids, - int nExpected, const char *meshID ) -{ - char name[kCCMIOMaxStringLength + 1]; - int i = 0, j, n = 0, count = 0, nDims, size, ndims, *dims; - float data[9]; - CCMIONode node; - CCMIOPostData pdata; - static char ordinal[][4] = - { "st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th" }; - - CHECK_ERROR(err); - - while (CCMIOPostGetNextDataName(NULL, post, n++, name) == kCCMIONoErr) - { - CCMIOPostReadDataOpen(err, post, which, kCCMIOFloat32, name, boundaryID, - &nDims, &pdata); - if ((*err) == kCCMIONoNodeErr) - { - *err = kCCMIONoErr; - continue; - } - else if ((*err) != kCCMIONoErr) - return(*err); - - CCMIOBufferGetNode(err, pdata->buff, &node); - CCMIOGetDimensions(err, node, &ndims, &dims); - if ((*err) == kCCMIONoErr && dims[0] != nExpected) - { - fprintf(ERR, "Post data field '%s' in subdomain '%s' was expected\n\tto have %d elements but has %d.\n", name, meshID, nExpected, dims[0]); - free(dims); - continue; - } - free(dims); - - if (nDims == 1) - size = 1; - else if (nDims == 2) - size = 3; - else if (nDims == 3) - size = 9; - else - { - fprintf(ERR, "Post data field '%s' in subdomain '%s' has unsupported dimensionality %d.\n", name, meshID, nDims); - continue; - } - count = 1; - for (i = 1; i <= maxID && (*err) == kCCMIONoErr; ++i) - { - if (ids[i]) - { - /* Read a data point */ - if (nDims == 1) - CCMIOPostDataReadScalarf(err, pdata, i, &data[0]); - if (nDims == 2) - { - for (j = 0; j < size; ++j) - CCMIOPostDataReadVectorf(err, pdata, i, j, &data[j]); - } - if (nDims == 3) - { - for (j = 0; j < size; ++j) - CCMIOPostDataReadTensorf(err, pdata, i, j / 3, j % 3, - &data[j]); - } - - /* Check if it appears to be valid */ - for (j = 0; j < size; ++j) - { - if (data[j] > kMaxPostVal || data[j] < kMinPostVal) - fprintf(ERR, "The %d%s element in post data field '%s' in subdomain '%s' is extreme;\n\tit may not have been written.\n", count, ordinal[(i % 10)], name, meshID); - } - count++; - } - } - - CCMIOPostDataClose(err, pdata); - } - - return(*err); -} - -#endif /* CCMIOMESH_VERIFY_C */ - - -/* Automatic setting of emacs local variables. */ -/* Local Variables: */ -/* mode: C++ */ -/* tab-width: 8 */ -/* End: */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioverifymesh.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioverifymesh.h deleted file mode 100644 index 2ea4c2a3dd..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioverifymesh.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef CCMIOMESH_VERIFY_H -#define CCMIOMESH_VERIFY_H - -/*@@ - * Program: Star File Format Library - $RCSfile: ccmioverifymesh.h,v $ - * Author: Geoff Prewett - * Date: Sept 18, 2003 - * - * - * Star File Format Library - Copyright (C) 2003 by adapco, Ltd. - * - * This program is the property of adapco, Ltd. and contains - * confidential and proprietary information. The unauthorized use, - * distribution, or duplication of this program is prohibited. - * All rights reserved. - * - * $Id: ccmioverifymesh.h,v 1.3 2004/10/25 19:11:55 wayne Exp $ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** \ingroup mesh - Should be called only after all data has been written to the processor. - Sanity checks the mesh for consistency. Displays all errors in the mesh.*/ -extern CCMIOError CCMIOCheckProcessorMesh( CCMIOError *err, CCMIOProcessor proc ); - -#ifdef __cplusplus -} -#endif -#endif /* CCMIOMESH_VERIFY_H */ - - -/* Automatic setting of emacs local variables. */ -/* Local Variables: */ -/* mode: C++ */ -/* tab-width: 8 */ -/* End: */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioversion.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioversion.c deleted file mode 100644 index c4db0cadaf..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioversion.c +++ /dev/null @@ -1,12 +0,0 @@ -#include "ccmioversion.h" - -/* ## does not evaluate macros, so we need to have several layers of indirection - so that the kCCMIO* macros get evaluated before VersionConcatenate() is - evaluated.*/ -#define kVersionIdentifier VersionIdentifierImp(kCCMIOMajorVersion, kCCMIOMinorVersion, kCCMIORevision) -#define VersionIdentifierImp(a, b, c) VersionConcatenate(a,b,c) - -#define VersionConcatenate(major, minor, revision) \ - version_##major##_##minor##_##revision - -char kVersionIdentifier[] = kCCMIOVersionStr; diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioversion.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioversion.h deleted file mode 100644 index c43f0f2c12..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/ccmioversion.h +++ /dev/null @@ -1,10 +0,0 @@ -#define kCCMIOMajorVersion 2 /* Requires large-scale re-write */ -#define kCCMIOMinorVersion 6 /* Changes to existing prototypes */ -#define kCCMIORevision 1 /* Bug fixes, new functions */ - -#define kCCMIOVersion 20601 /* mmnnrr (major, minor, rev) */ - -#define Stringify(x) StringifyImp(x) -#define StringifyImp(x) #x - -#define kCCMIOVersionStr Stringify(kCCMIOMajorVersion)"."Stringify(kCCMIOMinorVersion)"."Stringify(kCCMIORevision) diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/make.version.sc b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/make.version.sc deleted file mode 100755 index e0662d5eb9..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/make.version.sc +++ /dev/null @@ -1,3 +0,0 @@ -#$!/bin/sh - -awk '/^#define kCCMIOMajorVersion/ { major = $3; } /^#define kCCMIOMinorVersion/ { minor = $3; } /^#define kCCMIORevision/ { revision = $3 } END { printf "VERSION=%d.%02d.%03d\n", major, minor, revision; }' diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/makefile.win b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/makefile.win deleted file mode 100644 index 5a750c5a53..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/makefile.win +++ /dev/null @@ -1,28 +0,0 @@ -# Microsoft NMAKE File - -# Module specific variables -MODNAM=ccmio - -# Include path and extra cpp options -INCLUDEDIRS=-I.. -CPPDEFS=$(CPPDEFS) /D_WIN32 /DADFLIB - -# Lib path -LIBDIRS= - -# Extra libraries -#LIBS_EXTRA=ADF.LIB -#LIBS_EXTRA_d=ADF_d.LIB - -# Link dependencies -LINK_DEPS= - -# Build a static lib rather than a dll for now -# because the ccmio code doesn't contain export -# declarations -STATICLIB=1 - - -# End of module specific variables - -!INCLUDE "$(DEV_HOME)\star\config\makelib.win" diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/qmake.vars b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/qmake.vars deleted file mode 100644 index 2838f06032..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/qmake.vars +++ /dev/null @@ -1,4 +0,0 @@ -Project MESSAGE: Building in Debug mode -Project MESSAGE: Building dynamic libraries -Project MESSAGE: MK_BUILDNAME=linux64_2.4-x86-glibc_2.2.5; export MK_BUILDNAME; -Project MESSAGE: RELEASEMODE=debug-shared; export RELEASEMODE; diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/test.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/test.c deleted file mode 100644 index 66c8878452..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/test.c +++ /dev/null @@ -1,398 +0,0 @@ -#include -#include -#include -#include -#include "sff.h" -#include "sffbuffer.h" - -const char kFilename[] = "/tmp/sff.adf"; - -const int kVersion = 1234; -const char kTitle[] = "Test title"; -const char kI32ScalarName[] = "scalar_i32"; -const int kI32ScalarValue = 1234567890; -const char kF64ScalarName[] = "scalar_f64"; -const double kF64ScalarValue = 1234567890.0987654321; -const char kArrayNodeName[] = "arrays"; -const char kBufferedArrayNodeName[] = "buffered arrays"; -const char k1DArrayNodeName[] = "1D array"; -const char k1DArrayPath[] = "/arrays/1D array"; -const char k1DBufferedArrayPath[] = "/buffered arrays/1D array"; -const char k2DArrayNodeName[] = "2D array"; -#define k1DArraySize 10 -const int k1DArrayValue[k1DArraySize] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; -const char k2DArrayPath[] = "/arrays/2D array"; -const char k2DBufferedArrayPath[] = "/buffered arrays/2D array"; -const int k2DArraySize[2] = { 4, 5 }; -#define k2DArraySize_Dim0 4 -#define k2DArraySize_Dim1 5 -const int k2DArrayValue[k2DArraySize_Dim0][k2DArraySize_Dim1] = - { { 1, 2, 3, 4, 5 }, - { 6, 7, 8, 9, 10}, - { 11, 12, 13, 14, 15 }, - { 16, 17, 18, 19, 20 } }; -const char kHierarchyNodeName[] = "hierarchy"; -#define kHierarchyWidth 3 -#define kHierarchyDepth 4 -const char kHierarchyValue[kHierarchyDepth][kHierarchyWidth][16] = - { { "", "grandfather", "" }, - { "father1", "father2", "father3" }, - { "dead son", "son2.1", "son3.1" }, - { "grandson", "", "" } }; -struct { - char name[16]; - int nChildren; -} kHierarchyTestTable[] = -{ { "grandfather", 3 }, { "father1", 0 }, { "father2", 1 }, { "father3", 1 }, - { "", 0 } }; -const char kDeletedNodePath[] = "/hierarchy/grandfather/father1/dead son"; -const char kDeletedChildPath[] = "/hierarchy/grandfather/father1/dead son/grandson"; -const char kMovedNodeOriginalPath[] = "/hierarchy/grandfather/father2/father3"; -const char kMovedNodePath[] = "/hierarchy/grandfather/father3"; -const char kMovedChildPath[] = "/hierarchy/grandfather/father3/son3.1"; -const int kBufferSize = 3; - -int gErr = 0; - -void PrintError( SFFError err, char *fmt, ... ) -{ - va_list args; - - va_start(args, fmt); - vprintf(fmt, args); - va_end(args); - printf(" (error %d)\n", (int)err); -} - -void Test( SFFError err, int result, char *title ) -{ - printf("Test '%s' ", title); - if (err == kSFFNoErr && result) - printf ("passed"); - else if (err == kSFFNoErr) - { - printf("FAILED (bad value)"); - gErr++; - } - else - { - printf("FAILED (error %d)", (int)err); - gErr++; - } - printf(".\n"); -} - -int InHierarchy( char *name, int level ) -{ - int i; - - for (i = 0; i < kHierarchyWidth; ++i) - { - if (strcmp(kHierarchyValue[level][i], name) == 0) - return(TRUE); - } - return(FALSE); -} - -int HasRightChildren( char *name, SFFNode node ) -{ - int i, n; - - for (i = 0; kHierarchyTestTable[i].name[0] != '\0'; ++i) - { - if (strcmp(kHierarchyTestTable[i].name, name) == 0) - { - n = -1; /* In case an error occurs and n isn't set, we'll know*/ - SFFGetNumberOfChildren(NULL, node, &n); - if (n != kHierarchyTestTable[i].nChildren) - return(FALSE); - return(TRUE); - } - - } - return(FALSE); -} - -void ReadTest( const char *filename ) -{ - char *title, *name; - int x, y, version, int32, val, badVals, nth; - double float64; - SFFNode root, node, grandfather; - SFFBuffer buff; - SFFError err = kSFFNoErr; - - if ((err = SFFOpen(filename, &root))) - Test(err, TRUE, "SFFOpenFile: existing file"); - if (err) - return; - - /* Test title and version. (Title also tests 1D arrays) */ - SFFGetVersion(&err, root, &version); - Test(err, version == kVersion, "SFFGetVersion"); - err=0; SFFGetTitle(&err, root, &title); - Test(err, strcmp(kTitle, title) == 0, "SFFGetTitle"); - free(title); - - /* Test scalar data reads */ - err=0; SFFGetNode(&err, root, kI32ScalarName, &node); - Test(err, TRUE, "GetNode kI32ScalarName"); - err=0; SFFReadData(&err, node, (void *)&int32, kSFFInt32, 1); - Test(err, int32 == kI32ScalarValue, "Reading Int32 value"); - - err=0; SFFGetNode(&err, root, kF64ScalarName, &node); - Test(err, TRUE, "GetNode kF64ScalarName"); - err=0; SFFReadData(&err, node, (void *)&float64, kSFFFloat64, 1); - Test(err, float64 == kF64ScalarValue, "Reading Float64 value"); - - /* Test 1D array read */ - err=0; SFFGetNode(&err, root, k1DArrayPath, &node); - printf("Reading 1D array: "); - badVals = 0; - for (x = 0; x < k1DArraySize; ++x) - { - SFFReadDataPoint(&err, node, (void *)&val, x, kSFFEnd); - if (val == k1DArrayValue[x]) - printf(". "); - else - printf("X "); - badVals += val != k1DArrayValue[x]; - } - printf("\n"); - Test(err, badVals == 0, "Reading 1D array"); - - /* Test 2D array read */ - err=0; SFFGetNode(&err, root, k2DArrayPath, &node); - printf("Reading 2D array:\n\t"); - badVals = 0; - for (y = 0; y < k2DArraySize_Dim1; ++y) - { - for (x = 0; x < k2DArraySize_Dim0; ++x) - { - SFFReadDataPoint(&err, node, (void *)&val, x, y, kSFFEnd); - if (val == k2DArrayValue[x][y]) - printf(". "); - else - printf("X "); - badVals += val != k2DArrayValue[x][y]; - } - printf("\n\t"); - } - printf("\n"); - Test(err, badVals == 0, "Reading 2D array"); - - /* Test 1D buffered array read */ - SFFSetBufferSize(3); - err=0; SFFGetNode(&err, root, k1DBufferedArrayPath, &node); - SFFCreateBuffer(&err, node, kSFFRead, &buff); - printf("Reading buffered 1D array: "); - badVals = 0; - for (x = 0; x < k1DArraySize; ++x) - { - SFFBufferReadDataPoint(&err, buff, (void *)&val, x, kSFFEnd); - if (val == k1DArrayValue[x]) - printf(". "); - else - printf("X "); - badVals += val != k1DArrayValue[x]; - } - printf("\n"); - SFFDestroyBuffer(&err, buff); - Test(err, badVals == 0, "Reading 1D array"); - - /* Test 2D buffered array read */ - err=0; SFFGetNode(&err, root, k2DBufferedArrayPath, &node); - SFFCreateBuffer(&err, node, kSFFRead, &buff); - printf("Reading 2D array:\n\t"); - badVals = 0; - for (y = 0; y < k2DArraySize_Dim1; ++y) - { - for (x = 0; x < k2DArraySize_Dim0; ++x) - { - SFFBufferReadDataPoint(&err, buff, (void *)&val, x, y, kSFFEnd); - if (val == k2DArrayValue[x][y]) - printf(". "); - else - printf("X "); - badVals += val != k2DArrayValue[x][y]; - } - printf("\n\t"); - } - printf("\n"); - SFFDestroyBuffer(&err, buff); - Test(err, badVals == 0, "Reading 2D array"); - - /* Test deletion */ - err=0; SFFGetNode(&err, root, kDeletedNodePath, &node); - Test(kSFFNoErr, err == kSFFNoNodeErr, "SFFDeleteNode verification"); - err=0; SFFGetNode(&err, root, kDeletedChildPath, &node); - Test(kSFFNoErr, err == kSFFNoNodeErr, "SFFDeleteNode hierarchy deletion verification"); - - /* Test moved node */ - err=0; SFFGetNode(&err, root, kMovedNodePath, &node); - Test(err, TRUE, "SFFMoveNode verification"); - err=0; SFFGetNode(&err, root, kMovedChildPath, &node); - Test(err, TRUE, "SFFMoveNode hierarchy move verification"); - - /* Test hierarchy structure */ - err = 0; badVals = 0; - SFFGetNode(&err, root, kHierarchyNodeName, &node); - SFFGetNumberOfChildren(&err, node, &val); - badVals += !(val == 1); /* Top-level hierarchy is only grandfather */ - nth = 0; - SFFGetNextChild(&err, node, &nth, &grandfather); - SFFGetName(&err, grandfather, &name); - badVals += !InHierarchy(name, 0); - SFFGetNumberOfChildren(&err, grandfather, &val); - badVals += !HasRightChildren(name, grandfather); - free(name); - for (x = 0; SFFGetNextChild(NULL, grandfather, &x, &node) == kSFFNoErr; ++x) - { - SFFGetName(&err, node, &name); - badVals += !InHierarchy(name, 1); - badVals += !HasRightChildren(name, node); - free(name); - } - Test(err, badVals == 0, "Hierarchy verification"); - - err = SFFClose(root); - Test(err, TRUE, "SFFCloseFile: existing file"); -} - -void WriteTest( const char *filename ) -{ - int x, y; - SFFNode root, node, aryParent, parent, son, grandson; - SFFBuffer buff; - SFFError err = kSFFNoErr; - - err = SFFOpen(filename, &root); - Test(err, TRUE, "SFFOpenFile"); - - err=0; SFFSetVersion(&err, root, kVersion); - Test(err, TRUE, "SFFSetVersion"); - err=0; SFFSetTitle(&err, root, kTitle); - Test(err, TRUE, "SFFSetTitle"); - - /* Write scalar values */ - err=0; SFFCreateNode(&err, root, FALSE, kI32ScalarName, kI32ScalarName, - &node); - Test(err, TRUE, "SFFCreateNode(kI32ScalarName)"); - SFFSetDataType(&err, node, kSFFInt32, 1, kSFFEnd); - Test(err, TRUE, "SFFSetDataType(kSFFInt32, 1)"); - SFFWriteData(&err, node, (void *)&kI32ScalarValue); - Test(err, TRUE, "SFFWriteDataPoint(kI32ScalarValue, 1)"); - - err=0; SFFCreateNode(&err, root, FALSE, kF64ScalarName, kF64ScalarName, - &node); - Test(err, TRUE, "SFFCreateNode(kF64ScalarName)"); - SFFSetDataType(&err, node, kSFFFloat64, 1, kSFFEnd); - Test(err, TRUE, "SFFSetDataType(kSFFFloat64, 1)"); - SFFWriteData(&err, node, (void *)&kF64ScalarValue); - Test(err, TRUE, "SFFWriteDataPoint(kF64ScalarValue, 1)"); - - /* Write array nodes */ - err=0; SFFCreateNode(&err, root, FALSE, kArrayNodeName, kArrayNodeName, - &aryParent); - Test(err, TRUE, "SFFCreateNode(kArrayNodeName)"); - - /* 1D array */ - err=0; SFFCreateNode(&err, aryParent, FALSE, k1DArrayNodeName, - k1DArrayNodeName, &node); - SFFSetDataType(&err, node, kSFFInt32, k1DArraySize, kSFFEnd); - for (x = 0; x < k1DArraySize; ++x) - SFFWriteDataPoint(&err, node, (void *)&k1DArrayValue[x], x, kSFFEnd); - Test(err, TRUE, "Create 1D array"); - - /* 2D array */ - err=0; SFFCreateNode(&err, aryParent, FALSE, k2DArrayNodeName, - k2DArrayNodeName, &node); - SFFSetDataType(&err, node, kSFFInt32, k2DArraySize_Dim0, k2DArraySize_Dim1, - kSFFEnd); - for (x = 0; x < k2DArraySize_Dim0; ++x) - { - for (y = 0; y < k2DArraySize_Dim1; ++y) - SFFWriteDataPoint(&err, node, (void *)&k2DArrayValue[x][y], - x, y, kSFFEnd); - } - Test(err, TRUE, "Create 2D array"); - - /* 1D buffered array */ - err=0; SFFCreateNode(&err, root, FALSE, kBufferedArrayNodeName, - kBufferedArrayNodeName, &aryParent); - SFFCreateNode(&err, aryParent, FALSE, k1DArrayNodeName, k1DArrayNodeName, - &node); - SFFSetDataType(&err, node, kSFFInt32, k1DArraySize, kSFFEnd); - SFFCreateBuffer(&err, node, kSFFWrite, &buff); - for (x = 0; x < k1DArraySize; ++x) - SFFBufferWriteDataPoint(&err, buff, (void *)&k1DArrayValue[x], - x, kSFFEnd); - SFFDestroyBuffer(&err, buff); - Test(err, TRUE, "Create 1D buffered array"); - - /* 2D buffered array */ - err=0; SFFCreateNode(&err, aryParent, FALSE, k2DArrayNodeName, - k2DArrayNodeName, &node); - SFFSetDataType(&err, node, kSFFInt32, k2DArraySize_Dim0, k2DArraySize_Dim1, - kSFFEnd); - SFFCreateBuffer(&err, node, kSFFWrite, &buff); - for (x = 0; x < k2DArraySize_Dim0; ++x) - { - for (y = 0; y < k2DArraySize_Dim1; ++y) - SFFBufferWriteDataPoint(&err, buff, (void *)&k2DArrayValue[x][y], - x, y, kSFFEnd); - } - SFFDestroyBuffer(&err, buff); - Test(err, TRUE, "Create 2D buffered array"); - - /* Create hierarchy test */ - err=0; - SFFCreateNode(&err, root, FALSE, kHierarchyNodeName, NULL, &node); - SFFCreateNode(&err, node, FALSE, kHierarchyValue[0][1], NULL, &parent); - SFFCreateNode(&err, parent, FALSE, kHierarchyValue[1][0], NULL, &son); - SFFCreateNode(&err, son, FALSE, kHierarchyValue[2][0], NULL, &grandson); - SFFCreateNode(&err, grandson, FALSE, kHierarchyValue[3][0], NULL, NULL); - SFFCreateNode(&err, parent, FALSE, kHierarchyValue[1][1], NULL, &son); - SFFCreateNode(&err, son, FALSE, kHierarchyValue[2][1], NULL, NULL); - SFFCreateNode(&err, son, FALSE, kHierarchyValue[1][2], NULL, &grandson); - SFFCreateNode(&err, grandson, FALSE, kHierarchyValue[2][2], NULL, NULL); - Test(err, TRUE, "Hierarchy creation (before move and delete)"); - SFFGetNode(&err, root, kDeletedNodePath, &node); - err=0; SFFDeleteNode(&err, node); - Test(err, TRUE, "SFFDeleteNode"); - err=0; SFFGetNode(&err, root, kMovedNodeOriginalPath, &node); - SFFMoveNode(&err, node, parent); - Test(err, TRUE, "SFFMoveNode"); - - err = SFFClose(root); - Test(err, TRUE, "SFFCloseFile"); -} - -int main(int argc, char *argv[]) -{ - if (remove(kFilename) != 0) - { printf("Could not remove '%s'!\n", kFilename); return(1); } - - WriteTest(kFilename); - ReadTest(kFilename); - - if (gErr != 1) - printf("There were %d errors.", gErr); - else - printf("There was 1 error."); - printf(" Tests "); - if (!gErr) - printf("passed"); - else - printf("FAILED"); - printf(".\n"); - - return(gErr); -} - - -/* Automatic setting of emacs local variables. */ -/* Local Variables: */ -/* mode: C++ */ -/* tab-width: 8 */ -/* End: */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/vector.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/vector.c deleted file mode 100644 index 36ef90282c..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/vector.c +++ /dev/null @@ -1,118 +0,0 @@ -#ifndef __VECTOR_C -#define __VECTOR_C - -/*@@ - * Program: Star File Format Library - $RCSfile: vector.c,v $ - * Author: Geoff Prewett - * Date: August 12, 2003 - * - * - * Star File Format Library - Copyright (C) 2003 by adapco, Ltd. - * - * This program is the property of adapco, Ltd. and contains - * confidential and proprietary information. The unauthorized use, - * distribution, or duplication of this program is prohibited. - * All rights reserved. - * - * $Id: vector.c,v 1.4 2005/01/11 21:51:20 wo Exp $ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef MAKEDEPEND -#include -#include -#endif - -#include "vector.h" - -Vector VCreate( int typeSize, int minSize, int clear ) -{ - Vector v; - - if (typeSize <= 0) /* Avoid bad mallocs and divide by zero in VSize */ - typeSize = 1; - v = (Vector)malloc(sizeof(struct _Vector)); - if (v) - { - if (clear) - v->buffer = calloc(minSize, typeSize); - else - v->buffer = malloc(minSize * typeSize); - if (!v->buffer) - { - free(v); - return(NULL); - } - v->typeSize = typeSize; - v->alloc = minSize * typeSize; - v->size = 0; - v->clear = clear; - } - return(v); -} - -void VDestroy( Vector v ) -{ - if (!v) - return; - - free(v->buffer); - free(v); -} - -int VSize( Vector v ) -{ - if (!v || !v->buffer) - return(0); - return(v->size / v->typeSize); -} - -void* VIndex( Vector v, int i ) -{ - int offset, size; - void *tmp; - - if (!v) - return(NULL); - - offset = i * v->typeSize; - if (offset + v->typeSize >= v->alloc) - { - size = v->alloc * 2; - if (offset + v->typeSize > size) - size = offset + v->typeSize; - if (v->clear) - tmp = calloc(size, 1); - else - tmp = malloc(size); - if (!tmp) - return(NULL); - if (v->buffer) /* In case somebody tried VCreate(n, 0); */ - { /* in which case malloc(0) might return NULL */ - memcpy(tmp, v->buffer, v->size); - free(v->buffer); - } - v->buffer = tmp; - v->alloc = size; - } - - if (offset >= v->size) - v->size = offset + v->typeSize; - return((char *)v->buffer + offset); -} - -#ifdef __cplusplus -} -#endif - -#endif /* __VECTOR_C */ - - -/* Automatic setting of emacs local variables. */ -/* Local Variables: */ -/* mode: C++ */ -/* tab-width: 8 */ -/* End: */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/vector.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/vector.h deleted file mode 100644 index 526c552acc..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/vector.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef __VECTOR_H -#define __VECTOR_H - -/*@@ - * Program: Star File Format Library - $RCSfile: vector.h,v $ - * Author: Geoff Prewett - * Date: August 12, 2003 - * - * - * Star File Format Library - Copyright (C) 2003 by adapco, Ltd. - * - * This program is the property of adapco, Ltd. and contains - * confidential and proprietary information. The unauthorized use, - * distribution, or duplication of this program is prohibited. - * All rights reserved. - * - * $Id: vector.h,v 1.3 2004/10/25 19:11:55 wayne Exp $ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -struct _Vector { - int size; - int alloc; - int typeSize; - int clear; /* TRUE if need to clear memory when expanding */ - void *buffer; - }; - -typedef struct _Vector* Vector; - -/** Creates a growable array (or NULL if memory error). If clear is TRUE, - then unused memory will always be zero. */ -extern Vector VCreate( int typeSize, int minSize, int clear ); - -/** Destroys a growable array (or does nothing if passed NULL) */ -extern void VDestroy( Vector v ); - -/** Returns the number of elements currently used */ -extern int VSize( Vector v ); - -/** Returns a pointer to the index i. If i is larger than the array, - it will be expanded to at least i. If an expansion fails, returns NULL. */ -extern void* VIndex( Vector v, int i ); - -#ifdef __cplusplus -} -#endif - -#endif /* __VECTOR_H */ - - -/* Automatic setting of emacs local variables. */ -/* Local Variables: */ -/* mode: C++ */ -/* tab-width: 8 */ -/* End: */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/version.pro b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/version.pro deleted file mode 100644 index 86f37a042f..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libccmio/version.pro +++ /dev/null @@ -1 +0,0 @@ -VERSION=2.06.001 diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/Make/files b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/Make/files deleted file mode 100644 index 1ede16c1ca..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/Make/files +++ /dev/null @@ -1,7 +0,0 @@ -adf_cond.c -adf_ftoc.c -cgns_error.c -cgns_internals.c -cgnslib.c - -LIB = $(FOAM_LIBBIN)/libcgns diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/Make/options b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/Make/options deleted file mode 100644 index 825370b410..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/Make/options +++ /dev/null @@ -1,7 +0,0 @@ -EXE_INC = \ - -I.. \ - -I../libadf/lnInclude - -EXE_LIBS = \ - -ladf - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/Makefile b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/Makefile deleted file mode 100644 index 26a2b7289a..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -include ../../config/Makeflags.sys - -OBJ_DIR = $(BUILD_HOME)/libccmio -TARGET_SO_NAME = cgns -SOURCES = $(wildcard *.c) -SOURCES := $(filter-out au1_ftoc.c, $(SOURCES)) - -INCLUDE_PATH := \ - -I$(STAR_HOME)/base/src\ - -I$(STAR_HOME)/libccmio - -include $(STAR_HOME)/config/Makefile.c.shared_object -include $(STAR_HOME)/config/Makefile.c.objects diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/Makefile.cgns b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/Makefile.cgns deleted file mode 100644 index 5215d0a5e6..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/Makefile.cgns +++ /dev/null @@ -1,192 +0,0 @@ -############################################################################# -# Makefile for building: libcgns.so.2.30.000 -# Generated by qmake (1.07a) (Qt 3.3.2) on: Wed Aug 9 13:52:11 2006 -# Project: cgns.pro -# Template: lib -# Command: $(QMAKE) -spec /home/hunt2/mattijs/OpenFOAM/mattijs-1.3.1/applications/utilities/ccm24ToFoam/libccmio-2.6.1/libcgns/..//config/linux64_2.4-x86-glibc_2.2.5 "RELEASEMODE=" "LIBMODE=dynamic" "PROFILEMODE=" "CC=gcc" "CXX=g++" -o Makefile.cgns cgns.pro -############################################################################# - -####### Compiler, tools and options - -CC = gcc -CXX = g++ -LEX = flex -YACC = yacc -CFLAGS = -m64 -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wall -W -g -fPIC -DLINUX64_2_4_X86_GLIBC_2_2_5 -CXXFLAGS = -m64 -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fexceptions -Wall -W -g -fPIC -DLINUX64_2_4_X86_GLIBC_2_2_5 -LEXFLAGS = -YACCFLAGS= -d -INCPATH = -I/home/hunt2/mattijs/OpenFOAM/mattijs-1.3.1/applications/utilities/ccm24ToFoam/libccmio-2.6.1/config/linux64_2.4-x86-glibc_2.2.5 -I. -I.. -I..//include -LINK = g++ -LFLAGS = -shared -Wl,-soname,libcgns.so.2 -Wl,-rpath,/home/hunt2/mattijs/OpenFOAM/mattijs-1.3.1/applications/utilities/ccm24ToFoam/libccmio-2.6.1/lib/linux64_2.4-x86-glibc_2.2.5/debug-shared -LIBS = $(SUBLIBS) -L..//lib/linux64_2.4-x86-glibc_2.2.5/debug-shared -ladf -AR = ar cqs -RANLIB = -MOC = $(QTDIR)/bin/moc -UIC = $(QTDIR)/bin/uic -QMAKE = ../config/linux64_2.4-x86-glibc_2.2.5/qmake -TAR = tar -cf -GZIP = gzip -9f -COPY = cp -f -p -COPY_FILE= $(COPY) -COPY_DIR = $(COPY) -r -INSTALL_FILE= $(COPY_FILE) -INSTALL_DIR = $(COPY_DIR) -DEL_FILE = rm -f -SYMLINK = ln -sf -DEL_DIR = rmdir -MOVE = mv -f -CHK_DIR_EXISTS= test -d -MKDIR = mkdir -p - -####### Output directory - -OBJECTS_DIR = ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/ - -####### Files - -HEADERS = cgns_header.h \ - cgnslib.h \ - cgnslib_f.h \ - fortran_macros.h -SOURCES = adf_cond.c \ - adf_ftoc.c \ - cg_ftoc.c \ - cgns_error.c \ - cgns_internals.c \ - cgnslib.c -OBJECTS = ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/adf_cond.o \ - ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/adf_ftoc.o \ - ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/cg_ftoc.o \ - ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/cgns_error.o \ - ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/cgns_internals.o \ - ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/cgnslib.o -FORMS = -UICDECLS = -UICIMPLS = -SRCMOC = -OBJMOC = -DIST = ../config/config.pro \ - ../config/ccm.pro \ - version.pro \ - cgns.pro -QMAKE_TARGET = cgns -DESTDIR = ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/ -TARGET = libcgns.so.2.30.000 -TARGETA = ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/libcgns.a -TARGETD = libcgns.so.2.30.000 -TARGET0 = libcgns.so -TARGET1 = libcgns.so.2 -TARGET2 = libcgns.so.2.30 - -first: all -####### Implicit rules - -.SUFFIXES: .c .o .cpp .cc .cxx .C - -.cpp.o: - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< - -.cc.o: - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< - -.cxx.o: - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< - -.C.o: - $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< - -.c.o: - $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< - -####### Build rules - -all: Makefile.cgns ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET) - -../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP) - test -d ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/ || mkdir -p ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/ - -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) - $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP) - -ln -s $(TARGET) $(TARGET0) - -ln -s $(TARGET) $(TARGET1) - -ln -s $(TARGET) $(TARGET2) - -$(DEL_FILE) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET) - -$(DEL_FILE) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET0) - -$(DEL_FILE) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET1) - -$(DEL_FILE) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET2) - -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/ - - - -staticlib: $(TARGETA) - -$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP) - -$(DEL_FILE) $(TARGETA) - $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) - -mocables: $(SRCMOC) -uicables: $(UICDECLS) $(UICIMPLS) - -$(MOC): - ( cd $(QTDIR)/src/moc && $(MAKE) ) - -Makefile.cgns: cgns.pro /home/hunt2/mattijs/OpenFOAM/mattijs-1.3.1/applications/utilities/ccm24ToFoam/libccmio-2.6.1/config/linux64_2.4-x86-glibc_2.2.5/qmake.conf ../config/config.pro \ - ../config/ccm.pro \ - version.pro - $(QMAKE) -spec /home/hunt2/mattijs/OpenFOAM/mattijs-1.3.1/applications/utilities/ccm24ToFoam/libccmio-2.6.1/libcgns/..//config/linux64_2.4-x86-glibc_2.2.5 "RELEASEMODE=" "LIBMODE=dynamic" "PROFILEMODE=" "CC=gcc" "CXX=g++" -o Makefile.cgns cgns.pro -qmake: - @$(QMAKE) -spec /home/hunt2/mattijs/OpenFOAM/mattijs-1.3.1/applications/utilities/ccm24ToFoam/libccmio-2.6.1/libcgns/..//config/linux64_2.4-x86-glibc_2.2.5 "RELEASEMODE=" "LIBMODE=dynamic" "PROFILEMODE=" "CC=gcc" "CXX=g++" -o Makefile.cgns cgns.pro - -dist: - @mkdir -p ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/cgns && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/cgns/ && ( cd `dirname ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/cgns` && $(TAR) cgns.tar cgns && $(GZIP) cgns.tar ) && $(MOVE) `dirname ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/cgns`/cgns.tar.gz . && $(DEL_FILE) -r ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/cgns - -mocclean: -uiclean: - -yaccclean: -lexclean: -clean: - -$(DEL_FILE) $(OBJECTS) - -$(DEL_FILE) *~ core *.core - - -####### Sub-libraries - -distclean: clean - -$(DEL_FILE) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET) $(TARGET) - -$(DEL_FILE) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET0) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET1) ../lib/linux64_2.4-x86-glibc_2.2.5/debug-shared/$(TARGET2) $(TARGETA) - - -FORCE: - -####### Compile - -../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/adf_cond.o: adf_cond.c - $(CC) -c $(CFLAGS) $(INCPATH) -o ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/adf_cond.o adf_cond.c - -../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/adf_ftoc.o: adf_ftoc.c fortran_macros.h - $(CC) -c $(CFLAGS) $(INCPATH) -o ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/adf_ftoc.o adf_ftoc.c - -../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/cg_ftoc.o: cg_ftoc.c fortran_macros.h \ - cgnslib.h \ - cgns_header.h - $(CC) -c $(CFLAGS) $(INCPATH) -o ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/cg_ftoc.o cg_ftoc.c - -../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/cgns_error.o: cgns_error.c cgnslib.h \ - cgns_header.h - $(CC) -c $(CFLAGS) $(INCPATH) -o ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/cgns_error.o cgns_error.c - -../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/cgns_internals.o: cgns_internals.c cgnslib.h \ - cgns_header.h - $(CC) -c $(CFLAGS) $(INCPATH) -o ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/cgns_internals.o cgns_internals.c - -../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/cgnslib.o: cgnslib.c cgnslib.h \ - cgns_header.h - $(CC) -c $(CFLAGS) $(INCPATH) -o ../obj/linux64_2.4-x86-glibc_2.2.5/debug-shared/cgnslib.o cgnslib.c - -####### Install - -install: - -uninstall: - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/Makefile.qmake b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/Makefile.qmake deleted file mode 100644 index 5193a58d11..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/Makefile.qmake +++ /dev/null @@ -1,4 +0,0 @@ -PATHTOSRC = ../ -PROJECT = cgns - -include ../config/Makefile.main diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/adf_cond.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/adf_cond.c deleted file mode 100644 index 25d8de8de3..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/adf_cond.c +++ /dev/null @@ -1,365 +0,0 @@ -#ifndef MAKEDEPEND -#include -#include -#include -#include -#endif - -#include "libadf/ADF.h" - -/* external prototypes */ - -#if defined (__cplusplus) - extern "C" { -#endif - -static void ErrorExit(char *name, int error_return) ; -static void WalkTheNodes( double InputID, double OutputID ) ; -static void CopyTheNode( double InputID, double OutputID ) ; -static int CalculateDataSize( char *type, int ndims, int *dimlist ) ; - -#if defined (__cplusplus) - } -#endif - -/* global constants */ - -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif -#define StatusOK -1 -#define NO_DATA 33 - -/* Define some usefull macros */ - -#define TO_UPPER( c ) ((islower(c))?(toupper(c)):(c)) -#define EVAL_2_BYTES( C0, C1 ) (((C0)<<8)+((C1))) - -/* global variables */ - -static int ErrStat ; -static int IncludeLink = FALSE ; -static int PrintFlag = FALSE ; -static int NumDims ; -static int PathLength ; -static int DimVals[ADF_MAX_DIMENSIONS*2] ; -static char input[ADF_FILENAME_LENGTH+1] ; -static char label[ADF_LABEL_LENGTH+1] ; -static char format[ADF_FORMAT_LENGTH+1] ; -static char name[ADF_NAME_LENGTH+1] ; -static char DataType[ADF_DATA_TYPE_LENGTH+1] ; -static char LinkFileName[ADF_FILENAME_LENGTH+1] ; -static char LinkPathName[ADF_MAX_LINK_DATA_SIZE+1] ; - -/************************************************************************ - Main Routine, gets user input and then starts the walk through the nodes -*************************************************************************/ - -void adf_cond(double InputRootID, double OutputRootID) { - - sprintf(format,"NATIVE") ; - IncludeLink = FALSE ; - - /* Begin the walk through the nodes */ - - if ( PrintFlag == TRUE ) { - printf ( "\n**** Begin ADF file conditioner ****" ) ; - printf ( "\n---Output file type is %s.", format ) ; - if ( IncludeLink == TRUE ) - printf ( "\n---Links will be included in output file." ) ; - else - printf ( "\n---Links will not be included in output file." ) ; - } - - WalkTheNodes( InputRootID, OutputRootID ) ; - - ADF_Database_Close ( OutputRootID, &ErrStat ) ; - - if ( PrintFlag == TRUE ) - printf ( "\n**** ADF file conditioner completed sucessfully ****\n" ) ; - -} -/************************************************************************ - Main function which walks through all the adf nodes making copies of the - node in the output file -*************************************************************************/ -static void WalkTheNodes( double InputID, double OutputID ) -{ - int ic, cnt ; - int nchildren ; - double InputChildID ; - double OutputChildID ; - - /* Copy the data from the current input node to the output node */ - - CopyTheNode ( InputID, OutputID ) ; - - /* Loop through the children of the current node */ - - ADF_Number_of_Children(InputID,&nchildren,&ErrStat) ; - if ( ErrStat != StatusOK ) - ErrorExit( "WalkTheNodes:ADF_Number_of_Children", ErrStat ) ; - if (nchildren == 0) - /* We hit the end of the Tree so return up one level */ - return ; - else - { - for (ic=1; ic<=nchildren; ic++) - { - /* Get child name and node ID */ - -#ifdef NULL_NODEID_POINTER - ADF_Children_IDs( InputID, ic, 1, &cnt, &InputChildID, &ErrStat ); - if ( ErrStat != StatusOK ) - ErrorExit( "WalkTheNodes:ADF_Children_IDs", ErrStat ); - ADF_Get_Name (InputChildID, name, &ErrStat ); - if ( ErrStat != StatusOK ) - ErrorExit( "WalkTheNodes:ADF_Get_Name", ErrStat ) ; -#else - ADF_Children_Names( InputID, ic, 1, ADF_NAME_LENGTH+1, &cnt, name, - &ErrStat ); - if ( ErrStat != StatusOK ) - ErrorExit( "WalkTheNodes:ADF_Children_Names", ErrStat ); - ADF_Get_Node_ID( InputID, name, &InputChildID, &ErrStat ) ; - if ( ErrStat != StatusOK ) - ErrorExit( "WalkTheNodes:ADF_Node_ID", ErrStat ) ; -#endif - - /* Write out a little status message for the user */ - - if ( PrintFlag == TRUE ) - printf ( "\nWorking on ADF node %s", name ) ; - - /* Check for link, if it is a local link then we always link it!! */ - - ADF_Is_Link ( InputChildID, &PathLength, &ErrStat ) ; - if ( ErrStat != StatusOK ) - ErrorExit( "WalkTheNodes:ADF_Is_Link", ErrStat ) ; - if ( PathLength > 0 ) { - ADF_Get_Link_Path( InputChildID, LinkFileName, LinkPathName, - &ErrStat ) ; - if ( ErrStat != StatusOK ) - ErrorExit( "WalkTheNode:ADF_Link_Path", ErrStat ) ; - } - - /* Create the node or the link */ - - if ( PathLength > 0 && - ( LinkFileName[0] == '\0' || IncludeLink == FALSE ) ) { - /* Just recreate the link and skip the walk from the link point */ - ADF_Link( OutputID, name, LinkFileName, LinkPathName, - &OutputChildID, &ErrStat ) ; - if ( ErrStat != StatusOK ) - ErrorExit( "WalkTheNodes:ADF_Link", ErrStat ) ; - continue ; /* Don't walk down the link!! */ - } - else { - /* Create the node in the output file and continue walking */ - ADF_Create ( OutputID, name, &OutputChildID, &ErrStat ) ; - if ( ErrStat != StatusOK ) - ErrorExit( "WalkTheNodes:ADF_Create", ErrStat ) ; - WalkTheNodes ( InputChildID, OutputChildID ) ; /* Walk the path */ - } - } - } -} -/************************************************************************ - Creates a copy of input node data into the the output node. -*************************************************************************/ -static void CopyTheNode( double InputID, double OutputID ) -{ - int DataSize ; - char *DataBuffer ; - - /* Copy the node label type and size information */ - - ADF_Get_Label( InputID, label, &ErrStat ) ; - if ( ErrStat != StatusOK ) - ErrorExit( "CopyTheNode:ADF_Get_Label", ErrStat ) ; - ADF_Set_Label( OutputID, label, &ErrStat ) ; - if ( ErrStat != StatusOK ) - ErrorExit( "CopyTheNode:ADF_Set_Label", ErrStat ) ; - - ADF_Get_Data_Type( InputID, DataType, &ErrStat ) ; - if ( ErrStat != StatusOK ) - ErrorExit( "CopyTheNode:ADF_Get_Data_Type", ErrStat ) ; - ADF_Get_Number_of_Dimensions( InputID, &NumDims, &ErrStat ) ; - if ( ErrStat != StatusOK ) - ErrorExit( "CopyTheNode:ADF_Get_Number_of_Dimensions", ErrStat ) ; - if ( NumDims == 0 ) return ; - ADF_Get_Dimension_Values( InputID, DimVals, &ErrStat ) ; - if ( ErrStat != StatusOK ) - ErrorExit( "CopyTheNode:ADF_Get_Dimension_Values", ErrStat ) ; - ADF_Put_Dimension_Information( OutputID, DataType, NumDims, DimVals, - &ErrStat ) ; - if ( ErrStat != StatusOK ) - ErrorExit( "CopyTheNode:ADF_Put_Dimension_Information", ErrStat ) ; - - /* Copy any NodeData */ - - DataSize = CalculateDataSize ( DataType, NumDims, DimVals ) ; - if ( DataSize == 0 ) return ; - DataBuffer = (char *) malloc ( DataSize*sizeof(char) ) ; - if ( DataBuffer == NULL ) - ErrorExit( "CopyTheNode:Failed Memory Allocation", -2 ) ; - ADF_Read_All_Data( InputID, DataBuffer, &ErrStat ) ; - if ( ErrStat == NO_DATA ) { - free ( DataBuffer ) ; - return ; - } - else if ( ErrStat != StatusOK ) - ErrorExit( "CopyTheNode:ADF_Read_All_Data", ErrStat ) ; - ADF_Write_All_Data( OutputID, DataBuffer, &ErrStat ) ; - if ( ErrStat != StatusOK ) - ErrorExit( "CopyTheNode:ADF_Write_All_Data", ErrStat ) ; - free ( DataBuffer ) ; -} -/************************************************************************ - Function to calculate the size in bytes of node data. It is based on - the function ADFI_evaluate_datatype and this function should be modified - to conform to any changes made to it. -*************************************************************************/ -static int CalculateDataSize( char *data_type_string, int ndims, int *dimlist ) -{ - int i ; - int str_position ; - int str_len ; - int size_machine ; - int machine_bytes ; - - if ( ndims == 0 ) return 0 ; - - /** Upper_CASE the data-type string **/ - str_len = strlen( data_type_string ) ; - if ( str_len == 0 ) return 0 ; - for( i=0; i= '0') && - (data_type_string[ str_position ] <= '9') ) { - array_size = array_size * 10 + - (data_type_string[ str_position ] - '0') ; - str_position += 1 ; - } /* end while */ - if( data_type_string[ str_position ] != ']' ) { - ErrorExit( "CalculateDataSize:Invalid Data Type.", -2 ); - } - str_position += 1 ; - /** Check for comma between types **/ - if( data_type_string[ str_position ] == ',' ) { - str_position += 1 ; - } - machine_bytes = machine_bytes + size_machine * array_size ; - } - break ; - - case ',' : - str_position += 1 ; - machine_bytes += size_machine ; - break ; - - default : /** Error condition **/ - ErrorExit( "CalculateDataSize:Invalid Data Type.", -2 ); - break ; - } /* end switch */ - } /* end while */ - - /* Now calculate the total size based on the dimensions */ - - for ( i=0; i 0 ) { - ADF_Error_Message(ErrStat,input) ; - fprintf(stderr,"%s\n",input) ; - } - exit(1) ; -} diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/adf_ftoc.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/adf_ftoc.c deleted file mode 100644 index f847e388a1..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/adf_ftoc.c +++ /dev/null @@ -1,223 +0,0 @@ -#ifndef MAKEDEPEND -#include -#include -#endif - -#include "fortran_macros.h" -#include "libadf/ADF_internals.h" - -/* ADF Fortran to C interface */ - -void FMNAME(adfcnam, ADFCNAM) (double *ID, int *istart, int *inum, - int *inamlen, int *inumret, STR_PSTR(names), - int *ier STR_PLEN(names)) { - int len_names = (int)STR_LEN(names); - FMCALL(adfcna2,ADFCNA2)(ID, istart, inum, inamlen, &len_names, - inumret, STR_PTR(names), ier); -} - -void FMNAME(adfcids, ADFCIDS) (double *ID, int *istart, int *inum, - int *inumret, double *cIDs, int *ier) { - FMCALL(adfcid2,ADFCID2)(ID, istart, inum, inumret, cIDs, ier); -} - -void FMNAME(adfcre, ADFCRE) (double *PID, STR_PSTR(name), double *ID, - int *ier STR_PLEN(name)) { - int len_name = (int)STR_LEN(name); - FMCALL(adfcre2, ADFCRE2)(PID, STR_PTR(name), &len_name, ID, ier); -} - -void FMNAME(adfdclo, ADFDCLO) (double *RootID, int *ier) { - FMCALL(adfdcl2, ADFDCL2)(RootID, ier); -} - -void FMNAME(adfddel, ADFDDEL) (STR_PSTR(filename), - int *ier STR_PLEN(filename)) { - int len_filename = (int)STR_LEN(filename); - FMCALL(adfdde2, ADFDDE2)(STR_PTR(filename), &len_filename, ier); -} - -void FMNAME(adfdel, ADFDEL) (double *PID, double *ID, int *ier) { - FMCALL(adfdel2, ADFDEL2)(PID, ID, ier); -} - -void FMNAME(adfdgc, ADFDGC) (double *ID, int *ier) { - FMCALL(adfdgc2, ADFDGC2)(ID, ier); -} - -void FMNAME(adfdgf, ADFDGF) (double *RootID, STR_PSTR(format), - int *ier STR_PLEN(format)) { - int len_format = (int)STR_LEN(format); - FMCALL(adfdgf2, ADFDGF2)(RootID, STR_PTR(format), &len_format, ier); -} - -void FMNAME(adfdopn, ADFDOPN) (STR_PSTR(filename), STR_PSTR(status), - STR_PSTR(format), double *RootID, int *ier STR_PLEN(filename) - STR_PLEN(status) STR_PLEN(format)) { - int len_filename = (int)STR_LEN(filename); - int len_status = (int)STR_LEN(status); - int len_format = (int)STR_LEN(format); - FMCALL(adfdop2, ADFDOP2)(STR_PTR(filename), &len_filename, - STR_PTR(status), &len_status, STR_PTR(format), - &len_format, RootID, ier); -} - -void FMNAME(adfdsf, ADFDSF) (double *RootID, STR_PSTR(format), - int *ier STR_PLEN(format)) { - int len_format = (int)STR_LEN(format); - FMCALL(adfdsf2, ADFDSF2)(RootID, STR_PTR(format), &len_format, ier); -} - -void FMNAME(adfdver, ADFDVER) (double *RootID, STR_PSTR(version), - STR_PSTR(cdate), STR_PSTR(mdate), int *ier STR_PLEN(version) - STR_PLEN(cdate) STR_PLEN(mdate)) { - int len_version = (int)STR_LEN(version); - int len_cdate = (int)STR_LEN(cdate); - int len_mdate = (int)STR_LEN(mdate); - FMCALL(adfdve2, ADFDVE2)(RootID, STR_PTR(version), STR_PTR(cdate), - STR_PTR(mdate), &len_version, &len_cdate, &len_mdate, ier); -} - -void FMNAME(adferr, ADFERR) (int *ier, STR_PSTR(errstr) STR_PLEN(errstr)) { - int len_errstr = (int)STR_LEN(errstr); - FMCALL(adferr2, ADFERR2)(ier, STR_PTR(errstr), &len_errstr); -} - -void FMNAME(adfftd, ADFFTD) (double *ID, int *ier) { - FMCALL(adfftd2, ADFFTD2)(ID, ier); -} - -void FMNAME(adfgdt, ADFGDT) (double *ID, STR_PSTR(dtype), - int *ier STR_PLEN(dtype)) { - int len_dtype = (int)STR_LEN(dtype); - FMCALL(adfgdt2, ADFGDT2)(ID, STR_PTR(dtype), &len_dtype, ier); -} - -void FMNAME(adfgdv, ADFGDV) (double *ID, int *dvals, int *ier) { - FMCALL(adfgdv2, ADFGDV2)(ID, dvals, ier); -} - -void FMNAME(adfges, ADFGES) (int *estate, int *ier) { - FMCALL(adfges2, ADFGES2)(estate, ier); -} - -void FMNAME(adfglb, ADFGLB) (double *ID, STR_PSTR(label), - int *ier STR_PLEN(label)) { - int len_label = (int)STR_LEN(label); - FMCALL(adfglb2, ADFGLB2)(ID, STR_PTR(label), &len_label, ier); -} - -void FMNAME(adfglkp, ADFGLKP) (double *ID, STR_PSTR(file), STR_PSTR(name), - int *ier STR_PLEN(file) STR_PLEN(name)) { - int len_file = (int)STR_LEN(file); - int len_name = (int)STR_LEN(name); - FMCALL(adfglk2, ADFGLK2)(ID, STR_PTR(file), &len_file, STR_PTR(name), - &len_name, ier); -} - -void FMNAME(adfgnam, ADFGNAM) (double *ID, STR_PSTR(name), - int *ier STR_PLEN(name)) { - int len_name = (int)STR_LEN(name); - FMCALL(adfgna2, ADFGNA2)(ID, STR_PTR(name), &len_name, ier); -} - -void FMNAME(adfgnd, ADFGND) (double *ID, int *ndims, int *ier) { - FMCALL(adfgnd2, ADFGND2)(ID, ndims, ier); -} - -void FMNAME(adfgnid, ADFGNID) (double *PID, STR_PSTR(name), double *ID, - int *ier STR_PLEN(name)) { - int len_name = (int)STR_LEN(name); - FMCALL(adfgni2, ADFGNI2)(PID, STR_PTR(name), &len_name, ID, ier); -} - -void FMNAME(adfgrid, ADFGRID) (double *ID, double *RootID, int *ier) { - FMCALL(adfgri2, ADFGRI2)(ID, RootID, ier); -} - -void FMNAME(adfislk, ADFISLK) (double *ID, int *lplen, int *ier) { - FMCALL(adfisl2, ADFISL2)(ID, lplen, ier); -} - -void FMNAME(adflink, ADFLINK) (double *PID, STR_PSTR(name), STR_PSTR(file), - STR_PSTR(nfile), double *ID, int *ier STR_PLEN(name) - STR_PLEN(file) STR_PLEN(nfile)) { - int len_name = (int)STR_LEN(name); - int len_file = (int)STR_LEN(file); - int len_nfile = (int)STR_LEN(nfile); - FMCALL(adflin2, ADFLIN2)(PID, STR_PTR(name), STR_PTR(file), - STR_PTR(nfile), &len_name, &len_file, &len_nfile, ID, ier); -} - -void FMNAME(adflver, ADFLVER) (STR_PSTR(version), int *ier STR_PLEN(version)) { - int len_version = (int)STR_LEN(version); - FMCALL(adflve2, ADFLVE2)(STR_PTR(version), &len_version, ier); -} - -void FMNAME(adfmove, ADFMOVE) (double *PID, double *ID, double *NPID, int *ier) { - FMCALL(adfmov2, ADFMOV2)(PID, ID, NPID, ier); -} - -void FMNAME(adfncld, ADFNCLD) (double *ID, int *numcld, int *ier) { - FMCALL(adfncl2, ADFNCL2)(ID, numcld, ier); -} - -void FMNAME(adfpdim, ADFPDIM) (double *ID, STR_PSTR(dtype), int *dims, - int *dvals, int *ier STR_PLEN(dtype)) { - int len_dtype = (int)STR_LEN(dtype); - FMCALL(adfpdi2, ADFPDI2)(ID, STR_PTR(dtype), &len_dtype, dims, - dvals, ier); -} - -void FMNAME(adfpnam, ADFPNAM) (double *PID, double *ID, STR_PSTR(name), - int *ier STR_PLEN(name)) { - int len_name = (int)STR_LEN(name); - FMCALL(adfpna2, ADFPNA2)(PID, ID, STR_PTR(name), &len_name, ier); -} - -void FMNAME(adfses, ADFSES) (int *estate, int *ier) { - FMCALL(adfses2, ADFSES2)(estate, ier); -} - -void FMNAME(adfslb, ADFSLB) (double *ID, STR_PSTR(label), - int *ier STR_PLEN(label)) { - int len_label = (int)STR_LEN(label); - FMCALL(adfslb2, ADFSLB2)(ID, STR_PTR(label), &len_label, ier); -} - -/* added mainly to handle character output under windows */ - -void FMNAME(adfreadc, ADFREADC) (double *ID, int *s_start, int *s_end, - int *s_stride, int *m_num_dims, int *m_dims, int *m_start, int *m_end, - int *m_stride, STR_PSTR(data), int *ier STR_PLEN(data)) { - FMCALL(adfread,ADFREAD)(ID, s_start, s_end, s_stride, m_num_dims, - m_dims, m_start, m_end, m_stride, STR_PTR(data), ier); -} - -void FMNAME(adfrallc, ADFRALLC) (double *ID, STR_PSTR(data), - int *ier STR_PLEN(data)) { - FMCALL(adfrall, ADFRALL)(ID, STR_PTR(data), ier); -} - -void FMNAME(adfrblkc, ADFRBLKC) (double *ID, int *b_start, int *b_end, - STR_PSTR(data), int *ier STR_PLEN(data)) { - FMCALL(adfrblk, ADFRBLK)(ID, b_start, b_end, STR_PTR(data), ier); -} - -void FMNAME(adfwritc, ADFWRITC) (double *ID, int *s_start, int *s_end, - int *s_stride, int *m_num_dims, int *m_dims, int *m_start, int *m_end, - int *m_stride, STR_PSTR(data), int *ier STR_PLEN(data)) { - FMCALL(adfwrit,ADFWRIT)(ID, s_start, s_end, s_stride, m_num_dims, - m_dims, m_start, m_end, m_stride, STR_PTR(data), ier); -} - -void FMNAME(adfwallc, ADFWALLC) (double *ID, STR_PSTR(data), - int *ier STR_PLEN(data)) { - FMCALL(adfwall, ADFWALL)(ID, STR_PTR(data), ier); -} - -void FMNAME(adfwblkc, ADFWBLKC) (double *ID, int *b_start, int *b_end, - STR_PSTR(data), int *ier STR_PLEN(data)) { - FMCALL(adfwblk, ADFWBLK)(ID, b_start, b_end, STR_PTR(data), ier); -} - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/au1_ftoc.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/au1_ftoc.c deleted file mode 100644 index 2fc4b1dfe9..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/au1_ftoc.c +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef MAKEDEPEND -#include -#include -#endif - -#include "fortran_macros.h" -#include "libadf/ADF_fbind.h" -#include "ADF_U1_internals.h" - -void FMNAME(au1cn, AU1CN) (double *id, STR_PSTR(name), STR_PSTR(label), - int *depth, int *numnodes, int *ier STR_PLEN(name) STR_PLEN(label)) { - int len_name = (int)STR_LEN(name); - int len_label = (int)STR_LEN(label); - FMCALL(au1cn2, AU1CN2)(id, STR_PTR(name), &len_name, STR_PTR(label), &len_label, - depth, numnodes, ier); -} - -void FMNAME(au1rnid, AU1RNID) (double *id, STR_PSTR(name), STR_PSTR(label), - int *istart, int *ilen, int *depth, int *ilen_ret, double *node_id, - int *ier STR_PLEN(name) STR_PLEN(label)) { - int len_name = (int)STR_LEN(name); - int len_label = (int)STR_LEN(label); - FMCALL(au1rnid2, AU1RNID2)(id, STR_PTR(name), &len_name, STR_PTR(label), &len_label, - istart, ilen, depth, ilen_ret, node_id, ier); -} - -void FMNAME(au1can, AU1CAN) (double *id, STR_PSTR(name), STR_PSTR(label), - int *nancstr, int *ier STR_PLEN(name) STR_PLEN(label)) { - int len_name = (int)STR_LEN(name); - int len_label = (int)STR_LEN(label); - FMCALL(au1can2, AU1CAN2)(id, STR_PTR(name), &len_name, STR_PTR(label), &len_label, - nancstr, ier); -} - -void FMNAME(au1raid, AU1RAID) (double *id, STR_PSTR(name), STR_PSTR(label), - int *istart, int *ilen, int *ilen_ret, double *node_id, - int *ier STR_PLEN(name) STR_PLEN(label)) { - int len_name = (int)STR_LEN(name); - int len_label = (int)STR_LEN(label); - FMCALL(au1raid2, AU1RAID2)(id, STR_PTR(name), &len_name, STR_PTR(label), &len_label, - istart, ilen, ilen_ret, node_id, ier); -} - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/cg_ftoc.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/cg_ftoc.c deleted file mode 100644 index 41ad94dd8f..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/cg_ftoc.c +++ /dev/null @@ -1,1847 +0,0 @@ -#ifndef MAKEDEPEND -#include -#include -#include -#endif - -#include "fortran_macros.h" -#include "cgnslib.h" -#include "cgns_header.h" - -#ifndef MAKEDEPEND -#include -#endif - -#include "libadf/ADF.h" - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Convert between Fortran and C strings * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -static void string_2_C_string(char *string, int string_length, - char *c_string, int max_len, int *ierr) { - int i, iend; - - if (string == NULL || c_string == NULL) { - cgi_error ("NULL string pointer"); - *ierr = CG_ERROR; - return; - } - - /** Skip and trailing blanks **/ - for (iend = string_length-1; iend >= 0; iend--) { - if (string[iend] != ' ') break; - } - if (iend >= max_len) iend = max_len - 1; - - /** Copy the non-trailing blank portion of the string **/ - for (i = 0; i <= iend; i++) - c_string[i] = string[i]; - - /** NULL terminate the C string **/ - c_string[i] = '\0'; - *ierr = CG_OK; -} - -static void string_2_F_string(char *c_string, char *string, - int string_length, int *ierr) { - int i, len; - - if (c_string == NULL || string == NULL) { - cgi_error ("NULL string pointer"); - *ierr = CG_ERROR; - return; - } - len = strlen(c_string); - if (len > string_length) len = string_length; - - for (i = 0; i < len; i++) - string[i] = c_string[i]; - while (i < string_length) - string[i++] = ' '; - *ierr = CG_OK; -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * LIBRARY FUNCTIONS * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -void FMNAME(cg_open_f, CG_OPEN_F) (STR_PSTR(filename), int *mode, - int *fn, int *ier STR_PLEN(filename)) { - int length; - char *c_name; - - length = (int) STR_LEN(filename); - c_name = CGNS_NEW(char, length+1); - - string_2_C_string(STR_PTR(filename), STR_LEN(filename), c_name, length, ier); - if (*ier) { - free (c_name); - return; - } -#if DEBUG_FTOC - printf("filename='%s'\n",c_name); -#endif - *ier = cg_open(c_name, *mode, fn); - free(c_name); -} - -void FMNAME(cg_version_f, CG_VERSION_F) (int *fn, float *FileVersion, int *ier) { - - *ier = cg_version(*fn, FileVersion); -} - -void FMNAME(cg_close_f, CG_CLOSE_F) (int *fn, int *ier) { - - *ier = cg_close(*fn); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write CGNSBase_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -void FMNAME(cg_nbases_f, CG_NBASES_F) (int *fn, int *nbases, int *ier) { - - *ier = cg_nbases(*fn, nbases); -} - -void FMNAME(cg_base_read_f, CG_BASE_READ_F) (int *fn, int *B, STR_PSTR(basename), - int *cell_dim, int *phys_dim, int *ier STR_PLEN(basename)) { - char c_name[ADF_NAME_LENGTH+1]; - - *ier = cg_base_read(*fn, *B, c_name, cell_dim, phys_dim); - if (!*ier) - string_2_F_string(c_name, STR_PTR(basename), STR_LEN(basename), ier); -} - -void FMNAME(cg_base_id_f, CG_BASE_ID_F) (int *fn, int *B, double *base_id, - int *ier) { - - *ier = cg_base_id(*fn, *B, base_id); -} - -void FMNAME(cg_base_write_f, CG_BASE_WRITE_F) (int *fn, STR_PSTR(basename), - int *cell_dim, int *phys_dim, int *B, int *ier STR_PLEN(basename)) { - char c_name[ADF_NAME_LENGTH+1]; - - string_2_C_string(STR_PTR(basename), STR_LEN(basename), - c_name, ADF_NAME_LENGTH, ier); - if (*ier) return; -#if DEBUG_FTOC - printf("\nbasename='%s'\n", c_name); - printf("cell_dim=%d\n",*cell_dim); - printf("phys_dim=%d\n",*phys_dim); -#endif - - *ier = cg_base_write(*fn, c_name, *cell_dim, *phys_dim, B); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write Zone_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -void FMNAME(cg_nzones_f, CG_NZONES_F) (int *fn, int *B, int *nzones, int *ier) { - - *ier = cg_nzones(*fn, *B, nzones); -} - -void FMNAME(cg_zone_type_f, CG_ZONE_TYPE_F) (int *fn, int *B, int *Z, - ZoneType_t *type, int *ier) { - - *ier = cg_zone_type(*fn, *B, *Z, type); -} - -void FMNAME(cg_zone_read_f, CG_ZONE_READ_F) (int *fn, int *B, int *Z, - STR_PSTR(zonename), int *size, int *ier STR_PLEN(zonename)) { - char c_name[ADF_NAME_LENGTH+1]; - - *ier = cg_zone_read(*fn, *B, *Z, c_name, size); - if (!*ier) - string_2_F_string(c_name, STR_PTR(zonename), STR_LEN(zonename), ier); -} - -void FMNAME(cg_zone_id_f, CG_ZONE_ID_F) (int *fn, int *B, int *Z, double *zone_id, - int *ier) { - - *ier = cg_zone_id(*fn, *B, *Z, zone_id); -} - -void FMNAME(cg_zone_write_f, CG_ZONE_WRITE_F) (int *fn, int *B, STR_PSTR(zonename), - int *size, ZoneType_t *type, int *Z, int *ier STR_PLEN(zonename)) { - char c_name[ADF_NAME_LENGTH+1]; - - string_2_C_string(STR_PTR(zonename), STR_LEN(zonename), - c_name, ADF_NAME_LENGTH, ier); - if (*ier) return; - -#if DEBUG_FTOC - printf("\n zonename='%s'\n", c_name); -#endif - - *ier = cg_zone_write(*fn, *B, c_name, size, *type, Z); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write Family_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -void FMNAME(cg_nfamilies_f, CG_NFAMILIES_F) (int *fn, int *B, - int *nfamilies, int *ier) { - - *ier = cg_nfamilies(*fn, *B, nfamilies); -} - -void FMNAME(cg_family_read_f, CG_FAMILY_READ_F) (int *fn, int *B, int *F, - STR_PSTR(family_name), int *nboco, int *ngeos, int *ier - STR_PLEN(family_name)) { - char c_name[ADF_NAME_LENGTH+1]; - - *ier = cg_family_read(*fn, *B, *F, c_name, nboco, ngeos); - if (!*ier) - string_2_F_string(c_name, STR_PTR(family_name), STR_LEN(family_name), ier); -} - -void FMNAME(cg_family_write_f, CG_FAMILY_WRITE_F) (int *fn, int *B, - STR_PSTR(family_name), int *F, int *ier STR_PLEN(family_name)) { - char c_name[ADF_NAME_LENGTH+1]; - - string_2_C_string(STR_PTR(family_name), STR_LEN(family_name), - c_name, ADF_NAME_LENGTH, ier); - if (!*ier) - *ier = cg_family_write(*fn, *B, c_name, F); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write FamBC_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -void FMNAME(cg_fambc_read_f, CG_FAMBC_READ_F) (int *fn, int *B, int *F, - int *BC, STR_PSTR(fambc_name), BCType_t *bocotype, int *ier - STR_PLEN(fambc_name)) { - char c_name[ADF_NAME_LENGTH+1]; - - *ier = cg_fambc_read(*fn, *B, *F, *BC, c_name, bocotype); - if (!*ier) - string_2_F_string(c_name, STR_PTR(fambc_name), STR_LEN(fambc_name), ier); -} - -void FMNAME(cg_fambc_write_f, CG_FAMBC_WRITE_F) (int *fn, int *B, int *F, - STR_PSTR(fambc_name), BCType_t *bocotype, int *BC, int *ier - STR_PLEN(fambc_name)) { - char c_name[ADF_NAME_LENGTH+1]; - - string_2_C_string(STR_PTR(fambc_name), STR_LEN(fambc_name), - c_name, ADF_NAME_LENGTH, ier); - if (!*ier) - *ier = cg_fambc_write(*fn, *B, *F, c_name, *bocotype, BC); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write GeometryReference_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -void FMNAME(cg_geo_read_f, CG_GEO_READ_F) (int *fn, int *B, int *F, int *G, - STR_PSTR(geo_name), STR_PSTR(geo_file), STR_PSTR(CAD_name), - int *npart, int *ier STR_PLEN(geo_name) STR_PLEN(geo_file) - STR_PLEN(CAD_name)) { - char c_geo_name[ADF_NAME_LENGTH+1]; - char c_CAD_name[ADF_NAME_LENGTH+1]; - char *c_geo_file; - - *ier = cg_geo_read(*fn, *B, *F, *G, c_geo_name, &c_geo_file, - c_CAD_name, npart); - if (*ier) return; - - string_2_F_string(c_geo_name, STR_PTR(geo_name), STR_LEN(geo_name), ier); - if (*ier) return; - string_2_F_string(c_CAD_name, STR_PTR(CAD_name), STR_LEN(CAD_name), ier); - if (*ier) return; - string_2_F_string(c_geo_file, STR_PTR(geo_file), STR_LEN(geo_file), ier); - free(c_geo_file); -} - -void FMNAME(cg_geo_write_f, CG_GEO_WRITE_F) (int *fn, int *B, int *F, - STR_PSTR(geo_name), STR_PSTR(geo_file), STR_PSTR(CAD_name), - int *G, int *ier STR_PLEN(geo_name) STR_PLEN(geo_file) - STR_PLEN(CAD_name)) { - char c_geo_name[ADF_NAME_LENGTH+1]; - char c_CAD_name[ADF_NAME_LENGTH+1]; - char *c_geo_file; - int length; - - /* convert Fortran-text-string to a C-string */ - string_2_C_string(STR_PTR(geo_name), STR_LEN(geo_name), - c_geo_name, ADF_NAME_LENGTH, ier); - if (*ier) return; - string_2_C_string(STR_PTR(CAD_name), STR_LEN(CAD_name), - c_CAD_name, ADF_NAME_LENGTH, ier); - if (*ier) return; - - length = STR_LEN(geo_file); - c_geo_file = CGNS_NEW(char, length+1); - string_2_C_string(STR_PTR(geo_file), STR_LEN(geo_file), - c_geo_file, length, ier); - if (!*ier) - *ier = cg_geo_write(*fn, *B, *F, c_geo_name, c_geo_file, c_CAD_name, G); - free(c_geo_file); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write GeometryEntity_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -void FMNAME(cg_part_read_f, CG_PART_READ_F) (int *fn, int *B, int *F, int *G, - int *P, STR_PSTR(part_name), int *ier STR_PLEN(part_name)) { - char c_part_name[ADF_NAME_LENGTH+1]; - - *ier = cg_part_read(*fn, *B, *F, *G, *P, c_part_name); - if (!*ier) - string_2_F_string(c_part_name, STR_PTR(part_name), STR_LEN(part_name), ier); -} - -void FMNAME(cg_part_write_f, CG_PART_WRITE_F) (int *fn, int *B, int *F, - int *G, STR_PSTR(part_name), int *P, int *ier STR_PLEN(part_name)) { - char c_part_name[ADF_NAME_LENGTH+1]; - - /* convert Fortran-text-string to a C-string */ - string_2_C_string(STR_PTR(part_name), STR_LEN(part_name), - c_part_name, ADF_NAME_LENGTH, ier); - if (!*ier) - *ier = cg_part_write(*fn, *B, *F, *G, c_part_name, P); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write DiscreteData_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -void FMNAME(cg_ndiscrete_f, CG_NDISCRETE_F) (int *fn, int *B, int *Z, - int *ndiscrete, int *ier) { - - *ier = cg_ndiscrete(*fn, *B, *Z, ndiscrete); -} - -void FMNAME(cg_discrete_read_f, CG_DISCRETE_READ_F) (int *fn, int *B, int *Z, - int *D, STR_PSTR(discrete_name), int *ier STR_PLEN(discrete_name)) { - char c_name[ADF_NAME_LENGTH+1]; - - *ier = cg_discrete_read(*fn, *B, *Z, *D, c_name); - if (!*ier) - string_2_F_string(c_name, STR_PTR(discrete_name), STR_LEN(discrete_name), ier); -} - -void FMNAME(cg_discrete_write_f, CG_DISCRETE_WRITE_F) (int *fn, int *B, int *Z, - STR_PSTR(discrete_name), int *D, int *ier STR_PLEN(discrete_name)) { - char c_name[ADF_NAME_LENGTH+1]; - - string_2_C_string(STR_PTR(discrete_name), STR_LEN(discrete_name), - c_name, ADF_NAME_LENGTH, ier); - if (*ier) return; -#if DEBUG_FTOC - printf(" discrete_name='%s'\n", c_name); -#endif - - *ier = cg_discrete_write(*fn, *B, *Z, c_name, D); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write GridCoordinates_t/DataArray_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -void FMNAME(cg_ncoords_f, CG_NCOORDS_F) (int *fn, int *B, int *Z, int *ncoords, - int *ier) { - - *ier = cg_ncoords(*fn, *B, *Z, ncoords); -} - -void FMNAME(cg_coord_info_f, CG_COORD_INFO_F) (int *fn, int *B, int *Z, int *C, - DataType_t *type, STR_PSTR(coordname), int *ier STR_PLEN(coordname)) { - char c_name[ADF_NAME_LENGTH+1]; - - *ier = cg_coord_info(*fn, *B, *Z, *C, type, c_name); - if (!*ier) - string_2_F_string(c_name, STR_PTR(coordname), STR_LEN(coordname), ier); -} - -void FMNAME(cg_coord_read_f, CG_COORD_READ_F) (int *fn, int *B, int *Z, - STR_PSTR(coordname), DataType_t *type, int *rmin, int *rmax, - void *coord, int *ier STR_PLEN(coordname)) { - char c_name[ADF_NAME_LENGTH+1]; - - string_2_C_string(STR_PTR(coordname), STR_LEN(coordname), - c_name, ADF_NAME_LENGTH, ier); - if (*ier) return; - -#if DEBUG_FTOC - printf("coordname='%s'\n", c_name); -#endif - - *ier = cg_coord_read(*fn, *B, *Z, c_name, *type, rmin, rmax, coord); -} - -void FMNAME(cg_coord_id_f, CG_COORD_ID_F) (int *fn, int *B, int *Z, int *C, - double *coord_id, int *ier) { - - *ier = cg_coord_id(*fn, *B, *Z, *C, coord_id); -} - -void FMNAME(cg_coord_write_f, CG_COORD_WRITE_F) (int *fn, int *B, int *Z, - DataType_t *type, STR_PSTR(coordname), void *coord, int *C, int *ier - STR_PLEN(coordname)) { - char c_name[ADF_NAME_LENGTH+1]; - - string_2_C_string(STR_PTR(coordname), STR_LEN(coordname), - c_name, ADF_NAME_LENGTH, ier); - if (*ier) return; -#if DEBUG_FTOC - printf(" coordname='%s'\n", c_name); -#endif - - *ier = cg_coord_write(*fn, *B, *Z, *type, c_name, coord, C); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write Elements_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -void FMNAME(cg_nsections_f, CG_NSECTIONS_F) (int *fn, int *B, int *Z, - int *nsections, int *ier) { - - *ier = cg_nsections(*fn, *B, *Z, nsections); -} - -void FMNAME(cg_section_read_f, CG_SECTION_READ_F) (int *fn, int *B, int *Z, - int *E, STR_PSTR(section_name), ElementType_t *type, int *start, int *end, - int *nbndry, int *parent_flag, int *ier STR_PLEN(section_name)) { - char c_name[ADF_NAME_LENGTH+1]; - - *ier = cg_section_read(*fn, *B, *Z, *E, c_name, type, start, - end, nbndry, parent_flag); - if (!*ier) - string_2_F_string(c_name, STR_PTR(section_name), STR_LEN(section_name), ier); -} - -void FMNAME(cg_elements_read_f, CG_ELEMENTS_READ_F) (int *fn, int *B, int *Z, - int *E, int *elements, int *parent_data, int *ier) { - - *ier = cg_elements_read(*fn, *B, *Z, *E, elements, parent_data); -} - -void FMNAME(cg_elementdatasize_f, CG_ELEMENTDATASIZE_F) (int *fn, int *B, int *Z, - int *E, int *ElementDataSize, int *ier) { - - *ier = cg_ElementDataSize(*fn, *B, *Z, *E, ElementDataSize); -} - -void FMNAME(cg_section_write_f, CG_SECTION_WRITE_F) (int *fn, int *B, int *Z, - STR_PSTR(section_name), ElementType_t *type, int *start, int *end, int *nbndry, - int *elements, int *S, int *ier STR_PLEN(section_name)) { - char c_name[ADF_NAME_LENGTH+1]; - - /* convert Fortran-text-string to a C-string */ - string_2_C_string(STR_PTR(section_name), STR_LEN(section_name), - c_name, ADF_NAME_LENGTH, ier); - if (!*ier) - *ier = cg_section_write(*fn, *B, *Z, c_name, *type, *start, *end, - *nbndry, elements, S); -} - -void FMNAME(cg_parent_data_write_f, CG_PARENT_DATA_WRITE_F) (int *fn, int *B, - int *Z, int *S, int *parent_data, int *ier) { - - *ier = cg_parent_data_write(*fn, *B, *Z, *S, parent_data); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write FlowSolution_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -void FMNAME(cg_nsols_f, CG_NSOLS_F) (int *fn, int *B, int *Z, int *nsols, int *ier) { - - *ier = cg_nsols(*fn, *B, *Z, nsols); -} - -void FMNAME(cg_sol_info_f, CG_SOL_INFO_F) (int *fn, int *B, int *Z, int *S, - STR_PSTR(solname), GridLocation_t *location, int *ier STR_PLEN(solname)) { - char c_name[ADF_NAME_LENGTH+1]; - - *ier = cg_sol_info(*fn, *B, *Z, *S, c_name, location); - if (!*ier) - string_2_F_string(c_name, STR_PTR(solname), STR_LEN(solname), ier); -} - -void FMNAME(cg_sol_id_f, CG_SOL_ID_F) (int *fn, int *B, int *Z, int *S, - double *sol_id, int *ier) { - - *ier = cg_sol_id(*fn, *B, *Z, *S, sol_id); -} - -void FMNAME(cg_sol_write_f, CG_SOL_WRITE_F)(int *fn, int *B, int *Z, STR_PSTR(solname), - GridLocation_t *location, int *S, int *ier STR_PLEN(solname)) { - char c_name[ADF_NAME_LENGTH+1]; - - string_2_C_string(STR_PTR(solname), STR_LEN(solname), - c_name, ADF_NAME_LENGTH, ier); - if (*ier) return; -#if DEBUG_FTOC - printf("\n solname='%s'\n", c_name); -#endif - - *ier = cg_sol_write(*fn, *B, *Z, c_name, *location, S); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write solution DataArray_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -void FMNAME(cg_nfields_f, CG_NFIELDS_F) (int *fn, int *B, int *Z, int *S, - int *nfields, int *ier) { - - *ier = cg_nfields(*fn, *B, *Z, *S, nfields); -} - -void FMNAME(cg_field_info_f, CG_FIELD_INFO_F) (int *fn, int *B, int *Z, int *S, - int *F, DataType_t *type, STR_PSTR(fieldname), int *ier STR_PLEN(fieldname)) { - char c_name[ADF_NAME_LENGTH+1]; - - *ier = cg_field_info(*fn, *B, *Z, *S, *F, type, c_name); - if (!*ier) - string_2_F_string(c_name, STR_PTR(fieldname), STR_LEN(fieldname), ier); -} - -void FMNAME(cg_field_read_f, CG_FIELD_READ_F) (int *fn, int *B, int *Z, int *S, - STR_PSTR(fieldname), DataType_t *type, int *rmin, int *rmax, - void *field_ptr, int *ier STR_PLEN(fieldname)) { - char c_name[ADF_NAME_LENGTH+1]; - - string_2_C_string(STR_PTR(fieldname), STR_LEN(fieldname), - c_name, ADF_NAME_LENGTH, ier); - if (*ier) return; -#if DEBUG_FTOC - printf("fieldname='%s'\n", c_name); -#endif - - *ier = cg_field_read(*fn, *B, *Z, *S, c_name, *type, rmin, rmax, field_ptr); -} - -void FMNAME(cg_field_id_f, CG_FIELD_ID_F) (int *fn, int *B, int *Z, int *S, int *F, - double *field_id, int *ier) { - - *ier = cg_field_id(*fn, *B, *Z, *S, *F, field_id); -} - -void FMNAME(cg_field_write_f, CG_FIELD_WRITE_F) (int *fn, int *B, int *Z, int *S, - DataType_t *type, STR_PSTR(fieldname), void *field_ptr, int *F, - int *ier STR_PLEN(fieldname)) { - char c_name[ADF_NAME_LENGTH+1]; - - string_2_C_string(STR_PTR(fieldname), STR_LEN(fieldname), - c_name, ADF_NAME_LENGTH, ier); - if (*ier) return; -#if DEBUG_FTOC - printf(" fieldname='%s'\n", c_name); -#endif - - *ier = cg_field_write(*fn, *B, *Z, *S, *type, c_name, field_ptr, F); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write OversetHoles_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -void FMNAME(cg_nholes_f, CG_NHOLES_F) (int *fn, int *B, int *Z, int *nholes, - int *ier) { - - *ier = cg_nholes(*fn, *B, *Z, nholes); -} - -void FMNAME(cg_hole_info_f, CG_HOLE_INFO_F) (int *fn, int *B, int *Z, int *I, - STR_PSTR(holename), GridLocation_t *location, PointSetType_t *ptset_type, - int *nptsets, int *npnts, int *ier STR_PLEN(holename)) { - char c_name[ADF_NAME_LENGTH+1]; - - *ier = cg_hole_info(*fn, *B, *Z, *I, c_name, location, - ptset_type, nptsets, npnts); - if (!*ier) - string_2_F_string(c_name, STR_PTR(holename), STR_LEN(holename), ier); -} - -void FMNAME(cg_hole_read_f, CG_HOLE_READ_F) (int *fn, int *B, int *Z, int *I, - int *pnts, int *ier) { - - *ier = cg_hole_read(*fn, *B, *Z, *I, pnts); -} - -void FMNAME(cg_hole_id_f, CG_HOLE_ID_F) (int *fn, int *B, int *Z, int *I, - double *hole_id, int *ier) { - - *ier = cg_hole_id(*fn, *B, *Z, *I, hole_id); -} - -void FMNAME(cg_hole_write_f, CG_HOLE_WRITE_F) (int *fn, int *B, int *Z, - STR_PSTR(holename), GridLocation_t *location, PointSetType_t *ptset_type, - int *nptsets, int *npnts, int *pnts, int *I, int *ier STR_PLEN(holename)) { - char c_name[ADF_NAME_LENGTH+1]; - - string_2_C_string(STR_PTR(holename), STR_LEN(holename), - c_name, ADF_NAME_LENGTH, ier); - if (*ier) return; -#if DEBUG_FTOC - printf("holename='%s'\n", c_name); -#endif - - *ier = cg_hole_write(*fn, *B, *Z, c_name, *location, *ptset_type, - *nptsets, *npnts, pnts, I); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write GridConnectivity_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -void FMNAME(cg_nconns_f, CG_NCONNS_F) (int *fn, int *B, int *Z, int *nconns, - int *ier) { - - *ier = cg_nconns(*fn, *B, *Z, nconns); -} - -void FMNAME(cg_conn_info_f, CG_CONN_INFO_F) (int *fn, int *B, int *Z, int *I, - STR_PSTR(connectname), GridLocation_t *location, GridConnectivityType_t *type, - PointSetType_t *ptset_type, int *npnts, STR_PSTR(donorname), - ZoneType_t *donor_zonetype, PointSetType_t *donor_ptset_type, - DataType_t *donor_datatype, int *ndata_donor, int *ier - STR_PLEN(connectname) STR_PLEN(donorname)) { - char cc_name[ADF_NAME_LENGTH+1], dc_name[ADF_NAME_LENGTH+1]; - - *ier = cg_conn_info(*fn, *B, *Z, *I, cc_name, location, - type, ptset_type, npnts, dc_name, - donor_zonetype, donor_ptset_type, donor_datatype, - ndata_donor); - if (!*ier) { - string_2_F_string(cc_name, STR_PTR(connectname), STR_LEN(connectname), ier); - if (*ier) return; - string_2_F_string(dc_name, STR_PTR(donorname), STR_LEN(donorname), ier); - } -} - -void FMNAME(cg_conn_read_f, CG_CONN_READ_F) (int *fn, int *B, int *Z, int *I, - int *pnts, DataType_t *donor_datatype, void *donor_data, int *ier) { - - *ier = cg_conn_read(*fn, *B, *Z, *I, pnts, *donor_datatype, donor_data); -} -void FMNAME(cg_conn_id_f, CG_CONN_ID_F) (int *fn, int *B, int *Z, int *I, - double *conn_id, int *ier) { - - *ier = cg_conn_id(*fn, *B, *Z, *I, conn_id); -} - -void FMNAME(cg_conn_write_f, CG_CONN_WRITE_F) (int *fn, int *B, int *Z, - STR_PSTR(connectname), GridLocation_t *location, GridConnectivityType_t *type, - PointSetType_t *ptset_type, int *npnts, int *pnts, STR_PSTR(donorname), - ZoneType_t *donor_zonetype, PointSetType_t *donor_ptset_type, - DataType_t *donor_datatype, int *ndata_donor, void *donor_data, int *I, - int *ier STR_PLEN(connectname) STR_PLEN(donorname)) { - char cc_name[ADF_NAME_LENGTH+1], dc_name[ADF_NAME_LENGTH+1]; - - string_2_C_string(STR_PTR(connectname), STR_LEN(connectname), - cc_name, ADF_NAME_LENGTH, ier); - if (*ier) return; - string_2_C_string(STR_PTR(donorname), STR_LEN(donorname), - dc_name, ADF_NAME_LENGTH, ier); - if (*ier) return; - -#if DEBUG_FTOC - printf("connectname='%s'\n", cc_name); - printf("donorname='%s'\n", dc_name); -#endif - - *ier = cg_conn_write(*fn, *B, *Z, cc_name, *location, *type, *ptset_type, - *npnts, pnts, dc_name, *donor_zonetype, *donor_ptset_type, - *donor_datatype, *ndata_donor, donor_data, I); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write GridConnectivity1to1_t Nodes in a zone * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -void FMNAME(cg_n1to1_f, CG_N1TO1_F) (int *fn, int *B, int *Z, int *n1to1, - int *ier) { - - *ier = cg_n1to1(*fn, *B, *Z, n1to1); -} - -void FMNAME(cg_1to1_read_f, CG_1TO1_READ_F) (int *fn, int *B, int *Z, int *I, - STR_PSTR(connectname), STR_PSTR(donorname), int *range, int *donor_range, - int *transform, int *ier STR_PLEN(connectname) STR_PLEN(donorname)) { - char cc_name[ADF_NAME_LENGTH+1], dc_name[ADF_NAME_LENGTH+1]; - - *ier = cg_1to1_read(*fn, *B, *Z, *I, cc_name, dc_name, - range, donor_range, transform); - if (!*ier) { - string_2_F_string(cc_name, STR_PTR(connectname), STR_LEN(connectname), ier); - if (*ier) return; - string_2_F_string(dc_name, STR_PTR(donorname), STR_LEN(donorname), ier); - } -} - -void FMNAME(cg_1to1_id_f, CG_1TO1_ID_F) (int *fn, int *B, int *Z, int *I, - double *one21_id, int *ier) { - - *ier = cg_1to1_id(*fn, *B, *Z, *I, one21_id); -} - -void FMNAME(cg_1to1_write_f, CG_1TO1_WRITE_F) (int *fn, int *B, int *Z, - STR_PSTR(connectname), STR_PSTR(donorname), int *range, - int *donor_range, int *transform, int *I, int *ier - STR_PLEN(connectname) STR_PLEN(donorname)) { - char cc_name[ADF_NAME_LENGTH+1], dc_name[ADF_NAME_LENGTH+1]; - - string_2_C_string(STR_PTR(connectname), STR_LEN(connectname), - cc_name, ADF_NAME_LENGTH, ier); - if (*ier) return; - string_2_C_string(STR_PTR(donorname), STR_LEN(donorname), - dc_name, ADF_NAME_LENGTH, ier); - if (*ier) return; - -#if DEBUG_FTOC - printf("connectname='%s'\n", cc_name); - printf("donorname='%s'\n", dc_name); -#endif - - *ier = cg_1to1_write(*fn, *B, *Z, cc_name, dc_name, range, - donor_range, transform, I); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read all GridConnectivity1to1_t Nodes of a base * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -void FMNAME(cg_n1to1_global_f, CG_N1TO1_GLOBAL_F) (int *fn, int *B, - int *n1to1_global, int *ier) { - - *ier = cg_n1to1_global(*fn, *B, n1to1_global); -} - - -void FMNAME(cg_1to1_read_global_f, CG_1TO1_READ_GLOBAL_F) (int *fn, int *B, - STR_PSTR(connectname), STR_PSTR(zonename), STR_PSTR(donorname), - int *range, int *donor_range, int *transform, int *ier - STR_PLEN(connectname) STR_PLEN(zonename) STR_PLEN(donorname)) { - int n, i, step, len, ierr; - int cell_dim, phys_dim; /* number of dimension for model */ - int Ndim; /* indexDimension */ - int Nglobal; /* number of 1to1 interface in base */ - char **c_connectname, **c_zonename, **c_donorname; - char basename[ADF_NAME_LENGTH+1]; - int **c_range, **c_donor_range; - int **c_transform; - - /* initialize error code */ - *ier=0; - - /* get number of dimension for model: Ndim */ - if (cg_base_read(*fn, *B, basename, &cell_dim, &phys_dim)) { - *ier=1; - return; - } - /* For structured grid: */ - Ndim = cell_dim; - - /* get number of 1to1 interface in base: Nglobal */ - if (cg_n1to1_global(*fn, *B, &Nglobal)) { - *ier=1; - return; - } - if (Nglobal<1) { - cgi_error("Number of interface must equal 1 or more"); - *ier=1; - return; - } - /* allocate memory for C-arrays (ptr-to-ptr) */ - if ((c_connectname = (char **)malloc(Nglobal*sizeof(char *)))==NULL || - (c_zonename = (char **)malloc(Nglobal*sizeof(char *)))==NULL || - (c_donorname = (char **)malloc(Nglobal*sizeof(char *)))==NULL || - (c_range = (int **) malloc(Nglobal*sizeof(int *)))==NULL || - (c_donor_range = (int **) malloc(Nglobal*sizeof(int *)))==NULL || - (c_transform = (int **) malloc(Nglobal*sizeof(int *)))==NULL) { - cgi_error("Error allocating memory..."); - *ier = 1; - return; - } - len = ADF_NAME_LENGTH+1; - for (n=0; n -#include -#include -#endif - -#include "cgnslib.h" -#include "cgns_header.h" -#include "libadf/ADF.h" - -char cgns_error_mess[200] = "no CGNS error reported"; - -void cgi_error(char *format, ...) { - va_list arg; - va_start(arg, format); - vsprintf(cgns_error_mess,format, arg); - va_end(arg); -} - -void cgi_warning(char *format, ...) { - va_list arg; - fprintf(stdout,"*** Warning:"); - va_start(arg, format); - vfprintf(stdout,format,arg); - va_end(arg); - fprintf(stdout," ***\n"); -} - -char const *cg_get_error() { - return cgns_error_mess; -} - -void cg_error_exit() { - fprintf(stderr,"%s\n",cgns_error_mess); - exit(1); -} - -void cg_error_print() { - fprintf(stderr,"%s\n",cgns_error_mess); -} - -void adf_error(char *routine_name, int ier) { - char adf_err[80]; - - ADF_Error_Message(ier, adf_err); - cgi_error("Error in routine '%s':\n '%s'",routine_name,adf_err); -} - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/cgns_header.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/cgns_header.h deleted file mode 100644 index 369722658e..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/cgns_header.h +++ /dev/null @@ -1,1118 +0,0 @@ -#ifndef MAKEDEPEND -#include /* included for definition of HUGE */ -#endif - -#define CGNSHEAD_H - -typedef char char_33[33]; -typedef char const cchar_33[33]; -typedef int int_6[6]; -typedef int int_3[3]; - -#define MIN(a,b) (((a)<(b))?(a):(b)) -#define MAX(a,b) (((a)>(b))?(a):(b)) - -#define CGNS_DELETE_SHIFT(nchild, child) { \ - for (n=0; nnchild && strcmp(parent->child[n].name,node_name); n++); \ - if (n==parent->nchild) { \ - cgi_error("Error in cg_delete: Can't find node '%s'",node_name); \ - return 1; \ - } \ - for (m=n+1; mnchild; m++) parent->child[m-1] = parent->child[m]; \ - parent->nchild --; \ -} - -#define ADDRESS4MULTIPLE(parent_type, nchild, child, child_type) { \ - parent_type *parent = (parent_type *)posit; \ - child = 0; \ - if (local_mode == MODE_WRITE) { \ - for (n=0; nnchild && strcmp(parent->child[n].name,given_name);n++);\ - if (n==parent->nchild) { \ - if (parent->nchild==0) parent->child = CGNS_NEW(child_type, 1); \ - else parent->child = CGNS_RENEW(child_type,parent->nchild+1, parent->child);\ - child = &parent->child[parent->nchild]; \ - parent->nchild++; \ - } else { \ - if (cg->mode == MODE_WRITE) error1=1; \ - else { \ - parent_id = parent->id; \ - child= &(parent->child[n]); \ - } \ - } \ - } else if (local_mode == MODE_READ) { \ - if (given_no > parent->nchild || given_no<=0) error2=1; \ - else child = &parent->child[given_no-1]; \ - } \ -} - -#define ADDRESS4SINGLE_ALLOC(parent_type, child) { \ - parent_type *parent = (parent_type *)posit; \ - child = &parent->child; \ - parent_id = parent->id; \ -} - -#define ADDRESS4SINGLE(parent_type, child, child_type, size) { \ - parent_type *parent = (parent_type *)posit; \ - if (local_mode==MODE_WRITE) { \ - if (parent->child==0) parent->child = CGNS_NEW(child_type, size); \ - else { \ - if (cg->mode == MODE_WRITE) error1=1; \ - else parent_id = parent->id; \ - } \ - } \ - child = parent->child; \ -} - -#define NDESCRIPTOR(parent_type) { \ - parent_type *parent = (parent_type *)posit; \ - (*ndescriptors)= parent->ndescr; \ -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Macros, moved from cgnslib.h * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -#define CGNS_NEW(type,size) (type *)cgi_malloc(size,sizeof(type)) -#define CGNS_RENEW(type,size,old) (type *)cgi_realloc(old,(unsigned)(size)*sizeof(type)) - -#define DEBUG_FILE 0 -#define DEBUG_BASE 0 -#define DEBUG_ZONE 0 -#define DEBUG_SORT 0 -#define DEBUG_ARRAY 0 -#define DEBUG_SOL 0 -#define DEBUG_HOLE 0 -#define DEBUG_CONN 0 -#define DEBUG_1TO1 0 -#define DEBUG_BOCO 0 -#define DEBUG_GOTO 0 -#define DEBUG_FTOC 0 -#define DEBUG_VERSION 0 -#define DEBUG_LINKS 0 - -#define SKIP_DATA 0 -#define READ_DATA 1 - -/* - * Internal Structures: - */ - -/* Note that the link information held in these structs are only needed -** until the CGNS file is written. At that point the ADF link mechanism -** takes over and reading/modifying linked nodes is transparent to this -** API. -*/ -typedef struct { - char *filename; /* filename to use for the link; empty if within file */ - char *name_in_file; /* path of the node which the link will point to */ -} cgns_link; /* V2.1 */ - -typedef struct { /* Descriptor_t node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - char *text; /* Copy of Descriptor data */ -} cgns_descr; - -typedef struct { /* DimensionalUnits_t Node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - MassUnits_t mass; - LengthUnits_t length; - TimeUnits_t time; - TemperatureUnits_t temperature; - AngleUnits_t angle; -} cgns_units; - -typedef struct { /* DimensionalExponents_t Node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - char_33 data_type; /* type of data */ - void *data; /* MassExponent, LengthExponent, - TimeExponent, TemperatureExponent, - AngleExponent */ -} cgns_exponent; - -typedef struct { /* DataConversion_t Node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - char_33 data_type; /* type of data */ - void *data; /* ConversionScale, ConversionOffset */ -} cgns_conversion; - -typedef struct { /* DataArray_t Node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - char_33 data_type; /* type of data */ - int data_dim; /* number of dimensions */ - int dim_vals[12]; /* Size in each dimension */ - void *data; /* data */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - DataClass_t data_class; /* Class of data */ - cgns_units *units; /* ptrs to in-memory copy of units */ - cgns_exponent *exponents;/* ptrs to in-memory copy of exponents */ - cgns_conversion *convert;/* ptrs to in-memory copy of convert */ -} cgns_array; - -typedef struct { /* UserDefinedData_t Node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - int narrays; /* No of DataArray_t nodes */ - cgns_array *array; /* ptrs to in-mem. copy of Data Arrays */ - DataClass_t data_class; /* Class of data */ - cgns_units *units; /* ptrs to in-memory copy of units */ -} cgns_user_data; /* V2.1 */ - -typedef struct { /* IntegralData_t Node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - int narrays; /* number of data arrays */ - cgns_array *array; /* ptrs to in-memory copies of data_arrays */ - DataClass_t data_class; /* Class of data */ - cgns_units *units; /* ptrs to in-memory copy of units */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ -} cgns_integral; - -typedef struct { /* DiscreteData_t Node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - GridLocation_t location;/* Grid location where data is recorded*/ - int *rind_planes; /* No. of rind-planes on each zone face */ - int narrays; /* number of data arrays */ - cgns_array *array; /* ptrs to in-memory copies of data_arrays */ - DataClass_t data_class; /* Class of data */ - cgns_units *units; /* ptrs to in-memory copy of units */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ -} cgns_discrete; - -typedef struct { /* ConvergenceHistory_t node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - int iterations; /* no of iterations */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - cgns_descr *NormDefinitions; /* Document the norms */ - int narrays; /* number of data arrays */ - cgns_array *array; /* ptrs to in-memory copies of data_arrays */ - DataClass_t data_class; /* Class of data */ - cgns_units *units; /* ptrs to in-memory copy of units */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ -} cgns_converg; - -typedef struct { /* ReferenceState_t node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - cgns_descr *StateDescription;/* ReferenceStateDescription */ - int narrays; /* number of data arrays */ - cgns_array *array; /* ptrs to in-memory copies of data_arrays */ - DataClass_t data_class; /* Class of data */ - cgns_units *units; /* ptrs to in-memory copy of units */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ -} cgns_state; - -typedef struct { /* Gravity_t node */ /* V2.2 */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - int narrays; /* should be 0 or 1 */ - cgns_array *vector; /* ptrs to in-memory copy of GravityVector */ - DataClass_t data_class; /* Class of data */ - cgns_units *units; /* ptrs to in-memory copy of units */ - int nuser_data; /* number of user defined data nodes */ - cgns_user_data *user_data; /* User defined data. */ -} cgns_gravity; - -typedef struct { /* Axisymmetry_t node */ /* V2.2 */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - int narrays; /* should be 2, 3 or 4 */ - cgns_array *array; /* ptrs to in-memory copy of data arrays*/ - DataClass_t data_class; /* Class of data */ - cgns_units *units; /* ptrs to in-memory copy of units */ - int nuser_data; /* number of user defined data nodes */ - cgns_user_data *user_data; /* User defined data. */ -} cgns_axisym; - -typedef struct { /* RotatingCoordinates_t node */ /* V2.2 */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - int narrays; /* should be 2, 3 or 4 */ - cgns_array *array; /* ptrs to in-memory copy of data arrays*/ - DataClass_t data_class; /* Class of data */ - cgns_units *units; /* ptrs to in-memory copy of units */ - int nuser_data; /* number of user defined data nodes */ - cgns_user_data *user_data; /* User defined data. */ -} cgns_rotating; - -typedef struct { /* WallFunction_t node */ /* V2.2 */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - WallFunctionType_t type;/* Type of wall function */ - int nuser_data; /* number of user defined data nodes */ - cgns_user_data *user_data; /* User defined data. */ -} cgns_bcwall; - -typedef struct { /* Area_t node */ /* V2.2 */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - AreaType_t type; /* type of area */ - int narrays; /* should be 2 */ - cgns_array *array; /* ptrs to in-memory copy of data arrays*/ - int nuser_data; /* number of user defined data nodes */ - cgns_user_data *user_data; /* User defined data. */ -} cgns_bcarea; - -typedef struct { /* BCProperty_t node */ /* V2.2 */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - cgns_bcwall *bcwall; /* ptrs to in-memory copy of bcwall */ - cgns_bcarea *bcarea; /* ptrs to in-memory copy of bcarea */ - int nuser_data; /* number of user defined data nodes */ - cgns_user_data *user_data; /* User defined data. */ -} cgns_bprop; - -typedef struct { /* Periodic_t node */ /* V2.2 */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - int narrays; /* should be 3 */ - cgns_array *array; /* ptrs to in-memory copy of data arrays*/ - DataClass_t data_class; /* Class of data */ - cgns_units *units; /* ptrs to in-memory copy of units */ - int nuser_data; /* number of user defined data nodes */ - cgns_user_data *user_data; /* User defined data. */ -} cgns_cperio; - -typedef struct { /* AverageInterface_t node */ /* V2.2 */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - AverageInterfaceType_t type; /* type of interface */ - int nuser_data; /* number of user defined data nodes */ - cgns_user_data *user_data; /* User defined data. */ -} cgns_caverage; - -typedef struct { /* GridConnectivityProperty_t */ /* V2.2 */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - cgns_cperio *cperio; /* ptrs to in-memory copy of cperio */ - cgns_caverage *caverage;/* ptrs to in-memory copy of caverage */ - int nuser_data; /* number of user defined data nodes */ - cgns_user_data *user_data; /* User defined data. */ -} cgns_cprop; - -typedef struct { /* xxx Model_t node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - ModelType_t type; - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - int narrays; /* No of DataArray_t nodes */ - cgns_array *array; /* ptrs to in-mem. copy of Data Arrays */ - DataClass_t data_class; /* Class of data */ - cgns_units *units; /* ptrs to in-memory copy of units */ - int *diffusion_model; /* only for turbulence model. */ - int dim_vals; /* dim. value for diffusion_model */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ -} cgns_model; - -typedef struct { /* GoverningEquations_t node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - GoverningEquationsType_t type; - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - int *diffusion_model; - int dim_vals; /* dim. value for diffusion_model */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ -} cgns_governing; - -typedef struct { /* FlowEquationSet_t Node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - int equation_dim; /* dimensionality of the governing equations */ - cgns_governing *governing; /* ptrs to in-mem. copy of GoverningEquations */ - cgns_model *gas; /* ptrs to in-mem. copy of GasModel */ - cgns_model *visc; /* ptrs to in-mem. copy of ViscosityM. */ - cgns_model *conduct; /* ptrs to in-mem. copy of ThermalCond. */ - cgns_model *closure; /* ptrs to in-mem. copy of Turb.Closure */ - cgns_model *turbulence; /* ptrs to in-mem. copy of TurbulenceM. */ - cgns_model *relaxation; /* ptrs to in-mem. copy of ThermalRelaxation . */ - cgns_model *chemkin; /* ptrs to in-mem. copy of ChemicalKinetics. */ - DataClass_t data_class; /* Class of data */ - cgns_units *units; /* ptrs to in-memory copy of units */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ -} cgns_equations; - -typedef struct { /* IndexArray/Range_t Node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - PointSetType_t type; /* PointList, PointRange, ... */ - char_33 data_type; /* type of data */ - int npts; /* number of points to define the patch */ - int size_of_patch; /* nr of nodes or elements in patch */ - void *data; /* data (only loaded in MODE_MODIFY */ -} cgns_ptset; /* when version mismatch) */ - -typedef struct { /* BCData_t node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - int narrays; /* no. of global data arrays */ - cgns_array *array; /* ptrs to in-mem. copy of local data */ - DataClass_t data_class; /* Class of data */ - cgns_units *units; /* Dimensional Units */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ -} cgns_bcdata; - -typedef struct { /* BCDataSet_t node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - BCType_t type; /* type of boco */ - cgns_bcdata *dirichlet; /* ptrs to in-mem. copy of DirichletData*/ - cgns_bcdata *neumann; /* ptrs to in-mem. copy of NeumannData */ - cgns_state *state; /* ptrs to in-memory copies of Ref.state*/ - DataClass_t data_class; /* Class of data */ - cgns_units *units; /* Dimensional Units */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ -} cgns_dataset; - -typedef struct { /* Elements_t node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - ElementType_t el_type; /* element type */ - int el_bound; /* nr of bound. el. if sorted, else 0 */ - int range[2]; /* index of first and last element */ - cgns_array *connect; /* ElementConnectivity */ - cgns_array *parent; /* Parent Data */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ -} cgns_section; - -typedef struct { /* BC_t node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - GridLocation_t location;/* Grid location */ - BCType_t type; /* type of boco */ - cgns_ptset *ptset; /* PointList, PointRange */ - char_33 family_name; /* Family name for the bound. patch */ - int *Nindex; /* Inward Normal Index */ - double index_id; /* ADF ID number of InwardNormalIndex */ - cgns_array *normal; /* Inward Normal List */ - int ndataset; /* no of BCDataSet nodes */ - cgns_dataset *dataset; /* ptrs to in-mem. copy of BCDataSet */ - cgns_bprop *bprop; /* ptrs to in-mem. copy of BCProperty_t */ /* V2.2 */ - cgns_state *state; /* ptrs to in-memory copies of Ref.state*/ - DataClass_t data_class; /* Class of data */ - cgns_units *units; /* Dimensional Units */ - int ordinal; /* option to define a rank */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ -} cgns_boco; - -typedef struct { /* ZoneBC_t node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - int nbocos; /* number of BC_t nodes */ - cgns_boco *boco; /* ptrs to in-memory copies of bocos */ - cgns_state *state; /* ptrs to in-memory copies of Ref.state*/ - DataClass_t data_class; /* Class of data */ - cgns_units *units; /* Dimensional Units */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ -} cgns_zboco; - -typedef struct { /* OversetHoles_t node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - GridLocation_t location;/* Grid location */ - int nptsets; /* Number of point-sets */ - cgns_ptset *ptset; /* any no of PointList and/or PointRange*/ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ -} cgns_hole; - -typedef struct { /* GridConnectivity_t node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - GridConnectivityType_t type; /*Overset, Abutting or Abutting1to1*/ - GridLocation_t location;/* Grid location */ - cgns_ptset ptset; /* PointList or PointRange */ - cgns_ptset dptset; /* PointListDonor or CellListDonor */ - int narrays; /* should be 0 or 1 */ - cgns_array *interpolants;/* InterpolantsDonor */ - char_33 donor; /* donor name */ - cgns_cprop *cprop; /* ptrs to in-memory copies of cprop */ /* V2.2 */ - int ordinal; /* option to specify a rank */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ -} cgns_conn; - -typedef struct { /* GridConnectivity1to1_t node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - int *transform; /* short form of transformation matrix */ - cgns_ptset ptset; /* PointRange */ - cgns_ptset dptset; /* PointRangeDonor */ - char_33 donor; /* donor name */ - int ordinal; /* option to specify a rank */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ -} cgns_1to1; - -typedef struct { /* ZoneGridConnectivity_t node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - int n1to1; /* number of GridConnectivity1to1 nodes */ - cgns_1to1 *one21; /* ptrs to in-memory copies of one21 */ - int nconns; /* number of GridConnectivity_t nodes */ - cgns_conn *conn; /* ptrs to in-memory copies of conns */ - int nholes; /* number of OversetHoles_t nodes */ - cgns_hole *hole; /* ptrs to in-memory copies of holes */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ -} cgns_zconn; - -typedef struct { /* FlowSolution_t node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - GridLocation_t location;/* Grid location type */ - int *rind_planes; /* No. of rind-planes on each zone face */ - int nfields; /* number of flow solution arrays */ - cgns_array *field; /* ptrs to in-memory copies of sol.field*/ - DataClass_t data_class; /* Class of data */ - cgns_units *units; /* Dimensional Units */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ -} cgns_sol; - -typedef struct { /* GridCoordinates_t node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - int *rind_planes; /* No. of rind-planes on each zone face */ - int ncoords; /* number of coordinates arrays */ - cgns_array *coord; /* ptrs to in-mem. copy of coord-arrays */ - DataClass_t data_class; /* Class of data */ - cgns_units *units; /* Dimensional Units */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ -} cgns_zcoor; - -typedef struct { /* RigidGridMotion_t node */ /* V2.0 */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - RigidGridMotionType_t type; /* type of rigid motion */ - int narrays; /* no. of data arrays */ - cgns_array *array; /* ptrs to in-mem. copy of local data */ - DataClass_t data_class; /* Class of data */ - cgns_units *units; /* Dimensional Units */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ -} cgns_rmotion; - -typedef struct { /* ArbitraryGridMotion_t node */ /* V2.0 */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - ArbitraryGridMotionType_t type;/* type of arbitrary motion */ - GridLocation_t location;/* Grid location type */ - int *rind_planes; /* No. of rind-planes on each zone face */ - int narrays; /* no. of data arrays */ - cgns_array *array; /* ptrs to in-mem. copy of misc. arrays */ - DataClass_t data_class; /* Class of data */ - cgns_units *units; /* Dimensional Units */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ -} cgns_amotion; - -typedef struct { /* ZoneIterativeData_t node */ /* V2.0 */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - int narrays; /* no. of data arrays */ - cgns_array *array; /* ptrs to in-mem. copy of misc. arrays */ - DataClass_t data_class; /* Class of data */ - cgns_units *units; /* Dimensional Units */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ -} cgns_ziter; - -typedef struct { /* BaseIterativeData_t node */ /* V2.0 */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - int nsteps; /* NumberOfSteps */ - int narrays; /* no. of data arrays */ - cgns_array *array; /* ptrs to in-mem. copy of misc. arrays */ - DataClass_t data_class; /* Class of data */ - cgns_units *units; /* Dimensional Units */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ -} cgns_biter; - -typedef struct { /* Zone_t Node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - ZoneType_t type; /* Structured or Unstructured */ - int index_dim; /* nr of indices to specify a node */ - int *nijk; /* size of zone in vertex and cells */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - int nzcoor; /* no of GridCoordinates_t nodes */ /* V2.0 */ - cgns_zcoor *zcoor; /* ptrs to in-memory copies of coords */ - int nsections; /* no of Elements_t nodes */ - cgns_section *section; /* ptrs to in-memory copies of section */ - char_33 family_name; /* family name of the unstr. zone */ - int nsols; /* number of FlowSolution_t nodes */ - cgns_sol *sol; /* ptrs to in-memory copies of sols */ - int ndiscrete; /* number of DiscreteData_t nodes */ - cgns_discrete *discrete;/* ptrs to in-memory copy of discrete */ - int nintegrals; /* number of IntegralData_t nodes */ - cgns_integral *integral;/* ptrs to in-memory copy of integral */ - cgns_zconn *zconn; /* ptrs to in-mem. copy of ZoneGridConn.*/ - cgns_zboco *zboco; /* ptrs to in-memory copies of ZoneBC */ - cgns_state *state; /* ptrs to in-memory copies of Ref.state*/ - DataClass_t data_class; /* Class of data */ - cgns_units *units; /* Dimensional Units */ - cgns_equations *equations;/* ptrs to in-mem. copy of FlowEqu. */ - cgns_converg *converg; /* ptrs to in-mem. copy of Conv.Hist. */ - int ordinal; /* option to assign a rank */ - - int nrmotions; /* number of RigidGridMotion_t nodes */ /* V2.0 */ - cgns_rmotion *rmotion; /* ptrs to in-mem. copy of RigidGridMot.*/ /* V2.0 */ - int namotions; /* number of ArbitraryGridMotion_t nodes*/ /* V2.0 */ - cgns_amotion *amotion; /* ptrs to in-mem. copy of Arb.GridMot. */ /* V2.0 */ - cgns_ziter *ziter; /* ptrs to in-mem. copies of ZoneIter. */ /* V2.0 */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ - cgns_rotating *rotating;/* ptrs to in-memory copy of Rot. Coord.*/ /* V2.2 */ -} cgns_zone; - -typedef struct { /* */ - char_33 name; /* name of Geometry part */ - double id; /* ADF ID */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ -} cgns_part; - -typedef struct { /* GeometryReference_t node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - char *file; /* name of geometry file */ - char_33 format; /* name of geometry format */ - int npart; /* number of geo. entities */ - cgns_part *part; /* list of geometry entities */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ -} cgns_geo; - -typedef struct { /* FamilyBC_t node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - BCType_t type; /* type of boco */ -} cgns_fambc; - -typedef struct { /* Family_t node */ - char_33 name; /* Family name & name of ADF node */ - double id; /* ADF ID number (address) of node */ - cgns_link *link; /* link information */ /* V2.1 */ - int in_link; /* set if child of a linked node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - int nfambc; /* number of FamilyBC_t nodes */ - cgns_fambc *fambc; /* FamilyBC */ - int ngeos; /* no of GeometryReference_t nodes */ - cgns_geo *geo; /* Geometry reference */ - int ordinal; /* option to assign a rank */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ -} cgns_family; - -typedef struct { /* CGNSBase_t Node */ - char_33 name; /* name of ADF node */ - double id; /* ADF ID number (address) of node */ - int cell_dim; /* highest cell dimension */ - int phys_dim; /* nr of coordinates to specify a node */ - int ndescr; /* no of Descriptor_t nodes */ - cgns_descr *descr; /* ptrs to in-memory copy of descr */ - int nzones; /* number of zones in base */ - cgns_zone *zone; /* ptrs to in-memory copies of zones */ - int nfamilies; /* number of families */ - cgns_family *family; /* ptrs to in-memory copies of families */ - cgns_state *state; /* ptrs to in-memory copies of Ref.state*/ - DataClass_t data_class; /* Class of data */ - cgns_units *units; /* Dimensional Units */ - cgns_equations *equations; /* ptrs to in-mem. copy of FlowEqu. */ - cgns_converg *converg; /* ptrs to in-mem. copy of Conv.Hist. */ - int nintegrals; /* no of IntegralData_t nodes */ - cgns_integral *integral;/* ptrs to in-mem. copy of integral data*/ - cgns_biter *biter; /* ptrs to in-mem. copy of BaseIter. */ /* V2.0 */ - SimulationType_t type; /* Simulation type */ /* V2.0 */ - double type_id; /* ADF ID number of SimulationType_t */ /* V2.0 */ - int nuser_data; /* number of user defined data nodes */ /* V2.1 */ - cgns_user_data *user_data; /* User defined data. */ /* V2.1 */ - cgns_gravity *gravity; /* ptrs to in-memory copy of gravity */ /* V2.2 */ - cgns_axisym *axisym; /* ptrs to in-memory copy of Axisymmetry*/ /* V2.2 */ - cgns_rotating *rotating;/* ptrs to in-memory copy of Rot. Coord.*/ /* V2.2 */ -} cgns_base; - -typedef struct { - char *filename; /* name of file */ - int version; /* version of the CGNS file * 1000 */ - double rootid; - int mode; /* reading or writing */ - int file_number; /* external identifier */ - int deleted; /* number of deleted nodes */ - int added; /* number of added nodes */ - char_33 dtb_version; /* ADF Database Version */ - char_33 creation_date; /* creation date of the file */ - char_33 modify_date; /* last modification date of the file */ - char_33 adf_lib_version;/* ADF Library Version */ - int nbases; /* number of bases in the file */ - cgns_base *base; /* ptrs to in-memory copies of bases */ -} cgns_file; - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Extern variables - */ - -extern cgns_file *cgns_files; -extern cgns_file *cg; /* current file */ -extern int n_cgns_files; -extern void *posit; -extern char_33 posit_label; -extern int posit_base, posit_zone, temp_index; -extern int CGNSLibVersion; /* CGNSLib Version number */ - -/* - * Internal Functions - */ - -void *cgi_malloc(int cnt,int size); -void *cgi_realloc(void *old,unsigned bytes); - -/* retrieve addresses of nodes who may have children */ -cgns_file *cgi_get_file (int file_number); -cgns_base *cgi_get_base (cgns_file *cg, int B); -cgns_zone *cgi_get_zone (cgns_file *cg, int B, int Z); -cgns_family *cgi_get_family (cgns_file *cg, int B, int F); -cgns_biter *cgi_get_biter (cgns_file *cg, int B); -cgns_gravity *cgi_get_gravity(cgns_file *cg, int B); -cgns_axisym *cgi_get_axisym (cgns_file *cg, int B); -cgns_ziter *cgi_get_ziter (cgns_file *cg, int B, int Z); -cgns_zcoor *cgi_get_zcoor (cgns_file *cg, int B, int Z, int C); -cgns_zcoor *cgi_get_zcoorGC(cgns_file *cg, int B, int Z); -cgns_array *cgi_get_coord (cgns_file *cg, int B, int Z, int C); -cgns_section *cgi_get_section(cgns_file *cg, int B, int Z, int S); -cgns_sol *cgi_get_sol (cgns_file *cg, int B, int Z, int S); -cgns_array *cgi_get_field (cgns_file *cg, int B, int Z, int S, int F); -cgns_zconn *cgi_get_zconn (cgns_file *cg, int B, int Z); -cgns_hole *cgi_get_hole (cgns_file *cg, int B, int Z, int I); -cgns_conn *cgi_get_conn (cgns_file *cg, int B, int Z, int I); -cgns_1to1 *cgi_get_1to1 (cgns_file *cg, int B, int Z, int I); -cgns_zboco *cgi_get_zboco (cgns_file *cg, int B, int Z); -cgns_boco *cgi_get_boco (cgns_file *cg, int B, int Z, int BC); -cgns_dataset *cgi_get_dataset(cgns_file *cg, int B, int Z, int BC, int DSet); -cgns_bcdata *cgi_get_bcdata (cgns_file *cg, int B, int Z, int BC, int Dset, - BCDataType_t type); -cgns_model *cgi_get_model (cgns_file *cg, int B, int Z, char *model); -cgns_state *cgi_get_state (cgns_file *cg, int B, int Z, int ZBC, int BC, int Dset); -cgns_converg *cgi_get_converg(cgns_file *cg, int B, int Z); -cgns_equations *cgi_get_equations(cgns_file *cg, int B, int Z); -cgns_governing *cgi_get_governing(cgns_file *cg, int B, int Z); -cgns_integral *cgi_get_integral (cgns_file *cg, int B, int Z, int N); -cgns_discrete *cgi_get_discrete (cgns_file *cg, int B, int Z, int D); -cgns_rmotion *cgi_get_rmotion (cgns_file *cg, int B, int Z, int R); -cgns_amotion *cgi_get_amotion (cgns_file *cg, int B, int Z, int R); -cgns_rotating *cgi_get_rotating (cgns_file *cg, int B, int Z); -cgns_bprop *cgi_get_bprop (cgns_file *cg, int B, int Z, int BC); -cgns_cprop *cgi_get_cprop (cgns_file *cg, int B, int Z, int I); - -/* find position lead by the goto function */ -void *cgi_get_posit(int fn, int B, int n, int *index, char **label, int *ier); -int (cgi_posit_id(double *posit_id)); - -/* retrieve memory address of multiple patch children knowing their parent label - (posit_label) and their parent memory address (posit) */ -cgns_descr *cgi_descr_address(int local_mode, int descr_no, - char const *descr_name, int *ier); -DataClass_t *cgi_dataclass_address(int local_mode, int *ier); -cgns_units *cgi_units_address(int local_mode, int *ier); -int *cgi_ordinal_address(int local_mode, int *ier); -int *cgi_rind_address(int local_mode, int *ier); -GridLocation_t *cgi_location_address(int local_mode, int *ier); -cgns_conversion *cgi_conversion_address(int local_mode, int *ier); -cgns_exponent *cgi_exponent_address(int local_mode, int *ier); -cgns_integral *cgi_integral_address(int local_mode, int integral_no, - char const *integral_name, int *ier); -cgns_equations *cgi_equations_address(int local_mode, int *ier); -cgns_state *cgi_state_address(int local_mode, int *ier); -cgns_converg *cgi_converg_address(int local_mode, int *ier); -cgns_governing *cgi_governing_address(int local_mode, int *ier); -int *cgi_diffusion_address(int local_mode, int *ier); -cgns_array *cgi_array_address(int local_mode, int array_no, char const *array_name, int *ier); -cgns_model *cgi_model_address(int local_mode, char const *ModelLabel, int *ier); -char *cgi_famname_address(int local_mode, int *ier); -cgns_user_data *cgi_user_data_address(int local_mode, int given_no, char const *given_name, int *ier); -cgns_rotating *cgi_rotating_address(int local_mode, int *ier); - -/* read CGNS file into internal database */ -int cgi_read(cgns_file *cg); -int cgi_read_base(cgns_base *base); -int cgi_read_zone(cgns_zone *zone); -int cgi_read_zonetype(double parent_id, char_33 parent_name, ZoneType_t *type); -int cgi_read_family(cgns_family *family); -int cgi_read_family_name(int in_link, double parent_id, char_33 parent_name, - char_33 family_name); -int cgi_read_array(cgns_array *array, char *parent_label, double parent_id); -int cgi_read_section(int in_link, double parent_id, int *nsections, - cgns_section **section); -int cgi_read_hole(cgns_hole *hole); -int cgi_read_conn(cgns_conn *conn); -int cgi_read_1to1(cgns_1to1 *one21); -int cgi_read_ptset(double parent_id, cgns_ptset *ptset); -int cgi_read_string(double id, char_33 name, char **string_data); -int cgi_read_boco(cgns_boco *boco); -int cgi_read_location(double parent_id, char_33 parent_name, GridLocation_t *location); -int cgi_read_state(int in_link, double parent_id, cgns_state **state); -int cgi_read_converg(int in_link, double parent_id, cgns_converg **converg); -int cgi_read_units(int in_link, double parent_id, cgns_units **units); -int cgi_read_equations(int in_link, double parent_id, - cgns_equations **equations); -int cgi_read_model(int in_link, double parent_id, char *label, - cgns_model **model); -int cgi_read_conversion(int in_link, double parent_id, - cgns_conversion **convert); -int cgi_read_exponents(int in_link, double parent_id, - cgns_exponent **exponents); -int cgi_read_integral(int in_link, double parent_id, int *nintegrals, - cgns_integral **integral); -int cgi_read_discrete(int in_link, double parent_id, int *ndiscrete, - cgns_discrete **discrete); -int cgi_read_sol(int in_link, double parent_id, int *nsols, cgns_sol **sol); -int cgi_read_zcoor(int in_link, double parent_id, int *nzcoor, - cgns_zcoor **zcoor); -int cgi_read_zconn(int in_link, double parent_id, cgns_zconn **zconn); -int cgi_read_zboco(int in_link, double parent_id, cgns_zboco **zboco); -int cgi_read_dataset(int in_link, double parent_id, int *ndataset, - cgns_dataset **dataset); -int cgi_read_bcdata(cgns_bcdata *bcdata); -int cgi_read_rind(double parent_id, int **rind_planes); -int cgi_read_ordinal(double parent_id, int *ordinal); -int cgi_read_DDD(int in_link, double parent_id, int *ndescr, cgns_descr **descr, - DataClass_t *data_class, cgns_units **units); -int cgi_read_rmotion(int in_link, double parent_id, int *nrmotions, - cgns_rmotion **rmotion); -int cgi_read_amotion(int in_link, double parent_id, int *namotions, - cgns_amotion **amotion); -int cgi_read_simulation(double parent_id, SimulationType_t *type, double *type_id); -int cgi_read_biter(int in_link, double parent_id, cgns_biter **biter); -int cgi_read_ziter(int in_link, double parent_id, cgns_ziter **ziter); -int cgi_read_gravity(int in_link, double parent_id, cgns_gravity **gravity); -int cgi_read_axisym(int in_link, double parent_id, cgns_axisym **axisym); -int cgi_read_rotating(int in_link, double parent_id, cgns_rotating **rotating); -int cgi_read_bprop(int in_link, double parent_id, cgns_bprop **bprop); -int cgi_read_cprop(int in_link, double parent_id, cgns_cprop **cprop); -int cgi_read_user_data(int in_link, double parent_id, int *nuser_data, - cgns_user_data **user_data); -cgns_link *cgi_read_link(double node_id); - -int cgi_datasize(int Idim, int *CurrentDim, GridLocation_t location, - int *rind_planes, int *DataSize); - -int cgi_read_node(double node_id, char_33 name, char_33 data_type, - int *ndim, int *dim_vals, void **data, int data_flag); -int cgi_get_nodes(double parent_id, char *label, int *nnodes, double **id); - -/* write ADF file from internal database */ -int cgi_write(int file_number); -int cgi_write_zone(double parent_id, cgns_zone *zone); -int cgi_write_family(double parent_id, cgns_family *family); -int cgi_write_zcoor(double parent_id, cgns_zcoor *zcoor); -int cgi_write_section(double parent_id, cgns_section *section); -int cgi_write_sol(double parent_id, cgns_sol *sol); -int cgi_write_zconn(double parent_id, cgns_zconn *zconn); -int cgi_write_1to1(double parent_id, cgns_1to1 *one21); -int cgi_write_conns(double parent_id, cgns_conn *conn); -int cgi_write_holes(double parent_id, cgns_hole *hole); -int cgi_write_zboco(double parent_id, cgns_zboco *zboco); -int cgi_write_boco(double parent_id, cgns_boco *boco); -int cgi_write_dataset(double parent_id, cgns_dataset *dataset); -int cgi_write_bcdata(double bcdata_id, cgns_bcdata *bcdata); -int cgi_write_ptset(double id, char_33 name, cgns_ptset *ptset, - int Ndim, void *ptset_ptr); -int cgi_write_equations(double parent_id, cgns_equations *equations); -int cgi_write_model(double parent_id, cgns_model *model); -int cgi_write_state(double parent_id, cgns_state *state); -int cgi_write_converg(double parent_id, cgns_converg *converg); -int cgi_write_discrete(double parent_id, cgns_discrete *discrete); -int cgi_write_integral(double parent_id, cgns_integral *integral); -int cgi_write_array(double parent_id, cgns_array *array); -int cgi_write_rind(double parent_id, int *rind_planes, int idim); -int cgi_write_units(double parent_id, cgns_units *units); -int cgi_write_dataclass(double parent_id, DataClass_t data_class); -int cgi_write_descr(double parent_id, cgns_descr *descr); -int cgi_write_ordinal(double parent_id, int ordinal); -int cgi_write_rmotion(double parent_id, cgns_rmotion *rmotion); -int cgi_write_amotion(double parent_id, cgns_amotion *amotion); -int cgi_write_biter(double parent_id, cgns_biter *biter); -int cgi_write_ziter(double parent_id, cgns_ziter *ziter); -int cgi_write_gravity(double parent_id, cgns_gravity *gravity); -int cgi_write_axisym(double parent_id, cgns_axisym *axisym); -int cgi_write_rotating(double parent_id, cgns_rotating *rotating); -int cgi_write_bprop(double parent_id, cgns_bprop *bprop); -int cgi_write_cprop(double parent_id, cgns_cprop *cprop); -int cgi_write_user_data(double parent_id, cgns_user_data *user_data); -int cgi_write_link(double parent_id, char *name, cgns_link *link, - double *node_id); - -int cgi_new_node(double parent_id, char const *name, char const *label, - double *node_id, char const *data_type, - int ndim, int const *dim_vals, void const *data); -int cgi_move_node(double old_id, double node_id, double new_id, cchar_33 node_name); -int cgi_delete_node (double parent_id, double node_id); - -/* error handling */ -void cgi_error(char *format, ...); -void cgi_warning(char *format, ...); -void adf_error(char *routine_name, int ier); - -/* retrieve list number from list name */ -int cgi_GridLocation(char *GridLocationName, GridLocation_t *type); -int cgi_GridConnectivityType(char *GridConnectivityName, - GridConnectivityType_t *type); -int cgi_PointSetType(char *PointSetName, PointSetType_t *type); -int cgi_BCType(char *BCName, BCType_t *type); -int cgi_DataClass(char *Name, DataClass_t *data_class); -int cgi_MassUnits(char *Name, MassUnits_t *mass_unit); -int cgi_LengthUnits(char *Name, LengthUnits_t *length_unit); -int cgi_TimeUnits(char *Name, TimeUnits_t *time_unit); -int cgi_TemperatureUnits(char *Name, TemperatureUnits_t *temperature_unit); -int cgi_AngleUnits(char *Name, AngleUnits_t *angle_unit); -int cgi_GoverningEquationsType(char *Name, GoverningEquationsType_t *type); -int cgi_ModelType(char *Name, ModelType_t *type); -int cgi_ZoneType(char *Name, ZoneType_t *type); -int cgi_RigidGridMotionType(char *Name, RigidGridMotionType_t *type); -int cgi_ArbitraryGridMotionType(char *Name, ArbitraryGridMotionType_t *type); -int cgi_SimulationType(char *Name, SimulationType_t *type); -int cgi_WallFunctionType(char *Name, WallFunctionType_t *type); -int cgi_AreaType(char *Name, AreaType_t *type); -int cgi_AverageInterfaceType(char *Name, AverageInterfaceType_t *type); - -int cgi_zone_no(cgns_base *base, char *zonename, int *zone_no); - -/* miscelleneous */ -int cgi_sort_names(int n, double *ids); -int size_of(char_33 adf_type); -char *type_of(char_33 data_type); -int cgi_check_strlen(char const * string); -int cgi_check_mode(char const * filename, int file_mode, int mode_wanted); -char *cgi_adf_datatype(DataType_t type); -DataType_t cgi_datatype(cchar_33 adf_type); -void adf_cond(double InputRootID, double OutputRootID); - -int cgi_add_czone(char_33 zonename, int_6 range, int_6 donor_range, int idim, int *ndouble, - char_33 **Dzonename, int_6 **Drange, int_6 **Ddonor_range); - -void cgi_array_print(char *routine, cgns_array *array); - -/* free memory */ -void cgi_free_file(cgns_file *cg); -void cgi_free_base(cgns_base *base); -void cgi_free_zone(cgns_zone *zone); -void cgi_free_family(cgns_family *family); -void cgi_free_fambc(cgns_fambc *fambc); -void cgi_free_geo(cgns_geo *geo); -void cgi_free_part(cgns_part *part); -void cgi_free_zcoor(cgns_zcoor *zcoor); -void cgi_free_section(cgns_section *section); -void cgi_free_zboco(cgns_zboco *zboco); -void cgi_free_zconn(cgns_zconn *zconn); -void cgi_free_sol(cgns_sol *sol); -void cgi_free_1to1(cgns_1to1 *one21); -void cgi_free_hole(cgns_hole *hole); -void cgi_free_conn(cgns_conn *conn); -void cgi_free_boco(cgns_boco *boco); -void cgi_free_dataset(cgns_dataset *dataset); -void cgi_free_bcdata(cgns_bcdata *bcdata); -void cgi_free_ptset(cgns_ptset *ptset); -void cgi_free_equations(cgns_equations *equations); -void cgi_free_governing(cgns_governing *governing); -void cgi_free_model(cgns_model *model); -void cgi_free_state(cgns_state *state); -void cgi_free_converg(cgns_converg *converg); -void cgi_free_discrete(cgns_discrete *discrete); -void cgi_free_integral(cgns_integral *integral); -void cgi_free_array(cgns_array *array); -void cgi_free_convert(cgns_conversion *convert); -void cgi_free_exponents(cgns_exponent *exponents); -void cgi_free_units(cgns_units *units); -void cgi_free_descr(cgns_descr *descr); -void cgi_free_rmotion(cgns_rmotion *rmotion); -void cgi_free_amotion(cgns_amotion *amotion); -void cgi_free_biter(cgns_biter *biter); -void cgi_free_ziter(cgns_ziter *ziter); -void cgi_free_gravity(cgns_gravity *gravity); -void cgi_free_axisym(cgns_axisym *axisym); -void cgi_free_rotating(cgns_rotating *rotating); -void cgi_free_bprop(cgns_bprop *bprop); -void cgi_free_bcwall(cgns_bcwall *bcwall); -void cgi_free_bcarea(cgns_bcarea *bcarea); -void cgi_free_cprop(cgns_cprop *cprop); -void cgi_free_cperio(cgns_cperio *cperio); -void cgi_free_caverage(cgns_caverage *caverage); -void cgi_free_link(cgns_link *link); -void cgi_free_user_data(cgns_user_data *user_data); - - -#ifdef __cplusplus -} -#endif diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/cgns_internals.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/cgns_internals.c deleted file mode 100644 index 5234439790..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/cgns_internals.c +++ /dev/null @@ -1,10439 +0,0 @@ -#ifndef MAKEDEPEND -#include -#include -#include -#include -#include -#if !defined(_WIN32) || (defined(_WIN32) && defined(__NUTC__)) -#include -#endif -#endif - -#include "cgnslib.h" -#include "cgns_header.h" -#include "libadf/ADF.h" - -#define CGNS_NAN(x) (!((x) < HUGE_VAL && (x) > -HUGE_VAL)) -/*********************************************************************** - * global variable definitions - ***********************************************************************/ -int Idim; /* current IndexDimension */ -int Cdim; /* current CellDimension */ -int Pdim; /* current PhysicalDimension */ -int CurrentDim[9]; /* current vertex, cell & bnd zone size*/ -ZoneType_t CurrentZoneType; /* current zone type */ -int NumberOfSteps; /* Number of steps */ - -/***********************************************************************\ - * The following function is provided to maintain backward with older - * versions of the ADF library. NULL_NODEID_POINTER is defined as - * one of the error codes with the new version. -\***********************************************************************/ - -#ifndef NULL_NODEID_POINTER - -void ADF_Children_IDs (double parent_id, int start, int numids, - int *count, double *IDs, int *ierr) -{ - int n, len; - char name[ADF_NAME_LENGTH+1]; - double node_id; - - *count = 0; - for (n = start; n < start+numids; n++) { - ADF_Children_Names (parent_id, n, 1, ADF_NAME_LENGTH+1, - &len, name, ierr); - if (*ierr > 0) return; - ADF_Get_Node_ID (parent_id, name, &node_id, ierr); - if (*ierr > 0) return; - IDs[*count] = node_id; - (*count)++; - } -} - -#endif - -/***********************************************************************\ - * Internal functions * -\***********************************************************************/ - -void *cgi_malloc(int cnt, int size) { - void *buf = calloc(cnt, size); - if (buf == NULL) { - cgi_error("calloc failed for %d values of size %d", cnt, size); - exit (1); - } - return buf; -} - -void *cgi_realloc(void *oldbuf, unsigned bytes) { - void *buf = realloc(oldbuf, bytes); - if (buf == NULL) { - cgi_error("realloc failed for %d bytes", bytes); - exit (1); - } - return buf; -} - -/***********************************************************************\ - * Read CGNS file and store in internal data structures * -\***********************************************************************/ - -int cgi_read(cgns_file *cg) { - int b; - double *id; - - /* get number of CGNSBase_t nodes and their ADF_ID */ - if (cgi_get_nodes(cg->rootid, "CGNSBase_t", &cg->nbases, &id)) return 1; - if (cg->nbases==0) return 0; - cg->base = CGNS_NEW(cgns_base,cg->nbases); - for (b=0; bnbases; b++) cg->base[b].id = id[b]; - free(id); - - /* read and save CGNSBase_t data */ - for (b=0; bnbases; b++) if (cgi_read_base(&cg->base[b])) return 1; - - return 0; -} - -int cgi_read_base(cgns_base *base) { - char_33 data_type; - int ndim, dim_vals[12]; - int *index; - double *id; - int n; - - /* Read CGNSBase_t Node */ - if (cgi_read_node(base->id, base->name, data_type, &ndim, dim_vals, - (void **) &index, READ_DATA)) { - cgi_error("Error reading base"); - return 1; - } - - /* check data type */ - if (strcmp(data_type,"I4")!=0) { - cgi_error("Unexpected data type for dimension data of base %s='%s'", - base->name, data_type); - return 1; - } - if ((cg->version==1050 && (ndim != 1 || dim_vals[0]!=1)) || - (cg->version >= 1100 && (ndim != 1 || dim_vals[0]!=2))) { - cgi_error("Wrong definition of Base Dimensions."); - return 1; - } - if (cg->version == 1050) { /* old multiblock format */ - base->cell_dim = base->phys_dim = index[0]; - } else { - base->cell_dim = index[0]; - base->phys_dim = index[1]; - } - free(index); - - if (base->cell_dim<1 || base->cell_dim>3) { - cgi_error("Invalid value for base cell dimension (=%d)", - base->cell_dim); - return 1; - } - if (base->phys_dim<1 || base->phys_dim>3) { - cgi_error("Invalid value for base physical dimension(=%d)", - base->phys_dim); - return 1; - } - - /* set Global variable */ - Cdim = base->cell_dim; - Pdim = base->phys_dim; - - /* update version */ - if (cg->mode == MODE_MODIFY && cg->version < 1100) { - int ierr; - dim_vals[0] = 2; - ADF_Put_Dimension_Information(base->id, "I4", 1, dim_vals, &ierr); - if (ierr > 0) { - adf_error("ADF_Put_Dimension_Information", ierr); - return 1; - } - dim_vals[0] = base->cell_dim; - dim_vals[1] = base->phys_dim; - ADF_Write_All_Data(base->id, (const char *)dim_vals, &ierr); - if (ierr > 0) { - adf_error("ADF_Write_All_Data", ierr); - return 1; - } - } - - /* Family_t */ - if (cgi_get_nodes(base->id, "Family_t", &base->nfamilies, &id)) return 1; - if (base->nfamilies>0) { - /* read & save families */ - base->family = CGNS_NEW(cgns_family, base->nfamilies); - for (n=0; nnfamilies; n++) { - base->family[n].id = id[n]; - base->family[n].link = cgi_read_link(id[n]); - base->family[n].in_link = 0; - if (cgi_read_family(&base->family[n])) return 1; - } - free(id); - } - - /* ReferenceState_t */ - if (cgi_read_state(0, base->id, &base->state)) return 1; - - /* Gravity_t */ - if (cgi_read_gravity(0, base->id, &base->gravity)) return 1; - - /* Axisymmetry_t */ - if (cgi_read_axisym(0, base->id, &base->axisym)) return 1; - - /* RotatingCoordinates_t */ - if (cgi_read_rotating(0, base->id, &base->rotating)) return 1; - - /* ConvergenceHistory_t */ - if (cgi_read_converg(0, base->id, &base->converg)) return 1; - - /* Descriptor_t, DataClass_t, DimensionalUnits_t */ - if (cgi_read_DDD(0, base->id, &base->ndescr, &base->descr, - &base->data_class, &base->units)) return 1; - - /* FlowEquationSet_t */ - if (cgi_read_equations(0, base->id, &base->equations)) return 1; - - /* IntegralData_t */ - if (cgi_read_integral(0, base->id, &base->nintegrals, - &base->integral)) return 1; - - /* SimulationType_t */ - if (cgi_read_simulation(base->id, &base->type, &base->type_id)) return 1; - - /* BaseIterativeData_t */ - if (cgi_read_biter(0, base->id, &base->biter)) return 1; - - /* UserDefinedData_t */ - if (cgi_read_user_data(0, base->id, &base->nuser_data, - &base->user_data)) return 1; - - /* Zone_t (depends on NumberOfSteps) */ - if (cgi_get_nodes(base->id, "Zone_t", &base->nzones, &id)) return 1; - if (base->nzones>0) { - /* Order zones alpha-numerically */ - if (cgi_sort_names(base->nzones, id)) { - cgi_error("Error sorting zone names..."); - return 1; - } - /* read & save zones in sorted order */ - base->zone = CGNS_NEW(cgns_zone, base->nzones); - for (n=0; nnzones; n++) { - base->zone[n].id = id[n]; - base->zone[n].link = cgi_read_link(id[n]); - base->zone[n].in_link = 0; - if (cgi_read_zone(&base->zone[n])) return 1; - } - free(id); - } - return 0; -} - -int cgi_read_zone(cgns_zone *zone) { - int n, ndim, dim_vals[12]; - int in_link = zone->link ? 1 : zone->in_link; - char_33 data_type; - int *mesh_dim; - - /* Zone_t */ - if (cgi_read_node(zone->id, zone->name, data_type, &ndim, dim_vals, - (void **)&mesh_dim, READ_DATA)) { - cgi_error("Error reading node Zone_t"); - return 1; - } - - /* verify data read */ - if (strcmp(data_type,"I4")!=0) { - cgi_error("Unsupported data type for Zone_t node %s= %s", - zone->name, data_type); - return 1; - } - if (ndim!=2) { - cgi_error("Wrong number of dimension for a Zone_t node"); - return 1; - } - /* ZoneType_t */ - if (cgi_read_zonetype(zone->id, zone->name, &zone->type)) return 1; - - /* Set IndexDimension of zone */ - if (zone->type==Structured) zone->index_dim=Cdim; - else zone->index_dim=1; - - /* save Global Variable Idim */ - Idim = zone->index_dim; - - if (dim_vals[0]!=zone->index_dim || ((cg->version==1050 && dim_vals[1]!=2) - || (cg->version>=1100 && dim_vals[1]!=3))) { - cgi_error("Wrong number of dimension values for Zone_t %s",zone->name); - return 1; - } - - /* allocate memory to record zone size */ - zone->nijk=CGNS_NEW(int, zone->index_dim*3); - - for (n=0; nindex_dim; n++) { - zone->nijk[n] = mesh_dim[n]; - zone->nijk[n+Idim] = mesh_dim[n+Idim]; - if (cg->version==1050) zone->nijk[n+2*Idim] = 0; - else zone->nijk[n+2*Idim] = mesh_dim[n+2*Idim]; - } - free(mesh_dim); - - /* save Global Variables */ - for (n=0; nnijk[n]; - CurrentZoneType = zone->type; - - /* verify data */ - if (zone->type==Structured) { - for (n=0; nindex_dim; n++) { - if (zone->nijk[n] <=0 || zone->nijk[n]!=zone->nijk[n+Idim]+1) { - cgi_error("Invalid structured zone dimensions"); - return 1; - } - } - } else { - if (zone->nijk[0]<0 || zone->nijk[1]<0 || - zone->nijk[2]>zone->nijk[0]) { - cgi_error("Invalid unstructured zone dimensions"); - return 1; - } - } - - /* update version */ - if (cg->mode == MODE_MODIFY && cg->version < 1100 && !in_link) { - int ierr; - dim_vals[0] = zone->index_dim; - dim_vals[1] = 3; - ADF_Put_Dimension_Information(zone->id, "I4", 2, dim_vals, &ierr); - if (ierr > 0) { - adf_error("ADF_Put_Dimension_Information", ierr); - return 1; - } - ADF_Write_All_Data(zone->id, (const char *)zone->nijk, &ierr); - if (ierr > 0) { - adf_error("ADF_Write_All_Data", ierr); - return 1; - } - } - - /* GridCoordinates_t */ - if (cgi_read_zcoor(in_link, zone->id, &zone->nzcoor, &zone->zcoor)) - return 1; - - /* Elements_t: Only for Unstructured zones */ - if (cgi_read_section(in_link, zone->id, &zone->nsections, &zone->section)) - return 1; - if (zone->type==Structured && zone->nsections!=0) { - cgi_error("Elements_t nodes is valid only for unstructured zones"); - return 1; - } - - /* FamilyName_t */ - if (cgi_read_family_name(in_link, zone->id, zone->name, zone->family_name)) - return 1; - - /* FlowSolution_t */ - if (cgi_read_sol(in_link, zone->id, &zone->nsols, &zone->sol)) - return 1; - - /* ZoneGridConnectivity_t */ - if (cgi_read_zconn(in_link, zone->id, &zone->zconn)) return 1; - - /* ZoneBC_t */ - if (cgi_read_zboco(in_link, zone->id, &zone->zboco)) return 1; - - /* Descriptor_t, DataClass_t, DimensionalUnits_t */ - if (cgi_read_DDD(in_link, zone->id, &zone->ndescr, &zone->descr, - &zone->data_class, &zone->units)) return 1; - - /* DiscreteData_t */ - if (cgi_read_discrete(in_link, zone->id, &zone->ndiscrete, - &zone->discrete)) return 1; - - /* IntegralData_t */ - if (cgi_read_integral(in_link, zone->id, &zone->nintegrals, - &zone->integral)) return 1; - - /* ReferenceState_t */ - if (cgi_read_state(in_link, zone->id, &zone->state)) return 1; - - /* ConvergenceHistory_t */ - if (cgi_read_converg(in_link, zone->id, &zone->converg)) return 1; - - /* FlowEquationSet_t */ - if (cgi_read_equations(in_link, zone->id, &zone->equations)) return 1; - - /* Ordinal_t */ - if (cgi_read_ordinal(zone->id, &zone->ordinal)) return 1; - - /* RigidGridMotion_t */ - if (cgi_read_rmotion(in_link, zone->id, &zone->nrmotions, - &zone->rmotion)) return 1; - - /* ArbitraryGridMotion_t */ - if (cgi_read_amotion(in_link, zone->id, &zone->namotions, - &zone->amotion)) return 1; - - /* ZoneIterativeData_t can only exist if BaseIterativeData_t exist because - it depends on it */ - if (NumberOfSteps) { - if (cgi_read_ziter(in_link, zone->id, &zone->ziter)) return 1; - } else zone->ziter = 0; - - /* UserDefinedData_t */ - if (cgi_read_user_data(in_link, zone->id, &zone->nuser_data, - &zone->user_data)) return 1; - - /* RotatingCoordinates_t */ - if (cgi_read_rotating(in_link, zone->id, &zone->rotating)) return 1; - - return 0; -} - -int cgi_read_family(cgns_family *family) { - int ierr, n; - int linked, in_link = family->link ? 1 : family->in_link; - double *id; - char *boconame; - - /* Family name */ - ADF_Get_Name(family->id, family->name, &ierr); - if (ierr>0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - - /* FamilyBC_t */ - if (cgi_get_nodes(family->id, "FamilyBC_t", &family->nfambc, &id)) - return 1; - if (family->nfambc>0) { - family->fambc = CGNS_NEW(cgns_fambc, family->nfambc); - for (n=0; nnfambc; n++) { - family->fambc[n].id = id[n]; - family->fambc[n].link = cgi_read_link(id[n]); - family->fambc[n].in_link = in_link; - if (cgi_read_string(id[n], family->fambc[n].name, &boconame)) - return 1; - /* get BCType */ - if (cgi_BCType(boconame, &family->fambc[n].type)) return 1; - free(boconame); - } - free(id); - } - - /* GeometryReference_t */ - if (cgi_get_nodes(family->id, "GeometryReference_t", &family->ngeos, &id)) - return 1; - if (family->ngeos>0) { - family->geo = CGNS_NEW(cgns_geo, family->ngeos); - for (n=0; nngeos; n++) { - family->geo[n].id = id[n]; - family->geo[n].link = cgi_read_link(id[n]); - family->geo[n].in_link = in_link; - - /* GeometryReference Name */ - ADF_Get_Name(family->geo[n].id, family->geo[n].name, &ierr); - if (ierr>0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - - /* UserDefinedData_t */ - linked = family->geo[n].link ? 1 : in_link; - if (cgi_read_user_data(linked, family->geo[n].id, - &family->geo[n].nuser_data, &family->geo[n].user_data)) - return 1; - } - free(id); - } - - /* GeometryReference_t Children */ - - for (n=0; nngeos; n++) { - int i, flag; - char_33 dummy_name; - cgns_geo *geo = &family->geo[n]; - - /* Descriptor_t */ - if (cgi_get_nodes(geo->id, "Descriptor_t", &geo->ndescr, &id)) - return 1; - if (geo->ndescr>0) { - geo->descr = CGNS_NEW(cgns_descr, geo->ndescr); - for (i=0; indescr; i++) { - geo->descr[i].id = id[i]; - geo->descr[i].link = cgi_read_link(id[i]); - geo->descr[i].in_link = in_link; - if (cgi_read_string(id[i], geo->descr[i].name, - &geo->descr[i].text)) return 1; - } - free(id); - } - - /* GeometryFile_t */ - if (cgi_get_nodes(geo->id, "GeometryFile_t", &flag, &id)) return 1; - if (flag==1) { - if (cgi_read_string(id[0], dummy_name, &geo->file)) return 1; - } else { - cgi_error("Incorrect definition of GeometryFile_t"); - return 1; - } - if (flag) free(id); - - /* GeometryFormat_t */ - if (cgi_get_nodes(geo->id, "GeometryFormat_t", &flag, &id)) return 1; - if (flag==1) { - char *geoformat; - if (cgi_read_string(id[0], dummy_name, &geoformat)) return 1; - if (strlen(geoformat)>32) { - cgi_error("Geometry File Format is limited to 32 characters"); - return 1; - } else strcpy(geo->format, geoformat); - free(geoformat); - } else { - cgi_error("Incorrect definition of GeometryFormat_t"); - return 1; - } - if (flag) free(id); - - /* GeometryEntity_t */ - if (cgi_get_nodes(geo->id, "GeometryEntity_t", &geo->npart, &id)) - return 1; - if (geo->npart>0) { - geo->part = CGNS_NEW(cgns_part, geo->npart); - for (i=0; inpart; i++) { - geo->part[i].id = id[i]; - geo->part[i].link = cgi_read_link(id[i]); - geo->part[i].in_link = in_link; - ADF_Get_Name(id[i], geo->part[i].name, &ierr); - if (ierr>0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - } - free(id); - } - } /* loop through ngeos */ - - /* Descriptor_t under Family_t */ - if (cgi_get_nodes(family->id, "Descriptor_t", &family->ndescr, &id)) - return 1; - if (family->ndescr>0) { - family->descr = CGNS_NEW(cgns_descr, family->ndescr); - for (n=0; nndescr; n++) { - family->descr[n].id = id[n]; - family->descr[n].link = cgi_read_link(id[n]); - family->descr[n].in_link = in_link; - if (cgi_read_string(id[n], family->descr[n].name, - &family->descr[n].text)) return 1; - } - free(id); - } - - /* Ordinal_t */ - if (cgi_read_ordinal(family->id, &family->ordinal)) return 1; - - /* UserDefinedData_t */ - if (cgi_read_user_data(in_link, family->id, &family->nuser_data, - &family->user_data)) return 1; - - return 0; -} - -int cgi_read_family_name(int in_link, double parent_id, char_33 parent_name, - char_33 family_name) { - int fam_flag, ierr; - double *id; - char_33 NodeName; - char *FamilyName=0; /* allocated in cgi_read_node */ - - family_name[0]='\0'; - if (cgi_get_nodes(parent_id, "FamilyName_t", &fam_flag, &id)) return 1; - if (fam_flag==1) { - - if (cg->version>1200) { - - /* FamilyName in data field of the ADF node */ - if (cgi_read_string(id[0], NodeName, &FamilyName)) return 1; - if (strlen(FamilyName) > 32) FamilyName[32]='\0'; - strcpy(family_name, FamilyName); - if (FamilyName) free(FamilyName); - - } else { - /* FamilyName is the ADF node name */ - ADF_Get_Name(id[0], family_name, &ierr); - if (ierr>0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - /* update version */ - if (cg->mode == MODE_MODIFY && !in_link) { - double dummy_id; - int len = strlen(family_name); - if (cgi_delete_node(parent_id, id[0])) return 1; - if (cgi_new_node(parent_id, "FamilyName", "FamilyName_t", - &dummy_id, "C1", 1, &len, (void *)family_name)) - return 1; - } - } - free(id); - - } else if (fam_flag<0 || fam_flag>1) { - cgi_error("Family name defined incorrectly under '%s',",parent_name); - return 1; - } - return 0; -} - -int cgi_read_zcoor(int in_link, double parent_id, int *nzcoor, cgns_zcoor **zcoor) { - double *idg, *id; - int g, z, n, ierr, linked; - int DataSize[3]; - - if (cgi_get_nodes(parent_id, "GridCoordinates_t", nzcoor, &idg)) return 1; - if ((*nzcoor)<=0) return 0; - - zcoor[0] = CGNS_NEW(cgns_zcoor, (*nzcoor)); - - for (g=0; g<(*nzcoor); g++) { - zcoor[0][g].id = idg[g]; - zcoor[0][g].link = cgi_read_link(idg[g]); - zcoor[0][g].in_link = in_link; - linked = zcoor[0][g].link ? 1 : in_link; - - /* Name */ - ADF_Get_Name(zcoor[0][g].id, zcoor[0][g].name, &ierr); - if (ierr>0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - - /* Rind Planes */ - if (cgi_read_rind(zcoor[0][g].id, &zcoor[0][g].rind_planes)) return 1; - - /* Assume that the coordinates are always at the node */ - if (cgi_datasize(Idim, CurrentDim, Vertex, zcoor[0][g].rind_planes, - DataSize)) return 1; - - /* DataArray_t */ - if (cgi_get_nodes(zcoor[0][g].id, "DataArray_t", &zcoor[0][g].ncoords, - &id)) return 1; - if (zcoor[0][g].ncoords > 0) { - zcoor[0][g].coord = CGNS_NEW(cgns_array, zcoor[0][g].ncoords); - for (z=0; z0) { - section[0][n].descr = CGNS_NEW(cgns_descr, section[0][n].ndescr); - for (i=0; i0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - - /* ElementConnectivity */ - if (strcmp(temp_name,"ElementConnectivity")==0) { - if (section[0][n].connect) { - cgi_error("Error: ElementConnectivity defined more than once"); - return 1; - } - section[0][n].connect = CGNS_NEW(cgns_array, 1); - section[0][n].connect->id = idi[i]; - section[0][n].connect->link = cgi_read_link(idi[i]); - section[0][n].connect->in_link = linked; - if (cgi_read_array(section[0][n].connect, "Elements_t", - section[0][n].id)) return 1; - - /* check data */ - if (strcmp(section[0][n].connect->data_type,"I4")) { - cgi_error("Datatype %d not supported for element connectivity"); - return 1; - } - if (cg_npe(section[0][n].el_type, &npe)) return 1; - if (cg->version <= 1100) { - if (section[0][n].connect->dim_vals[0] != npe || - section[0][n].connect->dim_vals[1] != nelements || - section[0][n].connect->data_dim != 2 ) { - cgi_error("Error exit: Element connectivity incorrectly defined"); - return 1; - } - /* Rewrite with new data array parameters starting with version 1200 */ - section[0][n].connect->data_dim = 1; - section[0][n].connect->dim_vals[0] = npe*nelements; - section[0][n].connect->dim_vals[1] = 0; - if (cg->mode == MODE_MODIFY && !linked) { - ADF_Put_Dimension_Information(section[0][n].connect->id, - "I4", 1, section[0][n].connect->dim_vals, &ierr); - if (ierr > 0) { - adf_error("ADF_Put_Dimension_Information", ierr); - return 1; - } - ADF_Write_All_Data(section[0][n].connect->id, - (const char *) section[0][n].connect->data, &ierr); - if (ierr > 0) { - adf_error("ADF_Write_All_Data", ierr); - return 1; - } - } - - } else { /* starting with version 1200 */ - int ElementDataSize=0; - - if (section[0][n].el_type!=MIXED) - ElementDataSize = npe*nelements; - else { - int el; - ElementType_t el_type; - for (el=0; eldata+ElementDataSize); - if (cg_npe(el_type, &npe)) return 1; - ElementDataSize += (npe+1); - } - } - if (section[0][n].connect->dim_vals[0] != ElementDataSize || - section[0][n].connect->data_dim != 1) { - cgi_error("Error exit: Element connectivity incorrectly defined"); - return 1; - } - } - - } else if (strcmp(temp_name,"ParentData")==0) { - if (section[0][n].parent) { - cgi_error("Error: Element ParentData defined more than once"); - return 1; - } - section[0][n].parent = CGNS_NEW(cgns_array, 1); - section[0][n].parent->id = idi[i]; - section[0][n].parent->link = cgi_read_link(idi[i]); - section[0][n].parent->in_link = linked; - if (cgi_read_array(section[0][n].parent, "Elements_t", - section[0][n].id)) return 1; - - /* check data */ - if (strcmp(section[0][n].parent->data_type,"I4")) { - cgi_error("Datatype %d not supported for element 'parent_data'"); - return 1; - } - if (section[0][n].parent->dim_vals[0] != nelements || - section[0][n].parent->dim_vals[1] != 4 || - section[0][n].parent->data_dim != 2 ) { - cgi_error("Error exit: Element 'parent_data' incorrectly defined"); - return 1; - } - } - } /* loop through DataArray_t */ -/* check - cgi_array_print("connect",section[0][n].connect); - if (section[0][n].parent) cgi_array_print("parent",section[0][n].parent); -*/ - if (nchild) free(idi); - if (section[0][n].connect == 0) { - cgi_error("Error exit: ElementConnectivity undefined in Element_t node '%s'.", - section[0][n].name); - return 1; - } - - /* UserDefinedData_t */ - if (cgi_read_user_data(linked, section[0][n].id, - §ion[0][n].nuser_data, §ion[0][n].user_data)) return 1; - - } /* loop through element sections */ - free(id); - - return 0; -} - -int cgi_read_sol(int in_link, double parent_id, int *nsols, cgns_sol **sol) { - double *id, *idf; - int s, z, n, ierr, DataSize[3], linked; - - if (cgi_get_nodes(parent_id, "FlowSolution_t", nsols, &id)) - return 1; - if (*nsols<=0) { - sol[0] = 0; - return 0; - } - - sol[0] = CGNS_NEW(cgns_sol, (*nsols)); - for (s=0; s<(*nsols); s++) { - sol[0][s].id = id[s]; - sol[0][s].link = cgi_read_link(id[s]); - sol[0][s].in_link = in_link; - linked = sol[0][s].link ? 1 : in_link; - - /* FlowSolution_t Name */ - ADF_Get_Name(sol[0][s].id, sol[0][s].name, &ierr); - if (ierr>0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - - /* GridLocation */ - if (cgi_read_location(sol[0][s].id, sol[0][s].name, - &sol[0][s].location)) return 1; - - /* Rind Planes */ - if (cgi_read_rind(sol[0][s].id, &sol[0][s].rind_planes)) return 1; - - /* Determine data size */ - if (cgi_datasize(Idim, CurrentDim, sol[0][s].location, - sol[0][s].rind_planes, DataSize)) return 1; - - /* DataArray_t */ - if (cgi_get_nodes(sol[0][s].id, "DataArray_t", &sol[0][s].nfields, - &idf)) return 1; - if (sol[0][s].nfields > 0) { - sol[0][s].field = CGNS_NEW(cgns_array, sol[0][s].nfields); - for (z=0; zid = id[0]; - zconn[0]->link = cgi_read_link(id[0]); - zconn[0]->in_link = in_link; - linked = zconn[0]->link ? 1 : in_link; - free(id); - - /* Name */ - ADF_Get_Name(zconn[0]->id, zconn[0]->name, &ierr); - if (ierr>0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - - /* OversetHoles_t */ - if (cgi_get_nodes(zconn[0]->id, "OversetHoles_t", &zconn[0]->nholes, &id)) - return 1; - if (zconn[0]->nholes > 0) { - zconn[0]->hole = CGNS_NEW(cgns_hole,zconn[0]->nholes); - for (n=0; nnholes; n++) { - zconn[0]->hole[n].id = id[n]; - zconn[0]->hole[n].link = cgi_read_link(id[n]); - zconn[0]->hole[n].in_link = linked; - if (cgi_read_hole(&zconn[0]->hole[n])) return 1; - } - free(id); - } - - /* GridConnectivity_t */ - if (cgi_get_nodes(zconn[0]->id, "GridConnectivity_t", - &zconn[0]->nconns, &id)) return 1; - if (zconn[0]->nconns > 0) { - zconn[0]->conn = CGNS_NEW(cgns_conn,zconn[0]->nconns); - for (n=0; nnconns; n++) { - zconn[0]->conn[n].id = id[n]; - zconn[0]->conn[n].link = cgi_read_link(id[n]); - zconn[0]->conn[n].in_link = linked; - if (cgi_read_conn(&zconn[0]->conn[n])) return 1; - } - free(id); - } - - /* GridConnectivity1to1_t */ - if (cgi_get_nodes(zconn[0]->id, "GridConnectivity1to1_t", - &zconn[0]->n1to1, &id)) return 1; - if (zconn[0]->n1to1 >0) { - zconn[0]->one21 = CGNS_NEW(cgns_1to1, zconn[0]->n1to1); - for (n=0; nn1to1; n++) { - zconn[0]->one21[n].id = id[n]; - zconn[0]->one21[n].link = cgi_read_link(id[n]); - zconn[0]->one21[n].in_link = linked; - if (cgi_read_1to1(&zconn[0]->one21[n])) return 1; - } - free(id); - } - - /* Descriptor_t */ - if (cgi_get_nodes(zconn[0]->id, "Descriptor_t", - &zconn[0]->ndescr, &id)) return 1; - if (zconn[0]->ndescr>0) { - zconn[0]->descr = CGNS_NEW(cgns_descr, zconn[0]->ndescr); - for (n=0; nndescr; n++) { - zconn[0]->descr[n].id = id[n]; - zconn[0]->descr[n].link = cgi_read_link(id[n]); - zconn[0]->descr[n].in_link = linked; - if (cgi_read_string(id[n], zconn[0]->descr[n].name, - &zconn[0]->descr[n].text)) return 1; - } - free(id); - } - - /* UserDefinedData_t */ - if (cgi_read_user_data(linked, zconn[0]->id, &zconn[0]->nuser_data, - &zconn[0]->user_data)) return 1; - - return 0; -} - -int cgi_read_1to1(cgns_1to1 *one21) { - int ierr, i, n, ndim, dim_vals[12]; - int nIA_t, nIR_t; - int linked = one21->link ? 1 : one21->in_link; - double *IA_id, *IR_id, *id; - char_33 name, data_type; - char *string_data; - - /* get donor name */ - if (cgi_read_string(one21->id, one21->name, &string_data)) return 1; - strcpy(one21->donor, string_data); - free(string_data); - - /* get ADF-ID of point sets for donor and receiver */ - one21->ptset.id=0; - one21->ptset.link=0; - one21->dptset.id=0; - one21->dptset.link=0; - if (cgi_get_nodes(one21->id, "IndexRange_t", &nIR_t, &IR_id)) return 1; - for (i=0; i0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - if (strcmp(name, "PointRange")==0) { - if (one21->ptset.id==0) { - one21->ptset.id=IR_id[i]; - one21->ptset.link=cgi_read_link(IR_id[i]); - one21->ptset.in_link=linked; - one21->ptset.type=PointRange; - } else { - cgi_error("Multiple PointRange definition for %s",one21->name); - return 1; - } - } else if (strcmp(name, "PointRangeDonor")==0) { - if (one21->dptset.id==0) { - one21->dptset.id=IR_id[i]; - one21->dptset.link=cgi_read_link(IR_id[i]); - one21->dptset.in_link=linked; - one21->dptset.type=PointRangeDonor; - } else { - cgi_error("Multiple PointRangeDonor definition for %s",one21->name); - return 1; - } - } - } - if (nIR_t>0) free(IR_id); - if (one21->ptset.id==0 || one21->dptset.id==0) { - cgi_error("PointRange or PointRangeDonor undefined for %s",one21->name); - return 1; - } - - /* Read Point set Receiver */ - if (cgi_read_ptset(one21->id, &one21->ptset)) return 1; - - /* Read Point set Donor */ - if (cgi_read_ptset(one21->id, &one21->dptset)) return 1; - - /* Get "int[IndexDimension]" children */ - if (cgi_get_nodes(one21->id, "\"int[IndexDimension]\"", &nIA_t, &IA_id)) - return 1; - - if (nIA_t==0) { - one21->transform = CGNS_NEW(int, Idim); - /* set default transformation matrix to 1,2,3 */ - for (i=0; itransform[i]=i+1; - - } else if (nIA_t<0 || nIA_t>1) { - cgi_error("Invalid definition of transformation matrix for %s",one21->name); - return 1; - - } else if (nIA_t==1) { - if (cgi_read_node(IA_id[0], name, data_type, &ndim, dim_vals, - (void **)&one21->transform, READ_DATA)) { - cgi_error("Error reading 1to1-connectivity transformation matrix"); - return 1; - } - /* verify plausibility of data */ - if (strcmp("Transform", name)) { - cgi_error("The ADF name should be 'Transform' and not '%s'",name); - return 1; - } - if (strcmp(data_type, "I4")!=0) { - cgi_error("Data type '%s' not supported for Transform",data_type); - return 1; - } - if (ndim != 1 || dim_vals[0] != Idim) { - cgi_error("Error in dimension for node type Transform"); - return 1; - } - for (i=0; itransform[i] >Idim || one21->transform[i] <(-1*Idim)) { - cgi_error("Invalid transformation matrix"); - return 1; - } - } - free(IA_id); - } - /* Ordinal_t */ - if (cgi_read_ordinal(one21->id, &one21->ordinal)) return 1; - - /* Descriptor_t */ - if (cgi_get_nodes(one21->id, "Descriptor_t", &one21->ndescr, &id)) - return 1; - if (one21->ndescr>0) { - one21->descr = CGNS_NEW(cgns_descr, one21->ndescr); - for (n=0; nndescr; n++) { - one21->descr[n].id = id[n]; - one21->descr[n].link = cgi_read_link(id[n]); - one21->descr[n].in_link = linked; - if (cgi_read_string(id[n], one21->descr[n].name, - &one21->descr[n].text)) return 1; - } - free(id); - } - - /* UserDefinedData_t */ - if (cgi_read_user_data(linked, one21->id, &one21->nuser_data, - &one21->user_data)) return 1; - - return 0; -} - -int cgi_read_conn(cgns_conn *conn) { - int ierr, i, nchild; - int linked = conn->link ? 1 : conn->in_link; - char_33 name, parent_label; - double *id, parent_id; - char *string_data; /* allocated in cgi_read_node */ - - /* get donor name */ - if (cgi_read_string(conn->id, conn->name, &string_data)) return 1; - if (cgi_check_strlen(string_data)) return 1; - strcpy(conn->donor, string_data); - free(string_data); - - /* GridLocation */ - if (cgi_read_location(conn->id, conn->name, &conn->location)) return 1; - if (conn->location != Vertex && conn->location != CellCenter && - conn->location != FaceCenter && conn->location != IFaceCenter && - conn->location != JFaceCenter && conn->location != KFaceCenter) { - cgi_error("Unsupported GridLocation %s for Connectivity %s", - conn->location < 0 || conn->location >= NofValidGridLocation ? - "" : GridLocationName[conn->location], conn->name); - return 1; - } - - /* Receiver IndexArray_t ? */ - conn->ptset.id=0; - conn->ptset.link=0; - if (cgi_get_nodes(conn->id, "IndexArray_t", &nchild, &id)) return 1; - for (i=0; i0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - if (strcmp(name, "PointList")==0) { - if (conn->ptset.id==0) { - conn->ptset.id=id[i]; - conn->ptset.link=cgi_read_link(id[i]); - conn->ptset.in_link=linked; - conn->ptset.type=PointList; - if (cgi_read_ptset(conn->id, &conn->ptset)) return 1; - } else { - cgi_error("Multiple PointList definition for %s",conn->name); - return 1; - } - } - } - if (nchild>0) free(id); - - /* Receiver IndexRange_t ? */ - if (cgi_get_nodes(conn->id, "IndexRange_t", &nchild, &id)) return 1; - for (i=0; i0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - if (strcmp(name, "PointRange")==0) { - if (conn->ptset.id==0) { - conn->ptset.id=id[i]; - conn->ptset.link=cgi_read_link(id[i]); - conn->ptset.in_link=linked; - conn->ptset.type=PointRange; - if (cgi_read_ptset(conn->id, &conn->ptset)) return 1; - } else { - cgi_error("Multiple PointSet definition for %s",conn->name); - return 1; - } - } - } - if (nchild>0) free(id); - - /* check */ - if (conn->ptset.id==0) { - cgi_error("Niether PointRange nor PointList defined for GridConnectivity_t '%s'", - conn->name); - return 1; - } - - /* Find the parent node for Donor IndexArray_t */ - parent_id = 0; - parent_label[0]='\0'; - if (cg->version <1100 || cg->version>1200) { - /* Version 1.05 and 1.27+ put IndexArray_t directly under GridConnectivity_t */ - parent_id = conn->id; - strcpy(parent_label,"GridConnectivity_t"); - - } else { - /* version 1.1 to 1.20 used intermediate structures StructuredDonor_t & UnstructuredDonor_t */ - if (cgi_get_nodes(conn->id, "StructuredDonor_t", &nchild, &id)) - return 1; - if (nchild>1) { - cgi_error("StructuredDonor_t defined more than once for GridConnectivity_t '%s'", - conn->name); - return 1; - } else if (nchild==1) { - parent_id = id[0]; - strcpy(parent_label,"StructuredDonor_t"); - free(id); - } - if (cgi_get_nodes(conn->id, "UnstructuredDonor_t", &nchild, &id)) - return 1; - if (nchild>1) { - cgi_error("UnstructuredDonor_t defined more than once for GridConnectivity_t '%s'", - conn->name); - return 1; - } else if (nchild==1) { - if (parent_id) { - cgi_error("Multiple donors found under GridConnectivity_t '%s'",conn->name); - return 1; - } - parent_id = id[0]; - strcpy(parent_label,"UnstructuredDonor_t"); - free(id); - } - if (!parent_id) { - cgi_error("Error: Donor data undefined for GridConnectivity_t '%s'", conn->name); - return 1; - } - } - - /* Read Donor IndexArray_t */ - conn->dptset.id=0; - conn->dptset.link=0; - if (cgi_get_nodes(parent_id, "IndexArray_t", &nchild, &id)) return 1; - - for (i=0; i0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - if (strcmp(name, "PointListDonor") && strcmp(name, "CellListDonor")) - continue; - if (conn->dptset.id==0) { - conn->dptset.id=id[i]; - conn->dptset.link=cgi_read_link(id[i]); - conn->dptset.in_link=linked; - if (strcmp(name, "PointListDonor")==0) - conn->dptset.type=PointListDonor; - else { - if (strcmp(parent_label,"StructuredDonor_t")==0) { - cgi_error("StructuredDonor_t doesn't support CellListDonor"); - return 1; - } - conn->dptset.type=CellListDonor; - } - if (cgi_read_ptset(parent_id, &conn->dptset)) return 1; - } else { - cgi_error("Multiple PointListDonor/CellListDonor definition for %s",conn->name); - return 1; - } - } - if (nchild>0) free(id); - if (conn->dptset.id==0) { - cgi_error("Error: Donor patch undefined for GridConnectivity_t '%s'", conn->name); - return 1; - } - - /* Read InterpolantsDonor if it exist */ - conn->interpolants=0; - conn->narrays = 0; - if (strcmp(parent_label,"StructuredDonor_t")) { - if (cgi_get_nodes(parent_id, "DataArray_t", &nchild, &id)) return 1; - conn->narrays = nchild; - for (i=0; i0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - if (strcmp(name, "InterpolantsDonor")) continue; - if (conn->interpolants==0) { - conn->interpolants = CGNS_NEW(cgns_array, 1); - conn->interpolants->id = id[0]; - conn->interpolants->link = cgi_read_link(id[0]); - conn->interpolants->in_link = linked; - if (cgi_read_array(conn->interpolants, parent_label, parent_id)) - return 1; - } else { - cgi_error("InterpolantsDonor defined more than once for GridConnectivity_t '%s'", - conn->name); - return 1; - } - } - if (nchild) free(id); - } - - /* Get GridConnectivityType_t (conn->type) */ - if (cgi_get_nodes(conn->id, "GridConnectivityType_t", &nchild, &id)) - return 1; - - if (nchild==0) { - conn->type = Overset; - } else if (nchild<0 || nchild>1) { - cgi_error("Invalid definition of GridConnectivityType_t for %s",conn->name); - return 1; - } else if (nchild==1) { - /* Read the grid connectivity type value in the GridConnectivityType_t node */ - if (cgi_read_string(id[0], name, &string_data)) return 1; - if (cgi_GridConnectivityType(string_data, &conn->type)) return 1; - free(string_data); - } - if (nchild) free(id); - - /* update the version */ - if (cg->mode == MODE_MODIFY && !linked && - cg->version >= 1100 && cg->version <= 1200) { - ADF_Move_Child(parent_id, conn->dptset.id, conn->id, &ierr); - if (ierr > 0) { - adf_error("ADF_Move_Child", ierr); - return 1; - } - if (conn->interpolants) { - ADF_Move_Child(parent_id, conn->interpolants->id, conn->id, &ierr); - if (ierr > 0) { - adf_error("ADF_Move_Child", ierr); - return 1; - } - } - if (cgi_delete_node(conn->id, parent_id)) return 1; - } - - /* Ordinal_t */ - conn->ordinal=0; - if (cgi_read_ordinal(conn->id, &conn->ordinal)) return 1; - - /* Descriptor_t */ - if (cgi_get_nodes(conn->id, "Descriptor_t", &conn->ndescr, &id)) return 1; - if (conn->ndescr>0) { - conn->descr = CGNS_NEW(cgns_descr, conn->ndescr); - for (i=0; indescr; i++) { - conn->descr[i].id = id[i]; - conn->descr[i].link = cgi_read_link(id[i]); - conn->descr[i].in_link = linked; - if (cgi_read_string(id[i], conn->descr[i].name, - &conn->descr[i].text)) return 1; - } - free(id); - } - - /* GridConnectivityProperty_t */ - if (cgi_read_cprop(linked, conn->id, &conn->cprop)) return 1; - - /* UserDefinedData_t */ - if (cgi_read_user_data(linked, conn->id, &conn->nuser_data, - &conn->user_data)) return 1; - - return 0; -} - -int cgi_read_cprop(int in_link, double parent_id, cgns_cprop **cprop) { - int nchild, n, linked; - double *id; - char *type_name; /* allocated in cgi_read_node */ - char_33 name; - - /* get number of GridConnectivityProperty_t nodes and their ADF_ID */ - if (cgi_get_nodes(parent_id, "GridConnectivityProperty_t", &nchild, &id)) return 1; - if (nchild<=0) { - cprop[0]=0; - return 0; - } else if (nchild>1) { - cgi_error("Error: Multiple GridConnectivityProperty_t found..."); - free(id); - return 1; - } - cprop[0] = CGNS_NEW(cgns_cprop, 1); - cprop[0]->id = id[0]; - cprop[0]->link = cgi_read_link(id[0]); - cprop[0]->in_link = in_link; - linked = cprop[0]->link ? 1 : in_link; - free(id); - - /* Descriptor_t */ - if (cgi_get_nodes(cprop[0]->id, "Descriptor_t", &nchild, &id)) return 1; - cprop[0]->ndescr = 0; - if (nchild>0) { - cprop[0]->ndescr = nchild; - cprop[0]->descr = CGNS_NEW(cgns_descr, nchild); - for (n=0; ndescr[n].id = id[n]; - cprop[0]->descr[n].link = cgi_read_link(id[n]); - cprop[0]->descr[n].in_link = linked; - if (cgi_read_string(id[n], cprop[0]->descr[n].name, - &cprop[0]->descr[n].text)) return 1; - } - free(id); - } - - /* UserDefinedData_t */ - if (cgi_read_user_data(linked, cprop[0]->id, &cprop[0]->nuser_data, - &cprop[0]->user_data)) return 1; - - /* AverageInterface_t */ - if (cgi_get_nodes(cprop[0]->id, "AverageInterface_t", &nchild, &id)) - return 1; - if (nchild<=0) { - cprop[0]->caverage = 0; - } else if (nchild>1) { - cgi_error("Error: Multiple AverageInterface_t found..."); - free(id); - return 1; - } else { - cprop[0]->caverage = CGNS_NEW(cgns_caverage, 1); - cprop[0]->caverage->id = id[0]; - cprop[0]->caverage->link = cgi_read_link(id[0]); - cprop[0]->caverage->in_link = linked; - in_link = cprop[0]->caverage->link ? 1 : linked; - free(id); - - /* Descriptor_t */ - if (cgi_get_nodes(cprop[0]->caverage->id, "Descriptor_t", &nchild, &id)) - return 1; - cprop[0]->caverage->ndescr = 0; - if (nchild>0) { - cprop[0]->caverage->ndescr = nchild; - cprop[0]->caverage->descr = CGNS_NEW(cgns_descr, nchild); - for (n=0; ncaverage->descr[n].id = id[n]; - cprop[0]->caverage->descr[n].link = cgi_read_link(id[n]); - cprop[0]->caverage->descr[n].in_link = in_link; - if (cgi_read_string(id[n], cprop[0]->caverage->descr[n].name, - &cprop[0]->caverage->descr[n].text)) return 1; - } - free(id); - } - - /* UserDefinedData_t */ - if (cgi_read_user_data(in_link, cprop[0]->caverage->id, - &cprop[0]->caverage->nuser_data, &cprop[0]->caverage->user_data)) - return 1; - - /* AverageInterfaceType_t */ - if (cgi_get_nodes(cprop[0]->caverage->id, "AverageInterfaceType_t", - &nchild, &id)) return 1; - if (nchild==0) { - cgi_error("Error: AverageInterfaceType_t missing under AverageInterface_t"); - return 1; - } else if (nchild >1) { - cgi_error("File incorrect: multiple definition of AverageInterfaceType"); - free(id); - return 1; - } else { - if (cgi_read_string(id[0], name, &type_name)) return 1; - free(id); - if (cgi_AverageInterfaceType(type_name, &cprop[0]->caverage->type)) - return 1; - free(type_name); - } - } - - /* Periodic_t */ - if (cgi_get_nodes(cprop[0]->id, "Periodic_t", &nchild, &id)) return 1; - if (nchild<=0) { - cprop[0]->cperio = 0; - } else if (nchild>1) { - cgi_error("Error: Multiple Periodic_t found..."); - free(id); - return 1; - } else { - cprop[0]->cperio = CGNS_NEW(cgns_cperio, 1); - cprop[0]->cperio->id = id[0]; - cprop[0]->cperio->link = cgi_read_link(id[0]); - cprop[0]->cperio->in_link = linked; - in_link = cprop[0]->cperio->link ? 1 : linked; - free(id); - - /* Descriptor_t, DataClass_t, DimensionalUnits_t */ - if (cgi_read_DDD(in_link, cprop[0]->cperio->id, - &cprop[0]->cperio->ndescr, &cprop[0]->cperio->descr, - &cprop[0]->cperio->data_class, &cprop[0]->cperio->units)) - return 1; - - /* UserDefinedData_t */ - if (cgi_read_user_data(in_link, cprop[0]->cperio->id, - &cprop[0]->cperio->nuser_data, &cprop[0]->cperio->user_data)) - return 1; - - /* DataArray_t: RotationCenter, RotationAngle, Translation: */ - if (cgi_get_nodes(cprop[0]->cperio->id, "DataArray_t", &nchild, &id)) - return 1; - if (nchild==0) { - cgi_error("Error: Three DataArray_t nodes missing under Periodic_t"); - return 1; - } else if (nchild!=3) { - cgi_error("Error: 3 DataArray_t required under Periodic_t"); - free(id); - return 1; - } - cprop[0]->cperio->narrays = nchild; - cprop[0]->cperio->array = CGNS_NEW(cgns_array, cprop[0]->cperio->narrays); - - for (n=0; n<(cprop[0]->cperio->narrays); n++) { - cgns_array *array; - cprop[0]->cperio->array[n].id = id[n]; - cprop[0]->cperio->array[n].link = cgi_read_link(id[n]); - cprop[0]->cperio->array[n].in_link = in_link; - - if (cgi_read_array(&cprop[0]->cperio->array[n], "Periodic_t", - cprop[0]->cperio->id)) return 1; - - array = &cprop[0]->cperio->array[n]; - - /* check data */ - if (strcmp("RotationCenter",array->name) && - strcmp("RotationAngle",array->name) && - strcmp("Translation",array->name)) { - cgi_error("Error: Wrong DataArray_t found under Periodic_t: '%s'",array->name); - free(id); - return 1; - } else if (strcmp(array->data_type,"R4") || array->data_dim!=1 - || array->dim_vals[0]!=Pdim) { - cgi_error("Error: Array '%s' incorrectly sized",array->name); - free(id); - return 1; - } - } /* loop through arrays */ - free(id); - } - return 0; -} - -int cgi_read_hole(cgns_hole *hole) { - int ierr=0, linked = hole->link ? 1 : hole->in_link; - int nIA_t, nIR_t; - double *IA_id, *IR_id, *id; - int set, n; - - /* name of OversetHoles_t Node */ - ADF_Get_Name(hole->id, hole->name, &ierr); - if (ierr>0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - - /* GridLocation */ - if (cgi_read_location(hole->id, hole->name, &hole->location)) return 1; - if (hole->location != Vertex && hole->location != CellCenter) { - cgi_error("Unsupported GridLocation %s for Overset Hole %s", - hole->location < 0 || hole->location >= NofValidGridLocation ? - "" : GridLocationName[hole->location], hole->name); - return 1; - } - - /* get number of IndexArray_t and IndexRange_t nodes and their ADF_ID */ - if (cgi_get_nodes(hole->id, "IndexArray_t", &nIA_t, &IA_id)) return 1; - if (cgi_get_nodes(hole->id, "IndexRange_t", &nIR_t, &IR_id)) return 1; - - /* Hole defined with several PointRange */ - if (nIA_t==0 && nIR_t>0) { - hole->nptsets = nIR_t; - hole->ptset = CGNS_NEW(cgns_ptset, nIR_t); - for (set=0; setptset[set].id = IR_id[set]; - hole->ptset[set].link = cgi_read_link(IR_id[set]); - hole->ptset[set].in_link = linked; - hole->ptset[set].type = PointRange; - if (cgi_read_ptset(hole->id, &hole->ptset[set])) return 1; - } - free(IR_id); - - /* Hole defined with one single PointList */ - } else if (nIA_t==1 && nIR_t==0) { - hole->nptsets = 1; - hole->ptset = CGNS_NEW(cgns_ptset, 1); - hole->ptset[0].id = IA_id[0]; - hole->ptset[0].link = cgi_read_link(IA_id[0]); - hole->ptset[0].in_link = linked; - hole->ptset[0].type = PointList; - if (cgi_read_ptset(hole->id, &hole->ptset[0])) return 1; - free(IA_id); - - /* Empty hole (requested by Cetin) */ - } else if (nIA_t==0 && nIR_t==0) { - hole->nptsets = 1; - hole->ptset = CGNS_NEW(cgns_ptset, 1); - hole->ptset[0].npts = 0; - hole->ptset[0].type = PointList; /* initialize */ - strcpy(hole->ptset[0].data_type, "I4"); - hole->ptset[0].id = 0; - hole->ptset[0].link = 0; - hole->ptset[0].in_link = linked; - strcpy(hole->ptset[0].name,"Empty"); - } else { - cgi_error("Overset hole '%s' defined incorrectly with %d IndexArray_t and %d IndexRange_t.", - hole->name, nIA_t, nIR_t); - return 1; - } - - /* Descriptor_t */ - if (cgi_get_nodes(hole->id, "Descriptor_t", &hole->ndescr, &id)) return 1; - if (hole->ndescr>0) { - hole->descr = CGNS_NEW(cgns_descr, hole->ndescr); - for (n=0; nndescr; n++) { - hole->descr[n].id = id[n]; - hole->descr[n].link = cgi_read_link(id[n]); - hole->descr[n].in_link = linked; - if (cgi_read_string(id[n], hole->descr[n].name, - &hole->descr[n].text)) return 1; - } - free(id); - } - - /* UserDefinedData_t */ - if (cgi_read_user_data(linked, hole->id, &hole->nuser_data, - &hole->user_data)) return 1; - - return 0; -} - -int cgi_read_zboco(int in_link, double parent_id, cgns_zboco **zboco) { - int nnod, ierr, n, linked; - double *id; - - if (cgi_get_nodes(parent_id, "ZoneBC_t", &nnod, &id)) return 1; - if (nnod<=0) { - zboco[0] = 0; - return 0; - } - zboco[0] = CGNS_NEW(cgns_zboco, 1); - zboco[0]->id = id[0]; - zboco[0]->link = cgi_read_link(id[0]); - zboco[0]->in_link = in_link; - linked = zboco[0]->link ? 1 : in_link; - free(id); - - /* Name */ - ADF_Get_Name(zboco[0]->id, zboco[0]->name, &ierr); - if (ierr>0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - - /* get number of BC_t */ - if (cgi_get_nodes(zboco[0]->id, "BC_t", &zboco[0]->nbocos, &id)) return 1; - if (zboco[0]->nbocos > 0) { - zboco[0]->boco = CGNS_NEW(cgns_boco,zboco[0]->nbocos); - for (n=0; nnbocos; n++) { - zboco[0]->boco[n].id = id[n]; - zboco[0]->boco[n].link = cgi_read_link(id[n]); - zboco[0]->boco[n].in_link = linked; - if (cgi_read_boco(&zboco[0]->boco[n])) return 1; - } /* loop through BC_t nodes */ - free(id); - } - - /* Descriptor_t, DataClass_t, DimensionalUnits_t */ - if (cgi_read_DDD(linked, zboco[0]->id, &zboco[0]->ndescr, &zboco[0]->descr, - &zboco[0]->data_class, &zboco[0]->units)) return 1; - - /* ReferenceState_t */ - if (cgi_read_state(linked, zboco[0]->id, &zboco[0]->state)) return 1; - - /* UserDefinedData_t */ - if (cgi_read_user_data(linked, zboco[0]->id, &zboco[0]->nuser_data, - &zboco[0]->user_data)) return 1; - - return 0; -} - -int cgi_read_boco(cgns_boco *boco) { - int ierr=0; - int linked = boco->link ? 1 : boco->in_link; - int nIA_t, nIR_t, n; - double *IA_id, *IR_id; - char *boconame; - char_33 name; - - /* get BC_t */ - if (cgi_read_string(boco->id, boco->name, &boconame) || - cgi_BCType(boconame, &boco->type)) return 1; - free(boconame); - - /* get number of IndexArray_t and IndexRange_t nodes and their ADF_ID */ - if (cgi_get_nodes(boco->id, "IndexArray_t", &nIA_t, &IA_id)) return 1; - if (cgi_get_nodes(boco->id, "IndexRange_t", &nIR_t, &IR_id)) return 1; - - /* initialized */ - boco->ptset = 0; - - for (n=0; n0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - if (strcmp(name,"PointRange") && strcmp(name,"ElementRange")) { - cgi_error("Invalid name for IndexRange_t"); - return 1; - } - if (boco->ptset!=0) { - cgi_error("Multiple definition of boundary patch found"); - return 1; - } - boco->ptset = CGNS_NEW(cgns_ptset, 1); - if (strcmp(name,"ElementRange")==0) - boco->ptset->type = ElementRange; - else - boco->ptset->type = PointRange; - boco->location = GridLocationNull; - boco->ptset->id=IR_id[n]; - boco->ptset->link=cgi_read_link(IR_id[n]); - boco->ptset->in_link=linked; - if (cgi_read_ptset(boco->id, boco->ptset)) return 1; - } - if (nIR_t) free(IR_id); - - for (n=0; n0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - if (strcmp(name, "PointList") && strcmp(name,"ElementList")) continue; - - if (boco->ptset!=0) { - cgi_error("Multiple definition of boundary patch found"); - return 1; - } - boco->ptset = CGNS_NEW(cgns_ptset, 1); - if (strcmp(name,"ElementList")==0) - boco->ptset->type = ElementList; - else - boco->ptset->type = PointList; - boco->location = GridLocationNull; - boco->ptset->id = IA_id[0]; - boco->ptset->link = cgi_read_link(IA_id[0]); - boco->ptset->in_link = linked; - if (cgi_read_ptset(boco->id, boco->ptset)) return 1; - } - - if (boco->ptset==0) { - cgi_error("Boundary condition patch '%s' defined incorrectly",boco->name); - return 1; - } - - /* FamilyName_t */ - if (cgi_read_family_name(linked, boco->id, boco->name, boco->family_name)) - return 1; - - /* InwardNormalList */ - boco->normal = 0; - for (n=0; n0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - if (strcmp(name, "InwardNormalList")) continue; - - boco->normal = CGNS_NEW(cgns_array, 1); - boco->normal->id = IA_id[n]; - boco->normal->link = cgi_read_link(IA_id[n]); - boco->normal->in_link = linked; - if (cgi_read_node(IA_id[n], boco->normal->name, boco->normal->data_type, - &boco->normal->data_dim, boco->normal->dim_vals, &boco->normal->data, - READ_DATA)) { - cgi_error("Error reading boco->normal"); - return 1; - } - - /* set to NULL useless elements of data structure */ - boco->normal->ndescr = 0; - boco->normal->units = 0; - boco->normal->exponents = 0; - boco->normal->convert = 0; - - /* data verify */ - if (boco->normal->data_dim!=2 || boco->normal->dim_vals[0]!=Pdim || - boco->normal->dim_vals[1]!=boco->ptset->size_of_patch || - (strcmp(boco->normal->data_type,"R4") && - strcmp(boco->normal->data_type,"R8"))) { - /*printf("boco->normal->dim_vals[1]=%d, boco->ptset->size_of_patch=%d\n", - boco->normal->dim_vals[1],boco->ptset->size_of_patch);*/ - cgi_error("InwardNormalList incorrectly defined for BC_t '%s'",boco->name); - return 1; - } - break; - } - if (nIA_t) free(IA_id); - - /* InwardNormalIndex */ - boco->Nindex = 0; - if (cgi_get_nodes(boco->id, "\"int[IndexDimension]\"", &nIA_t, &IA_id)) - return 1; - for (n=0; n0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - if (strcmp(name, "InwardNormalIndex")) continue; - - boco->index_id=IA_id[n]; - - if (cgi_read_node(IA_id[n], name, data_type, &ndim, dim_vals, - (void **)&boco->Nindex, READ_DATA)) return 1; - if (strcmp(data_type,"I4")!=0 || dim_vals[0]!=Idim) { - cgi_error("InwardNormalIndex incorrectly defined for BC_t '%s'",boco->name); - return 1; - } - break; - } - if (nIA_t) free(IA_id); - - /* BCDataSet_t */ - if (cgi_read_dataset(linked, boco->id, &boco->ndataset, &boco->dataset)) - return 1; - - /* Verify that BCData for Dirichlet/Neumann contains the right number of data */ - for (n=0; nndataset; n++) { - int i; - if (boco->dataset[n].dirichlet) { - for (i=0; idataset[n].dirichlet->narrays; i++) { - cgns_array array = boco->dataset[n].dirichlet->array[i]; - if (array.data_dim!=1 || (array.dim_vals[0] != 1 && - array.dim_vals[0] != boco->ptset->size_of_patch)) { - cgi_error("Wrong array size for Dirichlet data"); - return 1; - } - } - } - if (boco->dataset[n].neumann) { - for (i=0; idataset[n].neumann->narrays; i++) { - cgns_array array = boco->dataset[n].neumann->array[i]; - if (array.data_dim!=1 || (array.dim_vals[0] != 1 && - array.dim_vals[0] != boco->ptset->size_of_patch)) { - cgi_error("Wrong array size for Dirichlet data"); - return 1; - } - } - } - } - - /* GridLocation_t */ - if (cg->version>1200) { - if (cgi_read_location(boco->id, boco->name, &boco->location)) return 1; - - } else if (!boco->location) { - /* Until version 1.2, GridLocation was under BCDataSet_t */ - if (boco->ndataset) { /* Wild assumption that all BCDataSet have same - GridLocation_t value */ - if (cgi_read_location(boco->dataset[0].id, boco->dataset[0].name, - &boco->location)) return 1; - } else { - if (!boco->location) boco->location=Vertex; - } - } - - if (cg->version <= 1270) { - const char *name; - int len; - double dummy_id; -#if 0 /* re-enable ElementList/ElementRange */ - if (boco->ptset->type == ElementRange || - boco->ptset->type == ElementList) { - if (boco->ptset->type == ElementRange) - boco->ptset->type = PointRange; - else - boco->ptset->type = PointList; - boco->location = FaceCenter; - if (cg->mode == MODE_MODIFY && !linked) { - name = PointSetTypeName[boco->ptset->type]; - ADF_Put_Name(boco->id, boco->ptset->id, name, &ierr); - if (ierr > 0) { - adf_error("ADF_Put_Name", ierr); - return 1; - } - } - } -#endif - if (cg->mode == MODE_MODIFY && !linked) { - ADF_Get_Node_ID(boco->id, "GridLocation", &dummy_id, &ierr); - if (!ierr) cgi_delete_node(boco->id, dummy_id); - if (boco->location != Vertex) { - name = GridLocationName[boco->location]; - len = strlen (name); - if (cgi_new_node(boco->id, "GridLocation", "GridLocation_t", - &dummy_id, "C1", 1, &len, name)) - return 1; - } - } - } - - /* Descriptor_t, DataClass_t, DimensionalUnits_t */ - if (cgi_read_DDD(linked, boco->id, &boco->ndescr, &boco->descr, - &boco->data_class, &boco->units)) return 1; - - /* ReferenceState_t */ - if (cgi_read_state(linked, boco->id, &boco->state)) return 1; - - /* Ordinal_t */ - if (cgi_read_ordinal(boco->id, &boco->ordinal)) return 1; - - /* BCProperty_t */ - if (cgi_read_bprop(linked, boco->id, &boco->bprop)) return 1; - - /* UserDefinedData_t */ - if (cgi_read_user_data(linked, boco->id, &boco->nuser_data, - &boco->user_data)) return 1; - - return 0; -} - -int cgi_read_bprop(int in_link, double parent_id, cgns_bprop **bprop) { - int nchild, n, linked; - double *id; - char *type_name; /* allocated in cgi_read_node */ - char_33 name; - - /* get number of BCProperty_t nodes and their ADF_ID */ - if (cgi_get_nodes(parent_id, "BCProperty_t", &nchild, &id)) return 1; - if (nchild<=0) { - bprop[0]=0; - return 0; - } else if (nchild>1) { - cgi_error("Error: Multiple BCProperty_t found..."); - free(id); - return 1; - } - bprop[0] = CGNS_NEW(cgns_bprop, 1); - bprop[0]->id = id[0]; - bprop[0]->link = cgi_read_link(id[0]); - bprop[0]->in_link = in_link; - linked = bprop[0]->link ? 1 : in_link; - free(id); - - /* Descriptor_t */ - if (cgi_get_nodes(bprop[0]->id, "Descriptor_t", &nchild, &id)) return 1; - bprop[0]->ndescr = 0; - if (nchild>0) { - bprop[0]->ndescr = nchild; - bprop[0]->descr = CGNS_NEW(cgns_descr, nchild); - for (n=0; ndescr[n].id = id[n]; - bprop[0]->descr[n].link = cgi_read_link(id[n]); - bprop[0]->descr[n].in_link = linked; - if (cgi_read_string(id[n], bprop[0]->descr[n].name, - &bprop[0]->descr[n].text)) return 1; - } - free(id); - } - - /* UserDefinedData_t */ - if (cgi_read_user_data(linked, bprop[0]->id, &bprop[0]->nuser_data, - &bprop[0]->user_data)) return 1; - - /* WallFunction_t */ - if (cgi_get_nodes(bprop[0]->id, "WallFunction_t", &nchild, &id)) return 1; - if (nchild<=0) { - bprop[0]->bcwall = 0; - } else if (nchild>1) { - cgi_error("Error: Multiple WallFunction_t found..."); - free(id); - return 1; - } else { - bprop[0]->bcwall = CGNS_NEW(cgns_bcwall, 1); - bprop[0]->bcwall->id = id[0]; - bprop[0]->bcwall->link = cgi_read_link(id[0]); - bprop[0]->bcwall->in_link = linked; - in_link = bprop[0]->bcwall->link ? 1 : linked; - free(id); - - /* Descriptor_t */ - if (cgi_get_nodes(bprop[0]->bcwall->id, "Descriptor_t", &nchild, &id)) - return 1; - bprop[0]->bcwall->ndescr = 0; - if (nchild>0) { - bprop[0]->bcwall->ndescr = nchild; - bprop[0]->bcwall->descr = CGNS_NEW(cgns_descr, nchild); - for (n=0; nbcwall->descr[n].id = id[n]; - bprop[0]->bcwall->descr[n].link = cgi_read_link(id[n]); - bprop[0]->bcwall->descr[n].in_link = in_link; - if (cgi_read_string(id[n], bprop[0]->bcwall->descr[n].name, - &bprop[0]->bcwall->descr[n].text)) return 1; - } - free(id); - } - - /* UserDefinedData_t */ - if (cgi_read_user_data(in_link, bprop[0]->bcwall->id, - &bprop[0]->bcwall->nuser_data, &bprop[0]->bcwall->user_data)) - return 1; - - /* WallFunctionType_t */ - if (cgi_get_nodes(bprop[0]->bcwall->id, "WallFunctionType_t", - &nchild, &id)) return 1; - if (nchild==0) { - cgi_error("Error: WallFunctionType_t missing under WallFunction_t"); - return 1; - } else if (nchild >1) { - cgi_error("File incorrect: multiple definition of WallFunctionType"); - free(id); - return 1; - } else { - if (cgi_read_string(id[0], name, &type_name)) return 1; - free(id); - if (cgi_WallFunctionType(type_name, &bprop[0]->bcwall->type)) return 1; - free(type_name); - } - } - - /* Area_t */ - if (cgi_get_nodes(bprop[0]->id, "Area_t", &nchild, &id)) return 1; - if (nchild<=0) { - bprop[0]->bcarea = 0; - } else if (nchild>1) { - cgi_error("Error: Multiple Area_t found..."); - free(id); - return 1; - } else { - bprop[0]->bcarea = CGNS_NEW(cgns_bcarea, 1); - bprop[0]->bcarea->id = id[0]; - bprop[0]->bcarea->link = cgi_read_link(id[0]); - bprop[0]->bcarea->in_link = linked; - in_link = bprop[0]->bcarea->link ? 1 : linked; - free(id); - - /* Descriptor_t */ - if (cgi_get_nodes(bprop[0]->bcarea->id, "Descriptor_t", &nchild, &id)) - return 1; - bprop[0]->bcarea->ndescr = 0; - if (nchild>0) { - bprop[0]->bcarea->ndescr = nchild; - bprop[0]->bcarea->descr = CGNS_NEW(cgns_descr, nchild); - for (n=0; nbcarea->descr[n].id = id[n]; - bprop[0]->bcarea->descr[n].link = cgi_read_link(id[n]); - bprop[0]->bcarea->descr[n].in_link = in_link; - if (cgi_read_string(id[n], bprop[0]->bcarea->descr[n].name, - &bprop[0]->bcarea->descr[n].text)) return 1; - } - free(id); - } - - /* UserDefinedData_t */ - if (cgi_read_user_data(in_link, bprop[0]->bcarea->id, - &bprop[0]->bcarea->nuser_data, &bprop[0]->bcarea->user_data)) - return 1; - - /* AreaType_t */ - if (cgi_get_nodes(bprop[0]->bcarea->id, "AreaType_t", &nchild, &id)) - return 1; - if (nchild==0) { - cgi_error("Error: AreaType_t missing under Area_t"); - return 1; - } else if (nchild >1) { - cgi_error("File incorrect: multiple definition of AreaType"); - free(id); - return 1; - } else { - if (cgi_read_string(id[0], name, &type_name)) return 1; - free(id); - if (cgi_AreaType(type_name, &bprop[0]->bcarea->type)) return 1; - free(type_name); - } - - /* DataArray_t: SurfaceArea , RegionName */ - if (cgi_get_nodes(bprop[0]->bcarea->id, "DataArray_t", &nchild, &id)) - return 1; - if (nchild==0) { - cgi_error("Error: SurfaceArea and RegionName missing under Area_t"); - return 1; - } else if (nchild!=2) { - cgi_error("Error: 2 DataArray_t (SurfaceArea & RegionName) required under Area_t"); - free(id); - return 1; - } - bprop[0]->bcarea->narrays = nchild; - bprop[0]->bcarea->array = CGNS_NEW(cgns_array, bprop[0]->bcarea->narrays); - - for (n=0; n<(bprop[0]->bcarea->narrays); n++) { - cgns_array *array; - bprop[0]->bcarea->array[n].id = id[n]; - bprop[0]->bcarea->array[n].link = cgi_read_link(id[n]); - bprop[0]->bcarea->array[n].in_link = in_link; - - if (cgi_read_array(&bprop[0]->bcarea->array[n], "Area_t", - bprop[0]->bcarea->id)) return 1; - - /* check data */ - array = &bprop[0]->bcarea->array[n]; - if ((strcmp("SurfaceArea",array->name)==0 && (strcmp(array->data_type,"R4") - || array->data_dim!=1 || array->dim_vals[0]!=1)) || - (strcmp("RegionName",array->name)==0 && (strcmp(array->data_type,"C1") - || array->data_dim!=1 || array->dim_vals[0]!=32)) ){ - cgi_error("Error: Array '%s' incorrectly sized",array->name); - free(id); - return 1; - } else if (strcmp("SurfaceArea",array->name) && strcmp("RegionName",array->name)) { - cgi_error("Error: Wrong DataArray_t found under Area_t: '%s'",array->name); - free(id); - return 1; - } - } /* loop through arrays */ - free(id); - } - return 0; -} - -int cgi_read_dataset(int in_link, double parent_id, int *ndataset, - cgns_dataset **dataset) { - int n, i, nnod, ierr, linked; - double *id, *ids; - char_33 name; - char *string_data; - - /* BCDataSet_t */ - if (cgi_get_nodes(parent_id, "BCDataSet_t", ndataset, &id)) return 1; - if (*ndataset<=0) { - dataset[0]=0; - return 0; - } - dataset[0]=CGNS_NEW(cgns_dataset, (*ndataset)); - for (n=0; n<*ndataset; n++) { - dataset[0][n].id = id[n]; - dataset[0][n].link = cgi_read_link(id[n]); - dataset[0][n].in_link = in_link; - linked = dataset[0][n].link ? 1 : in_link; - if (cgi_read_string(dataset[0][n].id, dataset[0][n].name, &string_data) || - cgi_BCType(string_data, &dataset[0][n].type)) return 1; - free(string_data); - - /* Descriptor_t, DataClass_t, DimensionalUnits_t */ - if (cgi_read_DDD(linked, dataset[0][n].id, &dataset[0][n].ndescr, - &dataset[0][n].descr, &dataset[0][n].data_class, - &dataset[0][n].units)) return 1; - - /* ReferenceState_t */ - if (cgi_read_state(linked, dataset[0][n].id, &dataset[0][n].state)) - return 1; - - /* BCData_t */ - dataset[0][n].dirichlet=dataset[0][n].neumann=0; - if (cgi_get_nodes(dataset[0][n].id, "BCData_t", &nnod, &ids)) return 1; - if (nnod>0) { - - for (i=0; i0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - if (strcmp(name,"DirichletData")==0) { - if (dataset[0][n].dirichlet!=0) { - cgi_error("Dirichet Data defined more than once..."); - return 1; - } - dataset[0][n].dirichlet=CGNS_NEW(cgns_bcdata, 1); - dataset[0][n].dirichlet->id = ids[i]; - dataset[0][n].dirichlet->link = cgi_read_link(ids[i]); - dataset[0][n].dirichlet->in_link = linked; - strcpy(dataset[0][n].dirichlet->name,"DirichletData"); - if (cgi_read_bcdata(dataset[0][n].dirichlet)) return 1; - } else if (strcmp(name,"NeumannData")==0) { - if (dataset[0][n].neumann!=0) { - cgi_error("Neumann Data defined more than once..."); - return 1; - } - dataset[0][n].neumann=CGNS_NEW(cgns_bcdata, 1); - dataset[0][n].neumann->id = ids[i]; - dataset[0][n].neumann->link = cgi_read_link(ids[i]); - dataset[0][n].neumann->in_link = linked; - strcpy(dataset[0][n].neumann->name,"NeumannData"); - if (cgi_read_bcdata(dataset[0][n].neumann)) return 1; - } - } - free(ids); - } - - /* UserDefinedData_t */ - if (cgi_read_user_data(linked, dataset[0][n].id, - &dataset[0][n].nuser_data, &dataset[0][n].user_data)) return 1; - } - free(id); - - return 0; -} - -int cgi_read_bcdata(cgns_bcdata *bcdata) { - int n, linked = bcdata->link ? 1 : bcdata->in_link; - double *id; - - /* DataArray_t */ - if (cgi_get_nodes(bcdata->id, "DataArray_t", &bcdata->narrays, &id)) - return 1; - if (bcdata->narrays>0) { - bcdata->array = CGNS_NEW(cgns_array, bcdata->narrays); - - for (n=0; nnarrays; n++) { - bcdata->array[n].id = id[n]; - bcdata->array[n].link = cgi_read_link(id[n]); - bcdata->array[n].in_link = linked; - cgi_read_array(&bcdata->array[n],"BCData_t",bcdata->id); - } - free(id); - } - - /* Descriptor_t, DataClass_t, DimensionalUnits_t */ - if (cgi_read_DDD(linked, bcdata->id, &bcdata->ndescr, &bcdata->descr, - &bcdata->data_class, &bcdata->units)) return 1; - - /* UserDefinedData_t */ - if (cgi_read_user_data(linked, bcdata->id, &bcdata->nuser_data, - &bcdata->user_data)) return 1; - - return 0; -} - -int cgi_read_ptset(double parent_id, cgns_ptset *ptset) { - int ndim, dim_vals[12]; - void **dummy=0; - - /* Get name of point set just to verify consistency */ - if (cgi_read_node(ptset->id, ptset->name, ptset->data_type, &ndim, dim_vals, - dummy, SKIP_DATA)) { - cgi_error("Error reading ptset"); - return 1; - } - - /* change read data for ElementList/Range stuff */ - if (cg->version <= 1200 && ndim == 1 && - (ptset->type == ElementRange || ptset->type == ElementList)) { - ndim = 2; - dim_vals[1]=dim_vals[0]; - dim_vals[0]=Idim; - if (cg->mode == MODE_MODIFY && ptset->link == 0 && - ptset->in_link == 0) { - int ierr; - ADF_Put_Dimension_Information(ptset->id, "I4", 2, dim_vals, &ierr); - if (ierr > 0) { - adf_error("ADF_Put_Dimension_Information", ierr); - return 1; - } - } - } - - /* verify that the name matches the type intended */ - if (ptset->type<0 || ptset->type>=NofValidPointSetTypes) { - cgi_error("Invalid point set type: '%s'",ptset->name); - return 1; - } - - /* Before version 1.27, PointListDonor could be I4, R4 or R8, otherwise data_type must be I4 */ - if (strcmp(ptset->data_type,"I4") && (ptset->type!=PointListDonor || - cg->version>1200)) { - cgi_error("Data type %s not supported for point set type %d", - ptset->data_type, ptset->type); - return 1; - } - - /* verify dimension vector */ - if (!(ndim==2 && dim_vals[0]>0 && dim_vals[1]>0)) { - cgi_error("Invalid definition of point set: ptset->type='%s', ndim=%d, dim_vals[0]=%d", - PointSetTypeName[ptset->type], ndim, dim_vals[0]); - return 1; - } - - /* npts */ - ptset->npts = dim_vals[1]; - - /* size_of_patch */ - if (ptset->type == PointList || ptset->type == ElementList || - ptset->type == PointListDonor) - ptset->size_of_patch = ptset->npts; - - else { - /* read points to calculate size_of_patch */ - int i, size=1, ierr; - int *pnts; - for (i=0; iname); - return 1; - } - if (strcmp(ptset->data_type,"I4")!=0) { - cgi_error("Invalid datatype for a range pointset"); - return 1; - } - pnts = CGNS_NEW(int, size); - ADF_Read_All_Data(ptset->id, (char *) pnts, &ierr); - if (ierr>0) { - adf_error("ADF_Read_All_Data",ierr); - return 1; - } - ptset->size_of_patch = 1; - for (i=0; isize_of_patch *= (pnts[i+Idim]-pnts[i]+1); - free(pnts); - } - return 0; -} - -int cgi_read_equations(int in_link, double parent_id, - cgns_equations **equations) { - double *id; - int n, nnod, ndim, dim_vals[12], linked; - char *string_data; - char_33 name, data_type; - - if (cgi_get_nodes(parent_id, "FlowEquationSet_t", &nnod, &id)) return 1; - if (nnod<=0) { - equations[0]=0; - return 0; - } - equations[0] = CGNS_NEW(cgns_equations, 1); - equations[0]->id = id[0]; - equations[0]->link = cgi_read_link(id[0]); - equations[0]->in_link = in_link; - linked = equations[0]->link ? 1 : in_link; - free(id); - strcpy(equations[0]->name, "FlowEquationSet"); - - /* GoverningEquations_t */ - equations[0]->governing = 0; - if (cgi_get_nodes(equations[0]->id, "GoverningEquations_t", &nnod, &id)) - return 1; - if (nnod>0) { - equations[0]->governing = CGNS_NEW(cgns_governing,1); - equations[0]->governing->id = id[0]; - equations[0]->governing->link = cgi_read_link(id[0]); - equations[0]->governing->in_link = linked; - if (cgi_read_string(id[0], equations[0]->governing->name, &string_data) || - cgi_GoverningEquationsType(string_data, &equations[0]->governing->type)) - return 1; - free(string_data); - free(id); - - /* initialize dependants */ - equations[0]->governing->diffusion_model=0; - - /* DiffusionModel */ - if (cgi_get_nodes(equations[0]->governing->id, - "\"int[1+...+IndexDimension]\"", &nnod, &id)) return 1; - if (nnod>0) { - if (cgi_read_node(id[0], name, data_type, &ndim, - &equations[0]->governing->dim_vals, - (void **)&equations[0]->governing->diffusion_model, READ_DATA)) { - cgi_error("Error reading diffusion model"); - return 1; - } - if (ndim!=1 || equations[0]->governing->dim_vals<=0 || - strcmp(data_type,"I4")) { - cgi_error("Diffusion Model '%s' defined incorrectly",name); - return 1; - } - free(id); - } - - /* Descriptor_t */ - if (cgi_get_nodes(equations[0]->governing->id, "Descriptor_t", - &equations[0]->governing->ndescr, &id)) return 1; - if (equations[0]->governing->ndescr>0) { - equations[0]->governing->descr = CGNS_NEW(cgns_descr, equations[0]->governing->ndescr); - for (n=0; ngoverning->ndescr; n++) { - equations[0]->governing->descr[n].id = id[n]; - equations[0]->governing->descr[n].link = cgi_read_link(id[n]); - equations[0]->governing->descr[n].in_link = linked; - if (cgi_read_string(id[n], equations[0]->governing->descr[n].name, - &equations[0]->governing->descr[n].text)) return 1; - } - free(id); - } - - /* UserDefinedData_t */ - if (cgi_read_user_data(linked, equations[0]->governing->id, - &equations[0]->governing->nuser_data, - &equations[0]->governing->user_data)) return 1; - } - - /* GasModel_t */ - if (cgi_read_model(linked, equations[0]->id, "GasModel_t", - &equations[0]->gas)) return 1; - - /* ViscosityModel_t */ - if (cgi_read_model(linked, equations[0]->id, "ViscosityModel_t", - &equations[0]->visc)) return 1; - - /* ThermalConductivityModel_t */ - if (cgi_read_model(linked, equations[0]->id, "ThermalConductivityModel_t", - &equations[0]->conduct)) return 1; - - /* TurbulenceClosure_t */ - if (cgi_read_model(linked, equations[0]->id, "TurbulenceClosure_t", - &equations[0]->closure)) return 1; - - /* TurbulenceModel_t */ - if (cgi_read_model(linked, equations[0]->id, "TurbulenceModel_t", - &equations[0]->turbulence)) return 1; - - /* initialize dependants */ - if (equations[0]->turbulence) { - equations[0]->turbulence->diffusion_model=0; - - /* DiffusionModel */ - if (cgi_get_nodes(equations[0]->turbulence->id, - "\"int[1+...+IndexDimension]\"", &nnod, &id)) return 1; - if (nnod>0) { - if (cgi_read_node(id[0], name, data_type, &ndim, - &equations[0]->turbulence->dim_vals, - (void **)&equations[0]->turbulence->diffusion_model, READ_DATA)) { - cgi_error("Error reading Turbulence Diffusion Model"); - return 1; - } - if (ndim!=1 || equations[0]->turbulence->dim_vals<=0 || strcmp(data_type,"I4")) { - cgi_error("Diffusion Model '%s' defined incorrectly",name); - return 1; - } - free(id); - } - } - - /* ThermalRelaxationModel_t */ - if (cgi_read_model(linked, equations[0]->id, "ThermalRelaxationModel_t", - &equations[0]->relaxation)) return 1; - - /* ChemicalKineticsModel_t */ - if (cgi_read_model(linked, equations[0]->id, "ChemicalKineticsModel_t", - &equations[0]->chemkin)) return 1; - - /* EquationDimension */ - equations[0]->equation_dim = 0; - if (cgi_get_nodes(equations[0]->id, "\"int\"", &nnod, &id)) return 1; - if (nnod>0) { - int *equ_dim; - - if (cgi_read_node(id[0], name, data_type, &ndim, dim_vals, - (void **)&equ_dim, READ_DATA)) { - cgi_error("Error reading base"); - return 1; - } - /* verify data */ - if (strcmp(name,"EquationDimension") || strcmp(data_type, "I4") || - ndim!=1 || dim_vals[0]!=1) { - cgi_error("Error reading equation dimension for Flow Equation Set"); - return 1; - } - equations[0]->equation_dim = equ_dim[0]; - free(equ_dim); - free(id); - } - - /* Descriptor_t, DataClass_t, DimensionalUnits_t */ - if (cgi_read_DDD(linked, equations[0]->id, &equations[0]->ndescr, - &equations[0]->descr, &equations[0]->data_class, &equations[0]->units)) - return 1; - - /* UserDefinedData_t */ - if (cgi_read_user_data(linked, equations[0]->id, &equations[0]->nuser_data, - &equations[0]->user_data)) return 1; - - return 0; -} - -int cgi_read_model(int in_link, double parent_id, char *label, - cgns_model **model) { - int n, nnod, linked; - double *id; - char *string_data; - - if (cgi_get_nodes(parent_id, label, &nnod, &id)) return 1; - - if (nnod<=0) { - model[0]=0; - return 0; - } - model[0] = CGNS_NEW(cgns_model,1); - model[0]->id = id[0]; - model[0]->link = cgi_read_link(id[0]); - model[0]->in_link = in_link; - linked = model[0]->link ? 1 : in_link; - free(id); - - /* Model Type */ - if (cgi_read_string(model[0]->id, model[0]->name, &string_data)) return 1; - if (cgi_ModelType(string_data, &model[0]->type)) return 1; - free(string_data); - - /* Descriptor_t, DataClass_t, DimensionalUnits_t */ - if (cgi_read_DDD(linked, model[0]->id, &model[0]->ndescr, - &model[0]->descr, &model[0]->data_class, &model[0]->units)) return 1; - - /* DataArray_t */ - if (cgi_get_nodes(model[0]->id, "DataArray_t", &model[0]->narrays, &id)) - return 1; - - if (model[0]->narrays>0) { - model[0]->array = CGNS_NEW(cgns_array, model[0]->narrays); - for (n=0; nnarrays; n++) { - model[0]->array[n].id = id[n]; - model[0]->array[n].link = cgi_read_link(id[n]); - model[0]->array[n].in_link = linked; - if (cgi_read_array(&model[0]->array[n],"Model_t", - model[0]->id)) return 1; - - /* verify data */ - if (model[0]->array[n].data_dim!=1 || - model[0]->array[n].dim_vals[0]!=1) { - cgi_error("Wrong data dimension in %s definition",model[0]->name); - return 1; - } - } - free(id); - } - - /* UserDefinedData_t */ - if (cgi_read_user_data(linked, model[0]->id, &model[0]->nuser_data, - &model[0]->user_data)) return 1; - - return 0; -} - -int cgi_read_state(int in_link, double parent_id, cgns_state **state) { - char_33 name; - int n, nnod, defined=0, ierr, linked; - double *id; - char *string_data; - - if (cgi_get_nodes(parent_id, "ReferenceState_t", &nnod, &id)) return 1; - if (nnod<=0) { - state[0]=0; - return 0; - } - state[0] = CGNS_NEW(cgns_state, 1); - state[0]->id=id[0]; - state[0]->link=cgi_read_link(id[0]); - state[0]->in_link=in_link; - linked = state[0]->link ? 1 : in_link; - free(id); - - /* Name */ - ADF_Get_Name(state[0]->id, state[0]->name, &ierr); - if (ierr>0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - - /* initialize dependents */ - state[0]->data_class = DataClassNull; - state[0]->StateDescription = 0; - state[0]->ndescr=0; - - /* Descriptor_t and ReferenceStateDescription */ - if (cgi_get_nodes(state[0]->id, "Descriptor_t", &nnod, &id)) return 1; - - if (nnod>0) { - - for (n=0; n0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - if (strcmp(name,"ReferenceStateDescription")) { - if (state[0]->ndescr==0) state[0]->descr = CGNS_NEW(cgns_descr, 1); - else state[0]->descr = CGNS_RENEW(cgns_descr, state[0]->ndescr+1, state[0]->descr); - - state[0]->descr[state[0]->ndescr].id = id[n]; - state[0]->descr[state[0]->ndescr].link = cgi_read_link(id[n]); - state[0]->descr[state[0]->ndescr].in_link = linked; - if (cgi_read_string(id[n], state[0]->descr[state[0]->ndescr].name, - &state[0]->descr[state[0]->ndescr].text)) return 1; - state[0]->ndescr++; - } else { - if (defined) { - cgi_error("Reference State node may only hold one ReferenceStateDescription"); - return 1; - } - state[0]->StateDescription= CGNS_NEW(cgns_descr, 1); - state[0]->StateDescription->id = id[n]; - state[0]->StateDescription->link = cgi_read_link(id[n]); - state[0]->StateDescription->in_link = linked; - if (cgi_read_string(id[n], state[0]->StateDescription->name, - &state[0]->StateDescription->text)) return 1; - defined ++; - } - } - free(id); - } - - /* DataClass_t */ - if (cgi_get_nodes(state[0]->id, "DataClass_t", &nnod, &id)) return 1; - if (nnod>0) { - if (cgi_read_string(id[0], name, &string_data)) return 1; - cgi_DataClass(string_data, &state[0]->data_class); - free(string_data); - free(id); - } - - /* DimensionalUnits_t */ - if (cgi_read_units(linked, state[0]->id, &state[0]->units)) return 1; - - - /* DataArray_t */ - if (cgi_get_nodes(state[0]->id, "DataArray_t", &state[0]->narrays, &id)) - return 1; - if (state[0]->narrays>0) { - state[0]->array = CGNS_NEW(cgns_array, state[0]->narrays); - for (n=0; nnarrays; n++) { - state[0]->array[n].id = id[n]; - state[0]->array[n].link = cgi_read_link(id[n]); - state[0]->array[n].in_link = linked; - if (cgi_read_array(&state[0]->array[n],"ReferenceState_t", - state[0]->id)) return 1; - - /* verify data */ - if (state[0]->array[n].data_dim!=1 || - state[0]->array[n].dim_vals[0]!=1) { - cgi_error("Wrong data dimension in Reference State definition"); - return 1; - } - } - free(id); - } - - /* UserDefinedData_t */ - if (cgi_read_user_data(linked, state[0]->id, &state[0]->nuser_data, - &state[0]->user_data)) return 1; - - return 0; -} - -int cgi_read_gravity(int in_link, double parent_id, cgns_gravity **gravity) { - int i, nnod, ierr, linked; - double *id; - char_33 temp_name; - - if (cgi_get_nodes(parent_id, "Gravity_t", &nnod, &id)) return 1; - if (nnod<=0) { - gravity[0]=0; - return 0; - } - gravity[0] = CGNS_NEW(cgns_gravity, 1); - gravity[0]->id=id[0]; - gravity[0]->link=cgi_read_link(id[0]); - gravity[0]->in_link=in_link; - linked = gravity[0]->link ? 1 : in_link; - free(id); - - /* Name */ - ADF_Get_Name(gravity[0]->id, gravity[0]->name, &ierr); - if (ierr>0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - - /* initialize dependents */ - gravity[0]->vector=0; - gravity[0]->narrays = 0; - - /* Descriptor_t, DataClass_t, DimensionalUnits_t */ - if (cgi_read_DDD(linked, gravity[0]->id, &gravity[0]->ndescr, - &gravity[0]->descr, &gravity[0]->data_class, &gravity[0]->units)) - return 1; - - /* DataArray_t: GravityVector */ - if (cgi_get_nodes(gravity[0]->id, "DataArray_t", &nnod, &id)) return 1; - for (i=0; i0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - - /* GravityVector */ - if (strcmp(temp_name,"GravityVector")==0) { - gravity[0]->vector = CGNS_NEW(cgns_array, 1); - gravity[0]->vector->id = id[i]; - gravity[0]->vector->link = cgi_read_link(id[i]); - gravity[0]->vector->in_link = linked; - if (cgi_read_array(gravity[0]->vector, "Gravity_t", - gravity[0]->id)) return 1; - gravity[0]->narrays = 1; - - /* check data */ - if (strcmp(gravity[0]->vector->data_type,"R4")) { - cgi_error("Datatype %s not supported for gravity vector",gravity[0]->vector->data_type); - return 1; - } - if (gravity[0]->vector->data_dim != 1 || gravity[0]->vector->dim_vals[0] != Pdim) { - cgi_error("Error exit: Gravity vector incorrectly dimensioned"); - return 1; - } - } - } /* loop through DataArray_t */ - if (nnod) free(id); - - /* check data */ - if (gravity[0]->vector == 0) { - cgi_error("Error exit: Gravity vector undefined in Gravity_t node"); - return 1; - } - - /* UserDefinedData_t */ - if (cgi_read_user_data(linked, gravity[0]->id, &gravity[0]->nuser_data, - &gravity[0]->user_data)) return 1; - - return 0; -} - -int cgi_read_axisym(int in_link, double parent_id, cgns_axisym **axisym) { - int i, nnod, ierr, linked, ref_point_flag=0, axis_flag=0; - double *id; - char_33 temp_name; - - if (cgi_get_nodes(parent_id, "Axisymmetry_t", &nnod, &id)) return 1; - if (nnod<=0) { - axisym[0]=0; - return 0; - } - if (Pdim !=2) { - cgi_error("Error: Axisymmetry_t can only be defined for 2D data model"); - return 1; - } - axisym[0] = CGNS_NEW(cgns_axisym, 1); - axisym[0]->id=id[0]; - axisym[0]->link=cgi_read_link(id[0]); - axisym[0]->in_link=in_link; - linked = axisym[0]->link ? 1 : in_link; - free(id); - - /* Name */ - ADF_Get_Name(axisym[0]->id, axisym[0]->name, &ierr); - if (ierr>0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - - /* initialize dependents */ - axisym[0]->narrays=0; - - /* Descriptor_t, DataClass_t, DimensionalUnits_t */ - if (cgi_read_DDD(linked, axisym[0]->id, &axisym[0]->ndescr, - &axisym[0]->descr, &axisym[0]->data_class, &axisym[0]->units)) - return 1; - - /* DataArray_t: - Required: AxisymmetryReferencePoint, AxisymmetryAxisVector - Optional: AxisymmetryAngle, CoordinateNames - */ - if (cgi_get_nodes(axisym[0]->id, "DataArray_t", &nnod, &id)) return 1; - if (nnod > 0) axisym[0]->array = CGNS_NEW(cgns_array, nnod); - - for (i=0; i0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - /* AxisymmetryReferencePoint & AxisymmetryAxisVector */ - if (strcmp(temp_name,"AxisymmetryReferencePoint")==0 || - strcmp(temp_name,"AxisymmetryAxisVector")==0) { - - if (strcmp(temp_name,"AxisymmetryReferencePoint")==0) ref_point_flag = 1; - else if (strcmp(temp_name,"AxisymmetryAxisVector")==0) axis_flag = 1; - - axisym[0]->array[axisym[0]->narrays].id = id[i]; - axisym[0]->array[axisym[0]->narrays].link = cgi_read_link(id[i]); - axisym[0]->array[axisym[0]->narrays].in_link = linked; - if (cgi_read_array(&axisym[0]->array[axisym[0]->narrays], - "Axisymmetry_t", axisym[0]->id)) return 1; - - /* check data */ - if (strcmp(axisym[0]->array[axisym[0]->narrays].data_type,"R4")) { - cgi_error("Error: Datatype %s not supported for %s", - axisym[0]->array[axisym[0]->narrays].data_type, temp_name); - return 1; - } - if (axisym[0]->array[axisym[0]->narrays].data_dim != 1 || - axisym[0]->array[axisym[0]->narrays].dim_vals[0] != Pdim) { - cgi_error("Error: %s incorrectly dimensioned",temp_name); - return 1; - } - axisym[0]->narrays ++; - } - /* AxisymmetryAngle */ - else if (strcmp(temp_name,"AxisymmetryAngle")==0) { - axisym[0]->array[axisym[0]->narrays].id = id[i]; - axisym[0]->array[axisym[0]->narrays].link = cgi_read_link(id[i]); - axisym[0]->array[axisym[0]->narrays].in_link = linked; - if (cgi_read_array(&axisym[0]->array[axisym[0]->narrays], - "Axisymmetry_t", axisym[0]->id)) return 1; - - /* check data */ - if (strcmp(axisym[0]->array[axisym[0]->narrays].data_type,"R4")) { - cgi_error("Error: Datatype %s not supported for %s", - axisym[0]->array[axisym[0]->narrays].data_type, temp_name); - return 1; - } - if (axisym[0]->array[axisym[0]->narrays].data_dim != 1 || - axisym[0]->array[axisym[0]->narrays].dim_vals[0] != 1) { - cgi_error("Error: %s incorrectly dimensioned",temp_name); - return 1; - } - axisym[0]->narrays ++; - } - /* CoordinateNames */ - else if (strcmp(temp_name,"CoordinateNames")==0) { - axisym[0]->array[axisym[0]->narrays].id = id[i]; - axisym[0]->array[axisym[0]->narrays].link = cgi_read_link(id[i]); - axisym[0]->array[axisym[0]->narrays].in_link = linked; - if (cgi_read_array(&axisym[0]->array[axisym[0]->narrays], - "Axisymmetry_t", axisym[0]->id)) return 1; - - /* check data */ - if (strcmp(axisym[0]->array[axisym[0]->narrays].data_type,"C1")) { - cgi_error("Error: Datatype %s not supported for %s", - axisym[0]->array[axisym[0]->narrays].data_type, temp_name); - return 1; - } - if (axisym[0]->array[axisym[0]->narrays].data_dim != 2 || - axisym[0]->array[axisym[0]->narrays].dim_vals[0] != 32 || - axisym[0]->array[axisym[0]->narrays].dim_vals[1] != 2) { - cgi_error("Error: %s incorrectly dimensioned",temp_name); - return 1; - } - axisym[0]->narrays ++; - } - } /* loop through DataArray_t */ - if (nnod) free(id); - - /* check data */ - if (!ref_point_flag || !axis_flag) { - cgi_error("Error: AxisymmetryReferencePoint & AxisymmetryAxisVector are required"); - return 1; - } - - /* UserDefinedData_t */ - if (cgi_read_user_data(linked, axisym[0]->id, &axisym[0]->nuser_data, - &axisym[0]->user_data)) return 1; - - return 0; -} - -int cgi_read_rotating(int in_link, double parent_id, cgns_rotating **rotating) { - int i, nnod, ierr, linked, rot_rate_flag=0, rot_center_flag=0; - double *id; - char_33 temp_name; - - if (cgi_get_nodes(parent_id, "RotatingCoordinates_t", &nnod, &id)) return 1; - if (nnod<=0) { - rotating[0]=0; - return 0; - } - rotating[0] = CGNS_NEW(cgns_rotating, 1); - rotating[0]->id=id[0]; - rotating[0]->link=cgi_read_link(id[0]); - rotating[0]->in_link=in_link; - linked = rotating[0]->link ? 1 : in_link; - free(id); - - /* Name */ - ADF_Get_Name(rotating[0]->id, rotating[0]->name, &ierr); - if (ierr>0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - - /* initialize dependents */ - rotating[0]->narrays=0; - - /* Descriptor_t, DataClass_t, DimensionalUnits_t */ - if (cgi_read_DDD(linked, rotating[0]->id, &rotating[0]->ndescr, - &rotating[0]->descr, &rotating[0]->data_class, &rotating[0]->units)) - return 1; - - /* DataArray_t: - Required: RotationCenter, RotationRateVector - Optional: none - */ - if (cgi_get_nodes(rotating[0]->id, "DataArray_t", &nnod, &id)) return 1; - if (nnod > 0) rotating[0]->array = CGNS_NEW(cgns_array, nnod); - - for (i=0; i0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - /* RotationCenter, RotationRateVector */ - if (strcmp(temp_name,"RotationCenter")==0 || - strcmp(temp_name,"RotationRateVector")==0) { - - if (strcmp(temp_name,"RotationCenter")==0) rot_center_flag = 1; - else if (strcmp(temp_name,"RotationRateVector")==0) rot_rate_flag = 1; - - rotating[0]->array[rotating[0]->narrays].id = id[i]; - rotating[0]->array[rotating[0]->narrays].link = cgi_read_link(id[i]); - rotating[0]->array[rotating[0]->narrays].in_link = linked; - if (cgi_read_array(&rotating[0]->array[rotating[0]->narrays], - "RotatingCoordinates_t", rotating[0]->id)) return 1; - - /* check data */ - if (strcmp(rotating[0]->array[rotating[0]->narrays].data_type,"R4")) { - cgi_error("Error: Datatype %s not supported for %s", - rotating[0]->array[rotating[0]->narrays].data_type, temp_name); - return 1; - } - if (rotating[0]->array[rotating[0]->narrays].data_dim != 1 || - rotating[0]->array[rotating[0]->narrays].dim_vals[0] != Pdim) { - cgi_error("Error: %s incorrectly dimensioned",temp_name); - return 1; - } - rotating[0]->narrays ++; - } - } /* loop through DataArray_t */ - if (nnod) free(id); - - /* check data */ - if (!rot_rate_flag || !rot_center_flag) { - cgi_error("Error: RotationCenter & RotationRateVector are required"); - return 1; - } - - /* UserDefinedData_t */ - if (cgi_read_user_data(linked, rotating[0]->id, &rotating[0]->nuser_data, - &rotating[0]->user_data)) return 1; - - return 0; -} - -int cgi_read_converg(int in_link, double parent_id, cgns_converg **converg) { - char_33 data_type, name; - int ndim, dim_vals[12], n, nnod; - double *id; - char *string_data; - int *iterations; - int nnorm=0, linked; - - if (cgi_get_nodes(parent_id, "ConvergenceHistory_t", &nnod, &id)) return 1; - if (nnod<=0) { - converg[0]=0; - return 0; - } - converg[0] = CGNS_NEW(cgns_converg, 1); - converg[0]->id = id[0]; - converg[0]->link = cgi_read_link(id[0]); - converg[0]->in_link = in_link; - linked = converg[0]->link ? 1 : in_link; - free(id); - - if (cgi_read_node(converg[0]->id, converg[0]->name, data_type, &ndim, - dim_vals, (void **)&iterations, READ_DATA)) { - cgi_error("Error reading Convergence History node"); - return 1; - } - /* verify data: Temporarily commented and replaced by 4 lines below - if (strcmp(data_type,"I4") || ndim!=1 || dim_vals[0]!=1) { - cgi_error("ConvergenceHistory_t node '%s' incorrect",converg[0]->name); - return 1; - } - converg[0]->iterations = iterations[0]; - free(iterations); - */ - /* The check was removed because Bob was storing other type of data - at the level. This is a temporary changed */ - if (strcmp(data_type,"I4")==0 && dim_vals[0]>=1) { - converg[0]->iterations = iterations[0]; - free(iterations); - } else converg[0]->iterations=0; - - /* initialize dependents */ - converg[0]->data_class = DataClassNull; - converg[0]->NormDefinitions = 0; - converg[0]->ndescr=0; - - /* Descriptor_t and NormDefinitions */ - if (cgi_get_nodes(converg[0]->id, "Descriptor_t", &nnod, &id)) return 1; - - if (nnod>0) { - for (n=0; n0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - if (strcmp(name,"NormDefinitions")) { - if (converg[0]->ndescr==0) converg[0]->descr = CGNS_NEW(cgns_descr, 1); - else converg[0]->descr=CGNS_RENEW(cgns_descr,converg[0]->ndescr+1,converg[0]->descr); - converg[0]->descr[converg[0]->ndescr].id = id[n]; - converg[0]->descr[converg[0]->ndescr].link = cgi_read_link(id[n]); - converg[0]->descr[converg[0]->ndescr].in_link = linked; - if (cgi_read_string(id[n], converg[0]->descr[converg[0]->ndescr].name, - &converg[0]->descr[converg[0]->ndescr].text)) return 1; - converg[0]->ndescr++; - } else { - if (nnorm) { - cgi_error("Convergence History may only hold one NormDefinitions Node"); - return 1; - } - converg[0]->NormDefinitions = CGNS_NEW(cgns_descr, 1); - converg[0]->NormDefinitions->id = id[n]; - converg[0]->NormDefinitions->link = cgi_read_link(id[n]); - converg[0]->NormDefinitions->in_link = linked; - if (cgi_read_string(id[n], converg[0]->NormDefinitions->name, - &converg[0]->NormDefinitions->text)) return 1; - nnorm ++; - } - } - free(id); - } - - /* DataClass_t */ - if (cgi_get_nodes(converg[0]->id, "DataClass_t", &nnod, &id)) return 1; - if (nnod>0) { - if (cgi_read_string(id[0], name, &string_data)) return 1; - cgi_DataClass(string_data, &converg[0]->data_class); - free(string_data); - free(id); - } - - /* DimensionalUnits_t */ - if (cgi_read_units(linked, converg[0]->id, &converg[0]->units)) return 1; - - /* DataArray_t */ - if (cgi_get_nodes(converg[0]->id, "DataArray_t", &converg[0]->narrays, &id)) - return 1; - if (converg[0]->narrays>0) { - converg[0]->array = CGNS_NEW(cgns_array, converg[0]->narrays); - for (n=0; nnarrays; n++) { - converg[0]->array[n].id = id[n]; - converg[0]->array[n].link = cgi_read_link(id[n]); - converg[0]->array[n].in_link = linked; - if (cgi_read_array(&converg[0]->array[n],"ConvergenceHistory_t", - converg[0]->id)) return 1; - - /* verify data : Temporiraly commented for Bob Bush - if (converg[0]->array[n].data_dim!=1) { - cgi_error("Wrong nr of dimension in Conversion History definition"); - return 1; - } - */ - } - free(id); - } - - /* UserDefinedData_t */ - if (cgi_read_user_data(linked, converg[0]->id, &converg[0]->nuser_data, - &converg[0]->user_data)) return 1; - - return 0; -} - -int cgi_read_discrete(int in_link, double parent_id, int *ndiscrete, - cgns_discrete **discrete) { - double *id, *idi; - int n, i, ierr, j, DataSize[3], linked; - - if (cgi_get_nodes(parent_id, "DiscreteData_t", ndiscrete, &id)) return 1; - if (*ndiscrete<=0) { - discrete[0] = 0; - return 0; - } - - discrete[0] = CGNS_NEW(cgns_discrete, (*ndiscrete)); - for (n=0; n<(*ndiscrete); n++) { - discrete[0][n].id = id[n]; - discrete[0][n].link = cgi_read_link(id[n]); - discrete[0][n].in_link = in_link; - linked = discrete[0][n].link ? 1 : in_link; - - /* name of node */ - ADF_Get_Name(id[n], discrete[0][n].name, &ierr); - if (ierr>0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - - /* Descriptor_t, DataClass_t, DimensionalUnits_t */ - if (cgi_read_DDD(linked, id[n], &discrete[0][n].ndescr, - &discrete[0][n].descr, &discrete[0][n].data_class, - &discrete[0][n].units)) return 1; - - /* GridLocation_t */ - if (cgi_read_location(discrete[0][n].id, discrete[0][n].name, - &discrete[0][n].location)) return 1; - - /* Rind Planes */ - if (cgi_read_rind(discrete[0][n].id, &discrete[0][n].rind_planes)) - return 1; - - /* Determine data size */ - if (cgi_datasize(Idim, CurrentDim, discrete[0][n].location, - discrete[0][n].rind_planes, DataSize)) return 1; - - /* DataArray_t */ - if (cgi_get_nodes(discrete[0][n].id, "DataArray_t", - &discrete[0][n].narrays, &idi)) return 1; - if (discrete[0][n].narrays>0) { - discrete[0][n].array = CGNS_NEW(cgns_array, discrete[0][n].narrays); - for (i=0; i0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - - /* Descriptor_t, DataClass_t, DimensionalUnits_t */ - if (cgi_read_DDD(linked, id[n], &integral[0][n].ndescr, - &integral[0][n].descr, &integral[0][n].data_class, - &integral[0][n].units)) return 1; - - /* DataArray_t */ - if (cgi_get_nodes(id[n], "DataArray_t", &integral[0][n].narrays, &idi)) - return 1; - if (integral[0][n].narrays>0) { - integral[0][n].array = CGNS_NEW(cgns_array, integral[0][n].narrays); - for (i=0; iname)==0 || - strcmp("RigidRotationAngle",array->name)==0 || - strcmp("RigidVelocity" ,array->name)==0 || - strcmp("RigidRotationRate" ,array->name)==0) { - if (strcmp(array->data_type,"R4") && strcmp(array->data_type,"R8")) { - cgi_error("Wrong data type for %s",array->name); - return 1; - } - if ((strcmp("OriginLocation",array->name)==0 && array->data_dim!=2) || - (strcmp("OriginLocation",array->name) && array->data_dim!=1) || - array->dim_vals[0]!=Pdim || - (strcmp("OriginLocation",array->name)==0 && array->dim_vals[1]!=2)) { - cgi_error("Wrong data dimension in '%s' definition",array->name); - return 1; - } - } - } /* loop through DataArray_t */ - for (i=0; i0) { - amotion[0][n].array = CGNS_NEW(cgns_array, amotion[0][n].narrays); - for (i=0; ilink ? 1 : array->in_link; - - /* These data arrays are not loaded in memory, just their addresses */ - if (strcmp(parent_label,"GridCoordinates_t")==0 || - strcmp(parent_label,"FlowSolution_t")==0 || - strcmp(parent_label,"DiscreteData_t")==0) { - data_flag=SKIP_DATA; - array->data=0; - } - if (cgi_read_node(array->id, array->name, array->data_type, - &array->data_dim, array->dim_vals, &array->data, data_flag)) { - cgi_error("Error reading array under %s",parent_label); - return 1; - } - - /* Descriptor_t, DataClass_t, DimensionalUnits_t */ - if (cgi_read_DDD(linked, array->id, &array->ndescr, &array->descr, - &array->data_class, &array->units)) return 1; - - /* DataConversion_t */ - if (cgi_read_conversion(linked, array->id, &array->convert)) return 1; - - /* DimensionalExponents_t */ - if (cgi_read_exponents(linked, array->id, &array->exponents)) return 1; - - return 0; -} - -int cgi_read_conversion(int in_link, double parent_id, cgns_conversion **convert) { - int nnod, ndim, dim_vals[12]; - double *id; - - if (cgi_get_nodes(parent_id, "DataConversion_t", &nnod, &id)) return 1; - if (nnod<=0) { - convert[0]=0; - return 0; - } - convert[0] = CGNS_NEW(cgns_conversion, 1); - convert[0]->id = id[0]; - convert[0]->link = cgi_read_link(id[0]); - convert[0]->in_link = in_link; - free(id); - - if (cgi_read_node(convert[0]->id, convert[0]->name, convert[0]->data_type, - &ndim, dim_vals, &convert[0]->data, READ_DATA)) { - cgi_error("Error reading '%s'",convert[0]->name); - return 1; - } - if (strcmp(convert[0]->data_type,"R4") && strcmp(convert[0]->data_type,"R8")) { - cgi_error("Wrong Data Type in '%s'",convert[0]->name); - return 1; - } - if (ndim!=1 || dim_vals[0]!=2) { - cgi_error("Wrong dimensions in '%s'",convert[0]->name); - return 1; - } - return 0; -} - -int cgi_read_exponents(int in_link, double parent_id, cgns_exponent **exponents) { - int nnod, ndim, dim_vals[12]; - double *id; - - if (cgi_get_nodes(parent_id, "DimensionalExponents_t", &nnod, &id)) return 1; - if (nnod<=0) { - exponents[0]=0; - return 0; - } - exponents[0] = CGNS_NEW(cgns_exponent, 1); - exponents[0]->id = id[0]; - exponents[0]->link = cgi_read_link(id[0]); - exponents[0]->in_link = in_link; - free(id); - - if (cgi_read_node(exponents[0]->id, exponents[0]->name, exponents[0]->data_type, - &ndim, dim_vals, &exponents[0]->data, READ_DATA)) { - cgi_error("Error reading '%s'",exponents[0]->name); - return 1; - } - if (strcmp(exponents[0]->data_type,"R4") && strcmp(exponents[0]->data_type,"R8")) { - cgi_error("Wrong Data Type in '%s'",exponents[0]->name); - return 1; - } - if (ndim!=1 || dim_vals[0]!=5) { - cgi_error("Wrong dimensions in '%s'",exponents[0]->name); - return 1; - } -/* The following was replaced by a 5 element array: exponents[0]->data - if (strcmp(data_type,"R4")==0) { - *((float*)exponents[0]-> MassExponent)=*((float*)data+0); - *((float*)exponents[0]-> LengthExponent)=*((float*)data+1); - *((float*)exponents[0]-> TimeExponent)=*((float*)data+2); - *((float*)exponents[0]->TemperatureExponent)=*((float*)data+3); - *((float*)exponents[0]-> AngleExponent)=*((float*)data+4); - } else { - *((double*)exponents[0]-> MassExponent)=*((double*)data+0); - *((double*)exponents[0]-> LengthExponent)=*((double*)data+1); - *((double*)exponents[0]-> TimeExponent)=*((double*)data+2); - *((double*)exponents[0]->TemperatureExponent)=*((double*)data+3); - *((double*)exponents[0]-> AngleExponent)=*((double*)data+4); - } -*/ - return 0; -} - -int cgi_read_units(int in_link, double parent_id, cgns_units **units) { - - char_33 mass_name, len_name, time_name, temp_name, angle_name; - char *string_data; - double *id; - int n, nnod; - - if (cgi_get_nodes(parent_id, "DimensionalUnits_t", &nnod, &id)) return 1; - if (nnod<=0) { - units[0]=0; - return 0; - } - units[0] = CGNS_NEW(cgns_units, 1); - units[0]->id = id[0]; - units[0]->link = cgi_read_link(id[0]); - units[0]->in_link = in_link; - free(id); - - if (cgi_read_string(units[0]->id, units[0]->name, &string_data)) return 1; - if (strlen(string_data) != 32*5) { - cgi_error("Dimensional Units defined incorrectly."); - return 1; - } - - /* Extract Units */ - for (n=0; n<32; n++) { - mass_name[n]=string_data[n]; - len_name[n]=string_data[n+32]; - time_name[n]=string_data[n+64]; - temp_name[n]=string_data[n+96]; - angle_name[n]=string_data[n+128]; - } - mass_name[32]=len_name[32]=time_name[32]=temp_name[32]=angle_name[32]='\0'; - - cgi_MassUnits(mass_name, &units[0]->mass); - cgi_LengthUnits(len_name, &units[0]->length); - cgi_TimeUnits(time_name, &units[0]->time); - cgi_TemperatureUnits(temp_name, &units[0]->temperature); - cgi_AngleUnits(angle_name, &units[0]->angle); - - free(string_data); - - return 0; -} - -int cgi_read_string(double id, char_33 name, char **string_data) { - int n, ndim, length[2], len=1; - char_33 data_type; - - if (cgi_read_node(id, name, data_type, &ndim, length, (void **)string_data, READ_DATA)) { - cgi_error("Error reading string"); - return 1; - } - /* verify dimensions */ - if (strcmp(data_type,"C1")!=0) { - cgi_error("Invalid datatype for character data: %s",data_type); - return 1; - } - /* add the string terminator */ - for (n=0; n0) { - descr[0] = CGNS_NEW(cgns_descr, (*ndescr)); - for (n=0; n<(*ndescr); n++) { - descr[0][n].id = id[n]; - descr[0][n].link = cgi_read_link(id[n]); - descr[0][n].in_link = in_link; - if (cgi_read_string(id[n], descr[0][n].name, - &descr[0][n].text)) return 1; - } - free(id); - } - - /* DataClass_t */ - *data_class = DataClassNull; - if (cgi_get_nodes(parent_id, "DataClass_t", &nnod, &id)) return 1; - if (nnod>0) { - if (cgi_read_string(id[0], name, &string_data)) return 1; - cgi_DataClass(string_data, data_class); - free(string_data); - free(id); - } - - /* DimensionalUnits_t */ - if (cgi_read_units(in_link, parent_id, units)) return 1; - return 0; -} - -int cgi_read_ordinal(double parent_id, int *ordinal) { - int nnod; - double *id; - char_33 name, data_type; - int ndim, dim_vals[12]; - void *ordinal_data; - - if (cgi_get_nodes(parent_id, "Ordinal_t", &nnod, &id)) return 1; - if (nnod<=0) { - (*ordinal)=0; - return 0; - } - if (cgi_read_node(id[0], name, data_type, &ndim, dim_vals, - &ordinal_data, READ_DATA)) { - cgi_error("Error reading Rind Planes"); - return 1; - } - if (ndim!=1 || dim_vals[0]!=1 || strcmp(data_type,"I4")) { - cgi_error("Ordinal '%s' defined incorrectly",name); - return 1; - } - free(id); - (*ordinal)=*(int *)ordinal_data; - free(ordinal_data); - return 0; -} - -int cgi_read_rind(double parent_id, int **rind_planes) { - int n, nnod; - double *id; - char_33 name, data_type; - int ndim, dim_vals[12]; - - if (cgi_get_nodes(parent_id, "Rind_t", &nnod, &id)) return 1; - if (nnod<=0) { - rind_planes[0] = (int *) malloc (2*Idim*sizeof(int)); - if (!rind_planes[0]) { - cgi_error("Error allocating rind_planes."); - return 1; - } - for (n=0; n<2*Idim; n++) rind_planes[0][n]=0; - return 0; - } - - if (cgi_read_node(id[0], name, data_type, &ndim, dim_vals, - (void **)rind_planes, READ_DATA)) { - cgi_error("Error reading Rind Planes"); - return 1; - } - if (ndim!=1 || dim_vals[0]!=2*Idim || strcmp(data_type,"I4")) { - cgi_error("Rind Planes '%s' defined incorrectly",name); - return 1; - } - if (CurrentZoneType == Unstructured && (rind_planes[0]!=0 || rind_planes[1]!=0)) { - cgi_error("Rind planes are not supported for unstructured meshes."); - return 1; - } - free(id); - return 0; -} - -int cgi_read_location(double parent_id, char_33 parent_name, GridLocation_t *location) { - int nGL_t; - double *id; - char *location_name; /* allocated in cgi_read_node */ - char_33 name; - - /* get number of GridLocation_t nodes and their ADF_ID */ - if (cgi_get_nodes(parent_id, "GridLocation_t", &nGL_t, &id)) return 1; - - if (nGL_t==0) { - *location = Vertex; - } else if (nGL_t<0 || nGL_t >1) { - cgi_error("Invalid definition of GridLocation for %s",parent_name); - return 1; - } else if (nGL_t==1) { - - /* Read the grid location value in the GridLocation_t node */ - if (cgi_read_string(id[0], name, &location_name)) return 1; - free(id); - - if (cgi_GridLocation(location_name, location)) return 1; - free(location_name); - - } - return 0; -} - -int cgi_read_zonetype(double parent_id, char_33 parent_name, ZoneType_t *type) { - int nchild; - double *id; - char *zonetype_name; /* allocated in cgi_read_node */ - char_33 name; - - /* get number of ZoneType_t nodes and their ADF_ID */ - if (cgi_get_nodes(parent_id, "ZoneType_t", &nchild, &id)) return 1; - if (nchild==0) { - /* set default */ - *type = Structured; - return 0; - } - - if (nchild >1) { - cgi_error("Invalid definition of ZoneType for %s",parent_name); - return 1; - } - - if (cgi_read_string(id[0], name, &zonetype_name)) return 1; - free(id); - - if (cgi_ZoneType(zonetype_name, type)) return 1; - free(zonetype_name); - return 0; -} - -int cgi_read_simulation(double parent_id, SimulationType_t *type, - double *type_id) { - int nchild; - double *id; - char *type_name; /* allocated in cgi_read_node */ - char_33 name; - - /* initialize */ - *type = SimulationTypeNull; - *type_id = 0; - - /* get number of SimulationType_t nodes and their ADF_ID */ - if (cgi_get_nodes(parent_id, "SimulationType_t", &nchild, &id)) return 1; - if (nchild==0) return 0; - if (nchild >1) { - cgi_error("File incorrect: multiple definition of SimulationType"); - return 1; - } - *type_id = id[0]; - if (cgi_read_string(id[0], name, &type_name)) return 1; - free(id); - - if (cgi_SimulationType(type_name, type)) return 1; - free(type_name); - return 0; -} - -int cgi_read_biter(int in_link, double parent_id, cgns_biter **biter) { - double *id; - char_33 datatype; - cgns_array *array; - int ndim, dim_vals[12], *data, nnod; - int i, linked; - int nzones_max = 0, nfamilies_max = 0; - - /* get number of BaseIterativeData_t node */ - if (cgi_get_nodes(parent_id, "BaseIterativeData_t", &nnod, &id)) return 1; - if (nnod<=0) { - biter[0]=0; - return 0; - } else if (nnod>1) { - cgi_error("Error: Multiple BaseIterativeData_t found..."); - return 1; - } - - biter[0] = CGNS_NEW(cgns_biter, 1); - - biter[0]->id = id[0]; - biter[0]->link = cgi_read_link(id[0]); - biter[0]->in_link = in_link; - linked = biter[0]->link ? 1 : in_link; - free(id); - - /* Descriptor_t, DataClass_t, DimensionalUnits_t */ - if (cgi_read_DDD(linked, biter[0]->id, &biter[0]->ndescr, &biter[0]->descr, - &biter[0]->data_class, &biter[0]->units)) return 1; - - /* Name and NumberOfSteps */ - NumberOfSteps = biter[0]->nsteps = 0; - if (cgi_read_node(biter[0]->id, biter[0]->name, datatype, &ndim, - dim_vals, (void **)&data, READ_DATA)) { - cgi_error("Error reading BaseIterativeData_t"); - return 1; - } - if (ndim!=1 || dim_vals[0]!=1 || strcmp(datatype,"I4")) { - cgi_error("Error in data dimension or type for NumberOfSteps"); - return 1; - } - if (data[0]<0) { - cgi_error("Error in data: NumberOfSteps<0!"); - return 1; - } - NumberOfSteps = biter[0]->nsteps = data[0]; - if (biter[0]->nsteps == 0) return 0; - free(data); - - /* UserDefinedData_t */ - if (cgi_read_user_data(linked, biter[0]->id, &biter[0]->nuser_data, - &biter[0]->user_data)) return 1; - - /* DataArray_t */ - if (cgi_get_nodes(biter[0]->id, "DataArray_t", &biter[0]->narrays, &id)) - return 1; - if (biter[0]->narrays == 0) return 0; /* If no arrays we're done. */ - biter[0]->array = CGNS_NEW(cgns_array, biter[0]->narrays); - - for (i=0; i<(biter[0]->narrays); i++) { - biter[0]->array[i].id = id[i]; - biter[0]->array[i].link = cgi_read_link(id[i]); - biter[0]->array[i].in_link = linked; - if (cgi_read_array(&biter[0]->array[i], "BaseIterativeData_t", - biter[0]->id)) return 1; - array = &biter[0]->array[i]; - - /* check data */ - if (strcmp("TimeValues",array->name)==0 || - strcmp("IterationValues",array->name)==0 || - strcmp("NumberOfZones",array->name)==0 || - strcmp("NumberOfFamilies",array->name)==0) { - if (array->data_dim!=1 || array->dim_vals[0]!=biter[0]->nsteps) { - cgi_error("Error: Array '%s' incorrectly sized",array->name); - return 1; - } - if ((strcmp("TimeValues",array->name)==0 && strcmp(array->data_type,"R4") && - strcmp(array->data_type,"R8")) || - (strcmp("IterationValues",array->name)==0 && strcmp(array->data_type,"I4"))) { - cgi_error("Incorrect data type for %s under %s",array->name,biter[0]->name); - return 1; - } - } - } /* loop through arrays */ - - free(id); - - /* check data: verify that at least one of {TimeValues or IterationValues} is defined */ - for (i=0; i<(biter[0]->narrays); i++) { - array = &biter[0]->array[i]; - if (strcmp("TimeValues",array->name)==0 || strcmp("IterationValues",array->name)==0) break; - if (i == ((biter[0]->narrays)-1)) { - cgi_error("Error: TimeValues or IterationValues must be defined for '%s'",biter[0]->name); - return 1; - } - } - - /* check data: Compute nzones_max and nfamilies_max */ - for (i=0; i<(biter[0]->narrays); i++) { - int step; - array = &biter[0]->array[i]; - if (strcmp("NumberOfZones",array->name)==0) { - for (step=0; stepnsteps; step++) { - int nzones = *((int *)(array->data)+step); - nzones_max = MAX(nzones_max, nzones); - } - } else if (strcmp("NumberOfFamilies",array->name)==0) { - for (step=0; stepnsteps; step++) { - int nfamilies = *((int *)(array->data)+step); - nfamilies_max = MAX(nfamilies_max, nfamilies); - } - } - } - - /* check data: ZonePointers can't be defined without NumberOfZones and - FamilyPointers can't be defined without NumberOfFamilies */ - for (i=0; i<(biter[0]->narrays); i++) { - array = &biter[0]->array[i]; - if (strcmp("ZonePointers",array->name)==0) { - if (nzones_max==0) { - cgi_error("NumberofZones (DataArray_t) missing under %s",biter[0]->name); - return 1; - } else { /* check dimensions and data type */ - if (array->data_dim!=3 || array->dim_vals[0]!=32 || array->dim_vals[1]!=nzones_max || - array->dim_vals[2]!=biter[0]->nsteps || strcmp(array->data_type,"C1")) { - cgi_error("Incorrect definition of ZonePointers under %s",biter[0]->name); - return 1; - } - } - } else if (strcmp("FamilyPointers",array->name)==0) { - if (nfamilies_max==0) { - cgi_error("NumberOfFamilies (DataArray_t) missing under %s",biter[0]->name); - return 1; - } else { /* check dimensions and data type */ - if (array->data_dim!=3 || array->dim_vals[0]!=32 || array->dim_vals[1]!=nfamilies_max || - array->dim_vals[2]!=biter[0]->nsteps || strcmp(array->data_type,"C1")) { - cgi_error("Incorrect definition of FamilyPointers under %s",biter[0]->name); - return 1; - } - } - } - } - return 0; -} - -int cgi_read_ziter(int in_link, double parent_id, cgns_ziter **ziter) { - double *id; - cgns_array *array; - char_33 datatype; - int ndim, dim_vals[12], nnod; - void *data; - int i, linked; - - /* get number of ZoneIterativeData_t node */ - if (cgi_get_nodes(parent_id, "ZoneIterativeData_t", &nnod, &id)) return 1; - if (nnod<=0) { - ziter[0]=0; - return 0; - } else if (nnod>1) { - cgi_error("Error: Multiple ZoneIterativeData_t found..."); - return 1; - } - ziter[0] = CGNS_NEW(cgns_ziter, 1); - ziter[0]->id = id[0]; - ziter[0]->link = cgi_read_link(id[0]); - ziter[0]->in_link = in_link; - linked = ziter[0]->link ? 1 : in_link; - free(id); - - /* Name */ - if (cgi_read_node(ziter[0]->id, ziter[0]->name, datatype, &ndim, - dim_vals, &data, READ_DATA)) { - cgi_error("Error reading ZoneIterativeData_t"); - return 1; - } - if (strcmp(datatype,"MT")) { - cgi_error("Error in ZoneIterativeData_t node"); - return 1; - } - - /* Descriptor_t, DataClass_t, DimensionalUnits_t */ - if (cgi_read_DDD(linked, ziter[0]->id, &ziter[0]->ndescr, &ziter[0]->descr, - &ziter[0]->data_class, &ziter[0]->units)) return 1; - - /* UserDefinedData_t */ - if (cgi_read_user_data(linked, ziter[0]->id, &ziter[0]->nuser_data, - &ziter[0]->user_data)) return 1; - - /* DataArray_t */ - if (cgi_get_nodes(ziter[0]->id, "DataArray_t", &ziter[0]->narrays, &id)) - return 1; - if (ziter[0]->narrays==0) return 0; /* If no arrays we're done. */ - ziter[0]->array = CGNS_NEW(cgns_array,ziter[0]->narrays); - - for (i=0; i<(ziter[0]->narrays); i++) { - ziter[0]->array[i].id = id[i]; - ziter[0]->array[i].link = cgi_read_link(id[i]); - ziter[0]->array[i].in_link = linked; - if (cgi_read_array(&ziter[0]->array[i], "ZoneIterativeData_t", - ziter[0]->id)) return 1; - array = &ziter[0]->array[i]; - - /* check data */ - if (strcmp("RigidGridMotionPointers",array->name)==0 || - strcmp("ArbitraryGridMotionPointers",array->name)==0 || - strcmp("GridCoordinatesPointers",array->name)==0 || - strcmp("FlowSolutionPointers",array->name)==0) { - if (array->data_dim!=2 || array->dim_vals[0]!=32 || - array->dim_vals[1]!=NumberOfSteps) { - cgi_error("Error: Array '%s/%s' incorrectly sized", ziter[0]->name, array->name); - return 1; - } - if (strcmp(array->data_type,"C1")) { - cgi_error("Incorrect data type for %s under %s",array->name,ziter[0]->name); - return 1; - } - } - } /* loop through arrays */ - free(id); - - return 0; -} - -int cgi_read_user_data(int in_link, double parent_id, int *nuser_data, - cgns_user_data **user_data) { - double *id, *idi; - int n, i, ierr, linked; - - if (cgi_get_nodes(parent_id, "UserDefinedData_t", nuser_data, &id)) - return 1; - if (*nuser_data<=0) { - user_data[0] = 0; - return 0; - } - - user_data[0] = CGNS_NEW(cgns_user_data, (*nuser_data)); - for (n=0; n<(*nuser_data); n++) { - user_data[0][n].id = id[n]; - user_data[0][n].link = cgi_read_link(id[n]); - user_data[0][n].in_link = in_link; - linked = user_data[0][n].link ? 1 : in_link; - - /* UserDefinedData_t Name */ - ADF_Get_Name(user_data[0][n].id, user_data[0][n].name, &ierr); - if (ierr>0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - - /* Descriptor_t, DataClass_t, DimensionalUnits_t */ - if (cgi_read_DDD(linked, id[n], &user_data[0][n].ndescr, - &user_data[0][n].descr, &user_data[0][n].data_class, - &user_data[0][n].units)) return 1; - - /* DataArray_t */ - if (cgi_get_nodes(id[n], "DataArray_t", &user_data[0][n].narrays, - &idi)) return 1; - if (user_data[0][n].narrays>0) { - user_data[0][n].array = CGNS_NEW(cgns_array, user_data[0][n].narrays); - for (i=0; i0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - - /* read node data type */ - ADF_Get_Data_Type(node_id, data_type, &ierr); - if (ierr>0) { - adf_error("ADF_Get_Data_Type",ierr); - return 1; - } - - if (strcmp(data_type,"MT")==0) { - *ndim = 0; - return 0; - } - - /* number of dimension */ - ADF_Get_Number_of_Dimensions(node_id, ndim, &ierr); - if (ierr>0) { - adf_error("ADF_Get_Number_of_Dimensions",ierr); - return 1; - } - - /* dimension vector */ - ADF_Get_Dimension_Values(node_id, dim_vals, &ierr); - if (ierr>0) { - adf_error("ADF_Get_Dimension_Values",ierr); - return 1; - } - - /* Skipping data */ - if (!data_flag) return 0; - - /* allocate data */ - for (n=0; n<(*ndim); n++) size*=dim_vals[n]; - if (size<=0) { - cgi_error("Error reading node %s",name); - return 1; - } - if (strcmp(data_type,"I4")==0) data[0]=CGNS_NEW(int, size); - else if (strcmp(data_type,"R4")==0) data[0]=CGNS_NEW(float, size); - else if (strcmp(data_type,"R8")==0) data[0]=CGNS_NEW(double, size); - else if (strcmp(data_type,"C1")==0) data[0]=CGNS_NEW(char, size+1); - - /* read data */ - ADF_Read_All_Data(node_id, (char *) data[0], &ierr); - if (ierr>0) { - adf_error("ADF_Read_All_Data",ierr); - return 1; - } - return 0; -} - -cgns_link *cgi_read_link (double node_id) { - int ierr, len; - char name_in_file[ADF_MAX_LINK_DATA_SIZE+1]; - char filename[ADF_FILENAME_LENGTH+1]; - cgns_link *link; - - ADF_Is_Link(node_id, &len, &ierr); - if (ierr > 0) { - adf_error ("ADF_Is_Link", ierr); - return 0; - } - if (len > 0) { - ADF_Get_Link_Path (node_id, filename, name_in_file, &ierr); - if (ierr > 0) { - adf_error ("ADF_Get_Link_Path", ierr); - return 0; - } - len = strlen(filename) + strlen(name_in_file) + 2; - link = (cgns_link *) malloc (len + sizeof(cgns_link)); - link->filename = (char *)(link + 1); - strcpy (link->filename, filename); - link->name_in_file = link->filename + strlen(link->filename) + 1; - strcpy (link->name_in_file, name_in_file); - return link; - } - return 0; -} - -int cgi_datasize(int Idim, int *CurrentDim, GridLocation_t location, - int *rind_planes, int *DataSize) { - int j; - - if (location==Vertex) { - for (j=0; jversion == 1050) FileVersion = (float) 1.05; - else if (cg->version == 1100) FileVersion = (float) 1.10; - else if (cg->version == 1200) FileVersion = (float) 1.2; - else if (cg->version == 1270) FileVersion = (float) 1.27; - else if (cg->version == 2000) FileVersion = (float) 2.00; - else if (cg->version == 2100) FileVersion = (float) 2.10; - else { - cgi_error("FileVersion can't be set in cgi_write!"); - return 1; - } -*/ - FileVersion = (float) CGNS_DOTVERS; - if (cgi_new_node(cg->rootid, "CGNSLibraryVersion", "CGNSLibraryVersion_t", - &dummy_id, "R4", 1, &dim_vals, (void *)&FileVersion)) return 1; - - /* write all CGNSBase_t nodes in ADF file */ - for (b=0; bnbases; b++) { - int *data; - data = CGNS_NEW(int, 2); - base = &(cg->base[b]); - - data[0]=base->cell_dim; - data[1]=base->phys_dim; - - /* Create the CGNSBase_t nodes */ - dim_vals=2; - if (cgi_new_node(cg->rootid, base->name, "CGNSBase_t", &base->id, - "I4", 1, &dim_vals, (void *)data)) return 1; - free(data); - - /* set Global variable */ - Cdim = base->cell_dim; - Pdim = base->phys_dim; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(base->id, &base->descr[n])) return 1; - - /* ReferenceState_t */ - if (base->state && cgi_write_state(base->id, base->state)) return 1; - - /* Gravity_t */ - if (base->gravity && cgi_write_gravity(base->id, base->gravity)) return 1; - - /* Axisymmetry_t */ - if (base->axisym && cgi_write_axisym(base->id, base->axisym)) return 1; - - /* RotatingCoordinates_t */ - if (base->rotating && cgi_write_rotating(base->id, base->rotating)) return 1; - - /* Zone_t */ - for (n=0; nnzones; n++) { - if (cgi_write_zone(base->id, &base->zone[n])) return 1; - } - - /* Family_t */ - for (n=0; nnfamilies; n++) - if (cgi_write_family(base->id, &base->family[n])) return 1; - - /* DataClass_t */ - if (base->data_class && cgi_write_dataclass(base->id, base->data_class)) - return 1; - - /* DimensionalUnits_t */ - if (base->units && cgi_write_units(base->id, base->units)) - return 1; - - /* ConvergenceHistory_t */ - if (base->converg && cgi_write_converg(base->id, base->converg)) - return 1; - - /* FlowEquationSet_t */ - if (base->equations && cgi_write_equations(base->id, base->equations)) - return 1; - - /* IntegralData_t */ - for (n=0; nnintegrals; n++) - if (cgi_write_integral(base->id, &base->integral[n])) return 1; - - /* SimulationType_t */ - if (base->type) { - dim_vals = strlen(SimulationTypeName[base->type]); - if (cgi_new_node(base->id, "SimulationType", "SimulationType_t", &base->type_id, - "C1", 1, &dim_vals, (void *)SimulationTypeName[base->type])) return 1; - } - - /* BaseIterativeData_t */ - if (base->biter && cgi_write_biter(base->id, base->biter)) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(base->id, &base->user_data[n])) return 1; - - } - return 0; -} - -int cgi_write_zone(double parent_id, cgns_zone *zone) { - int n, dim_vals[2]; - double dummy_id; - - Idim = zone->index_dim; - if (zone->link) { - return cgi_write_link(parent_id, zone->name, zone->link, &zone->id); - } - - /* Create the Zone_t nodes */ - dim_vals[0]= Idim; - dim_vals[1]= 3; - if (cgi_new_node(parent_id, zone->name, "Zone_t", &zone->id, - "I4", 2, dim_vals, (void *)zone->nijk)) return 1; - - /* write ZoneType */ - dim_vals[0] = strlen(ZoneTypeName[zone->type]); - if (cgi_new_node(zone->id, "ZoneType", "ZoneType_t", &dummy_id, - "C1", 1, dim_vals, (void *)ZoneTypeName[zone->type])) return 1; - - /* set Global variable - for (n=0; nnijk[n]; - */ - - /* GridCoordinates_t */ - for (n=0; nnzcoor; n++) - if (cgi_write_zcoor(zone->id, &zone->zcoor[n])) return 1; - - /* FamilyName_t */ - if (zone->family_name[0]!='\0') { - int dim_vals = strlen(zone->family_name); - if (cgi_new_node(zone->id, "FamilyName", "FamilyName_t", &dummy_id, "C1", - 1, &dim_vals, (void *)zone->family_name)) return 1; - } - - /* Elements_t */ - for (n=0; nnsections; n++) - if (cgi_write_section(zone->id, &zone->section[n])) return 1; - - /* FlowSolution_t */ - for (n=0; nnsols; n++) - if (cgi_write_sol(zone->id, &zone->sol[n])) return 1; - - /* ZoneGridConnectivity_t */ - if (zone->zconn && cgi_write_zconn(zone->id, zone->zconn)) return 1; - - /* ZoneBC_t */ - if (zone->zboco && cgi_write_zboco(zone->id, zone->zboco)) return 1; - - /* DescreteData_t */ - for (n=0; nndiscrete; n++) - if (cgi_write_discrete(zone->id, &zone->discrete[n])) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(zone->id, &zone->descr[n])) return 1; - - /* ReferenceState_t */ - if (zone->state && cgi_write_state(zone->id, zone->state)) return 1; - - /* DataClass_t */ - if (zone->data_class && cgi_write_dataclass(zone->id, zone->data_class)) - return 1; - - /* DimensionalUnits_t */ - if (zone->units && cgi_write_units(zone->id, zone->units)) - return 1; - - /* ConvergenceHistory_t */ - if (zone->converg && cgi_write_converg(zone->id, zone->converg)) - return 1; - - /* FlowEquationSet_t */ - if (zone->equations && cgi_write_equations(zone->id, zone->equations)) - return 1; - - /* IntegralData_t */ - for (n=0; nnintegrals; n++) - if (cgi_write_integral(zone->id, &zone->integral[n])) return 1; - - /* Ordinal_t */ - if (zone->ordinal && cgi_write_ordinal(zone->id, zone->ordinal)) return 1; - - /* RigidGridMotion_t */ - for (n=0; nnrmotions; n++) - if (cgi_write_rmotion(zone->id, &zone->rmotion[n])) return 1; - - /* ArbitraryGridMotion_t */ - for (n=0; nnamotions; n++) - if (cgi_write_amotion(zone->id, &zone->amotion[n])) return 1; - - /* ZoneIterativeData_t */ - if (zone->ziter && cgi_write_ziter(zone->id, zone->ziter)) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(zone->id, &zone->user_data[n])) return 1; - - /* RotatingCoordinates_t */ - if (zone->rotating && cgi_write_rotating(zone->id, zone->rotating)) return 1; - - return 0; -} - -int cgi_write_family(double parent_id, cgns_family *family) { - int n, dim_vals; - - if (family->link) { - return cgi_write_link(parent_id, family->name, - family->link, &family->id); - } - - /* Family_t */ - if (cgi_new_node(parent_id, family->name, "Family_t", - &family->id, "MT", 0, 0, 0)) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(family->id, &family->descr[n])) return 1; - - /* FamilyBC_t */ - for (n=0; nnfambc; n++) { - cgns_fambc *fambc = &family->fambc[n]; - if (fambc->link) { - if (cgi_write_link(family->id, fambc->name, - fambc->link, &fambc->id)) return 1; - } - else { - dim_vals = strlen(BCTypeName[fambc->type]); - if (cgi_new_node(family->id, fambc->name, "FamilyBC_t", - &fambc->id, "C1", 1, &dim_vals, BCTypeName[fambc->type])) - return 1; - } - } - - /* GeometryReference_t */ - for (n=0; nngeos; n++) { - int i, dim_vals; - double dummy_id; - cgns_geo *geo = &family->geo[n]; - - if (geo->link) { - if (cgi_write_link(family->id, geo->name, geo->link, &geo->id)) - return 1; - } - else { - if (cgi_new_node(family->id, geo->name, "GeometryReference_t", - &geo->id, "MT", 0, 0, 0)) return 1; - /* Descriptor */ - for (i=0; indescr; i++) - if (cgi_write_descr(geo->id, &geo->descr[i])) return 1; - - /* GeometryFile */ - dim_vals = strlen(geo->file); - if (cgi_new_node(geo->id, "GeometryFile", "GeometryFile_t", - &dummy_id, "C1", 1, &dim_vals, geo->file)) return 1; - - /* GeometryFormat */ - dim_vals = strlen(geo->format); - if (cgi_new_node(geo->id, "GeometryFormat", "GeometryFormat_t", - &dummy_id, "C1", 1, &dim_vals, geo->format)) return 1; - - /* GeometryEntities */ - for (i=0; inpart; i++) { - if (cgi_new_node(geo->id, geo->part[i].name, "GeometryEntity_t", - &dummy_id, "MT", 0, 0, 0)) return 1; - } - - /* UserDefinedData_t */ - for (i=0; inuser_data; i++) { - if (cgi_write_user_data(geo->id, &geo->user_data[i])) return 1; - } - } - } - - /* Ordinal_t */ - if (family->ordinal && - cgi_write_ordinal(family->id, family->ordinal)) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(family->id, &family->user_data[n])) return 1; - - return 0; -} - -int cgi_write_section(double parent_id, cgns_section *section) { - int n, dim_vals, data[2]; - double dummy_id; - - if (section->link) { - return cgi_write_link(parent_id, section->name, - section->link, §ion->id); - } - - /* Elements_t */ - dim_vals = 2; - data[0]=section->el_type; - data[1]=section->el_bound; - if (cgi_new_node(parent_id, section->name, "Elements_t", - §ion->id, "I4", 1, &dim_vals, data)) return 1; - - /* ElementRange */ - if (cgi_new_node(section->id, "ElementRange", "IndexRange_t", &dummy_id, - "I4", 1, &dim_vals, section->range)) return 1; - - /* ElementConnectivity */ - if (cgi_write_array(section->id, section->connect)) return 1; - - /* ParentData */ - if (section->parent && cgi_write_array(section->id, section->parent)) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(section->id, §ion->descr[n])) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(section->id, §ion->user_data[n])) return 1; - - return 0; -} - -int cgi_write_zcoor(double parent_id, cgns_zcoor *zcoor) { - int n; - - if (zcoor->link) { - return cgi_write_link(parent_id, zcoor->name, - zcoor->link, &zcoor->id); - } - - /* GridCoordinates_t */ - if (cgi_new_node(parent_id, zcoor->name, "GridCoordinates_t", - &zcoor->id, "MT", 0, 0, 0)) return 1; - - /* Rind_t */ - if (cgi_write_rind(zcoor->id, zcoor->rind_planes, Idim)) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(zcoor->id, &zcoor->descr[n])) return 1; - - /* DataClass_t */ - if (zcoor->data_class && - cgi_write_dataclass(zcoor->id, zcoor->data_class)) return 1; - - /* DimensionalUnits_t */ - if (zcoor->units && cgi_write_units(zcoor->id, zcoor->units)) return 1; - - /* DataArray_t */ - for (n=0; nncoords; n++) - if (cgi_write_array(zcoor->id, &zcoor->coord[n])) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(zcoor->id, &zcoor->user_data[n])) return 1; - - return 0; -} - -int cgi_write_sol(double parent_id, cgns_sol *sol) { - int n, dim_vals; - double dummy_id; - - if (sol->link) { - return cgi_write_link(parent_id, sol->name, sol->link, &sol->id); - } - - /* FlowSolution_t */ - if (cgi_new_node(parent_id, sol->name, "FlowSolution_t", - &sol->id, "MT", 0, 0, 0)) return 1; - - /* GridLocation_t */ - if (sol->location!=Vertex) { - dim_vals = strlen(GridLocationName[sol->location]); - if (cgi_new_node(sol->id, "GridLocation", "GridLocation_t", - &dummy_id, "C1", 1, &dim_vals, - (void *)GridLocationName[sol->location])) return 1; - } - - /* Rind_t */ - if (cgi_write_rind(sol->id, sol->rind_planes, Idim)) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(sol->id, &sol->descr[n])) return 1; - - /* DataClass_t */ - if (sol->data_class && - cgi_write_dataclass(sol->id, sol->data_class)) return 1; - - /* DimensionalUnits_t */ - if (sol->units && cgi_write_units(sol->id, sol->units)) return 1; - - /* DataArray_t */ - for (n=0; nnfields; n++) - if (cgi_write_array(sol->id, &sol->field[n])) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(sol->id, &sol->user_data[n])) return 1; - - return 0; -} - -int cgi_write_zconn(double parent_id, cgns_zconn *zconn) { - int n; - - if (zconn->link) { - return cgi_write_link(parent_id, "ZoneGridConnectivity", - zconn->link, &zconn->id); - } - - /* ZoneGridConnectivity_t */ - if (cgi_new_node(parent_id, "ZoneGridConnectivity", "ZoneGridConnectivity_t", - &zconn->id, "MT", 0, 0, 0)) return 1; - - /* GridConnectivity1to1_t */ - for (n=0; nn1to1; n++) - if (cgi_write_1to1(zconn->id, &zconn->one21[n])) return 1; - - /* GridConnectivity_t */ - for (n=0; nnconns; n++) - if (cgi_write_conns(zconn->id, &zconn->conn[n])) return 1; - - /* OversetHoles_t */ - for (n=0; nnholes; n++) - if (cgi_write_holes(zconn->id, &zconn->hole[n])) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(zconn->id, &zconn->descr[n])) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(zconn->id, &zconn->user_data[n])) return 1; - - return 0; -} - -int cgi_write_1to1(double parent_id, cgns_1to1 *one21) { - int n, dim_vals; - double dummy_id; - cgns_ptset *ptset; - - if (one21->link) { - return cgi_write_link(parent_id, one21->name, - one21->link, &one21->id); - } - - dim_vals = strlen(one21->donor); - if (cgi_new_node(parent_id, one21->name, "GridConnectivity1to1_t", - &one21->id, "C1", 1, &dim_vals, one21->donor)) return 1; - - /* Transform */ - if (cgi_new_node(one21->id, "Transform", "\"int[IndexDimension]\"", &dummy_id, - "I4", 1, &Idim, (void *)one21->transform)) return 1; - - /* PointRange & PointRangeDonor: Move nodes to their final positions */ - ptset = &(one21->ptset); - if (cgi_move_node(cg->rootid, ptset->id, one21->id, - PointSetTypeName[ptset->type])) return 1; - - ptset = &(one21->dptset); - if (cgi_move_node(cg->rootid, ptset->id, one21->id, - PointSetTypeName[ptset->type])) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(one21->id, &one21->descr[n])) return 1; - - /* Ordinal_t */ - if (one21->ordinal && - cgi_write_ordinal(one21->id, one21->ordinal)) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(one21->id, &one21->user_data[n])) return 1; - - return 0; -} - -int cgi_write_conns(double parent_id, cgns_conn *conn) { - int n, dim_vals; - double dummy_id; - cgns_ptset *ptset; - - if (conn->link) { - return cgi_write_link(parent_id, conn->name, - conn->link, &conn->id); - } - - dim_vals = strlen(conn->donor); - if (cgi_new_node(parent_id, conn->name, "GridConnectivity_t", - &conn->id, "C1", 1, &dim_vals, conn->donor)) return 1; - - /* GridConnectivityType_t */ - dim_vals = strlen(GridConnectivityTypeName[conn->type]); - if (cgi_new_node(conn->id, "GridConnectivityType", - "GridConnectivityType_t", &dummy_id, "C1", 1, &dim_vals, - (void *)GridConnectivityTypeName[conn->type])) return 1; - - /* write GridLocation */ - if (conn->location!=Vertex) { - dim_vals = strlen(GridLocationName[conn->location]); - if (cgi_new_node(conn->id, "GridLocation", "GridLocation_t", - &dummy_id, "C1", 1, &dim_vals, - (void *)GridLocationName[conn->location])) return 1; - } - - /* PointRange or PointList: Move node to its final position */ - ptset = &(conn->ptset); - if (cgi_move_node(cg->rootid, ptset->id, conn->id, - PointSetTypeName[ptset->type])) return 1; - - /* Cell or Point ListDonor: Move node to its final position */ - ptset = &(conn->dptset); - if (cgi_move_node(cg->rootid, ptset->id, conn->id, - PointSetTypeName[ptset->type])) return 1; - - /* InterpolantsDonor */ - if (conn->interpolants) { - if (cgi_write_array(conn->id, conn->interpolants)) return 1; - } - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(conn->id, &conn->descr[n])) return 1; - - /* Ordinal_t */ - if (conn->ordinal && - cgi_write_ordinal(conn->id, conn->ordinal)) return 1; - - /* GridConnectivityProperty_t */ - if (conn->cprop && - cgi_write_cprop(conn->id, conn->cprop)) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(conn->id, &conn->user_data[n])) return 1; - - return 0; -} - -int cgi_write_cprop(double parent_id, cgns_cprop *cprop) { - int dim_vals, n; - double dummy_id; - - if (cprop->link) { - return cgi_write_link(parent_id, "GridConnectivityProperty", - cprop->link, &cprop->id); - } - - /* GridConnectivityProperty_t */ - if (cgi_new_node(parent_id, "GridConnectivityProperty", - "GridConnectivityProperty_t", &cprop->id, "MT", 0, 0, 0)) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(cprop->id, &cprop->descr[n])) return 1; - - /* AverageInterface_t */ - if (cprop->caverage) { - cgns_caverage *caverage = cprop->caverage; - if (caverage->link) { - if (cgi_write_link(cprop->id, "AverageInterface", - caverage->link, &caverage->id)) return 1; - } - else { - if (cgi_new_node(cprop->id, "AverageInterface", "AverageInterface_t", - &caverage->id, "MT", 0, 0, 0)) return 1; - - /* AverageInterface_t/Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(caverage->id, &caverage->descr[n])) return 1; - - /* AverageInterface_t/AverageInterfaceType_t */ - dim_vals = strlen(AverageInterfaceTypeName[caverage->type]); - if (cgi_new_node(caverage->id, "AverageInterfaceType", - "AverageInterfaceType_t", &dummy_id, "C1", 1, &dim_vals, - (void *)AverageInterfaceTypeName[caverage->type])) return 1; - - /* AverageInterface_t/UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(caverage->id, &caverage->user_data[n])) - return 1; - } - } - - /* Periodic_t */ - if (cprop->cperio) { - cgns_cperio *cperio = cprop->cperio; - if (cperio->link) { - if (cgi_write_link(cprop->id, "Periodic", - cperio->link, &cperio->id)) return 1; - } - else { - if (cgi_new_node(cprop->id, "Periodic", "Periodic_t", &cperio->id, - "MT", 0, 0, 0)) return 1; - - /* Periodic_t/Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(cperio->id, &cperio->descr[n])) return 1; - - /* Periodic_t/DataArray_t */ - for (n=0; nnarrays; n++) - if (cgi_write_array(cperio->id, &cperio->array[n])) return 1; - - /* Periodic_t/DataClass_t */ - if (cperio->data_class && - cgi_write_dataclass(cperio->id, cperio->data_class)) return 1; - - /* Periodic_t/DimensionalUnits_t */ - if (cperio->units && - cgi_write_units(cperio->id, cperio->units)) return 1; - - /* Periodic_t/UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(cperio->id, &cperio->user_data[n])) return 1; - } - } - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(cprop->id, &cprop->user_data[n])) return 1; - - return 0; -} - -int cgi_write_holes(double parent_id, cgns_hole *hole) { - int n, dim_vals; - double dummy_id; - char PointSetName[33]; - cgns_ptset *ptset; - - if (hole->link) { - return cgi_write_link(parent_id, hole->name, - hole->link, &hole->id); - } - - /* OversetHoles_t */ - if (cgi_new_node(parent_id, hole->name, "OversetHoles_t", - &hole->id, "MT", 0, 0, 0)) return 1; - - /* GridLocation_t */ - if (hole->location!=Vertex) { - dim_vals = strlen(GridLocationName[hole->location]); - if (cgi_new_node(hole->id, "GridLocation", "GridLocation_t", - &dummy_id, "C1", 1, &dim_vals, - (void *)GridLocationName[hole->location])) return 1; - } - - /* PointRange(s) and PointList */ - for (n=0; nnptsets; n++) { - ptset = &(hole->ptset[n]); - - if (ptset->type == PointRange) sprintf(PointSetName,"PointRange%d",n+1); - else sprintf(PointSetName,"PointSetTypeName[ptset->type]"); - - /* Move node to its final position */ - if (cgi_move_node(cg->rootid, ptset->id, hole->id, PointSetName)) return 1; - } - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(hole->id, &hole->descr[n])) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(hole->id, &hole->user_data[n])) return 1; - - return 0; -} - -int cgi_write_zboco(double parent_id, cgns_zboco *zboco) { - int n; - - if (zboco->link) { - return cgi_write_link(parent_id, "ZoneBC", - zboco->link, &zboco->id); - } - - /* ZoneBC_t */ - if (cgi_new_node(parent_id, "ZoneBC", "ZoneBC_t", &zboco->id, - "MT", 0, 0, 0)) return 1; - - /* BC_t */ - for (n=0; nnbocos; n++) - if (cgi_write_boco(zboco->id, &zboco->boco[n])) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(zboco->id, &zboco->descr[n])) return 1; - - /* ReferenceState_t */ - if (zboco->state && cgi_write_state(zboco->id, zboco->state)) - return 1; - - /* DataClass_t */ - if (zboco->data_class && - cgi_write_dataclass(zboco->id, zboco->data_class)) return 1; - - /* DimensionalUnits_t */ - if (zboco->units && cgi_write_units(zboco->id, zboco->units)) - return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(zboco->id, &zboco->user_data[n])) return 1; - - return 0; -} - -int cgi_write_boco(double parent_id, cgns_boco *boco) { - int dim_vals, n; - double dummy_id; - - if (boco->link) { - return cgi_write_link(parent_id, boco->name, - boco->link, &boco->id); - } - - /* BC_t */ - dim_vals = strlen(BCTypeName[boco->type]); - if (cgi_new_node(parent_id, boco->name, "BC_t", &boco->id, "C1", - 1, &dim_vals, BCTypeName[boco->type])) return 1; - - /* PointRange, PointList: Move node to its final position */ - if (boco->ptset) { - /* Move node to its final position */ - if (cgi_move_node(cg->rootid, boco->ptset->id, boco->id, - PointSetTypeName[boco->ptset->type])) return 1; - } - - /* GridLocation_t */ - if (boco->location != Vertex) { - dim_vals = strlen(GridLocationName[boco->location]); - if (cgi_new_node(boco->id, "GridLocation", "GridLocation_t", &dummy_id, - "C1", 1, &dim_vals, (void *)GridLocationName[boco->location])) return 1; - } - - /* FamilyName_t */ - if (boco->family_name[0]!='\0') { - int dim_vals = strlen(boco->family_name); - if (cgi_new_node(boco->id, "FamilyName", "FamilyName_t", &dummy_id, "C1", - 1, &dim_vals, (void *)boco->family_name)) return 1; - } - - /* BCDataSet_t */ - for (n=0; nndataset; n++) - if (cgi_write_dataset(boco->id, &boco->dataset[n])) return 1; - - /* InwardNormalIndex */ - if (boco->Nindex) { - if (cgi_new_node(boco->id, "InwardNormalIndex", - "\"int[IndexDimension]\"", &boco->index_id, "I4", 1, - &Idim, (void *)boco->Nindex)) return 1; - } - - /* InwardNormalList */ - if (boco->normal) { - if (boco->normal->link) { - if (cgi_write_link(boco->id, boco->normal->name, - boco->normal->link, &boco->normal->id)) return 1; - } - else { - if (cgi_new_node(boco->id, boco->normal->name, "IndexArray_t", &boco->normal->id, - boco->normal->data_type, boco->normal->data_dim, boco->normal->dim_vals, - boco->normal->data)) return 1; - } - } - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(boco->id, &boco->descr[n])) return 1; - - /* ReferenceState_t */ - if (boco->state && - cgi_write_state(boco->id, boco->state)) return 1; - - /* DataClass_t */ - if (boco->data_class && - cgi_write_dataclass(boco->id, boco->data_class)) return 1; - - /* DimensionalUnits_t */ - if (boco->units && cgi_write_units(boco->id, boco->units)) - return 1; - - /* Ordinal_t */ - if (boco->ordinal && - cgi_write_ordinal(boco->id, boco->ordinal)) return 1; - - /* BCProperty_t */ - if (boco->bprop && - cgi_write_bprop(boco->id, boco->bprop)) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(boco->id, &boco->user_data[n])) return 1; - - return 0; -} - -int cgi_write_bprop(double parent_id, cgns_bprop *bprop) { - int dim_vals, n; - double dummy_id; - - if (bprop->link) { - return cgi_write_link(parent_id, "BCProperty", - bprop->link, &bprop->id); - } - - /* BCProperty_t */ - if (cgi_new_node(parent_id, "BCProperty", "BCProperty_t", &bprop->id, - "MT", 0, 0, 0)) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(bprop->id, &bprop->descr[n])) return 1; - - /* WallFunction_t */ - if (bprop->bcwall) { - cgns_bcwall *bcwall = bprop->bcwall; - if (bcwall->link) { - if (cgi_write_link(bprop->id, "WallFunction", - bcwall->link, &bcwall->id)) return 1; - } - else { - if (cgi_new_node(bprop->id, "WallFunction", "WallFunction_t", - &bcwall->id, "MT", 0, 0, 0)) return 1; - - /* WallFunction_t/Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(bcwall->id, &bcwall->descr[n])) return 1; - - /* WallFunction_t/WallFunctionType_t */ - dim_vals = strlen(WallFunctionTypeName[bcwall->type]); - if (cgi_new_node(bcwall->id, "WallFunctionType", "WallFunctionType_t", - &dummy_id, "C1", 1, &dim_vals, (void *)WallFunctionTypeName[bcwall->type])) return 1; - /* WallFunction_t/UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(bcwall->id, &bcwall->user_data[n])) return 1; - } - } - - /* Area_t */ - if (bprop->bcarea) { - cgns_bcarea *bcarea = bprop->bcarea; - if (bcarea->link) { - if (cgi_write_link(bprop->id, "Area", - bcarea->link, &bcarea->id)) return 1; - } - else { - if (cgi_new_node(bprop->id, "Area", "Area_t", &bcarea->id, - "MT", 0, 0, 0)) return 1; - - /* Area_t/Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(bcarea->id, &bcarea->descr[n])) return 1; - - /* Area_t/AreaType_t */ - dim_vals = strlen(AreaTypeName[bcarea->type]); - if (cgi_new_node(bcarea->id, "AreaType", "AreaType_t", &dummy_id, - "C1", 1, &dim_vals, (void *)AreaTypeName[bcarea->type])) return 1; - - /* Area_t/DataArray_t */ - for (n=0; nnarrays; n++) - if (cgi_write_array(bcarea->id, &bcarea->array[n])) return 1; - - /* Area_t/UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(bcarea->id, &bcarea->user_data[n])) return 1; - } - } - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(bprop->id, &bprop->user_data[n])) return 1; - - return 0; -} - -int cgi_write_dataset(double parent_id, cgns_dataset *dataset) { - int dim_vals, n; - - if (dataset->link) { - return cgi_write_link(parent_id, dataset->name, - dataset->link, &dataset->id); - } - - /* BCDataSet_t */ - dim_vals= strlen(BCTypeName[dataset->type]); - if (cgi_new_node(parent_id, dataset->name, "BCDataSet_t", &dataset->id, - "C1", 1, &dim_vals, (void *)BCTypeName[dataset->type])) return 1; - - /* DirichletData */ - if (dataset->dirichlet) { - if (dataset->dirichlet->link) { - if (cgi_write_link(dataset->id, "DirichletData", - dataset->dirichlet->link, &dataset->dirichlet->id)) - return 1; - } - else { - if (cgi_new_node(dataset->id, "DirichletData", "BCData_t", - &dataset->dirichlet->id, "MT", 0, 0, 0)) return 1; - if (cgi_write_bcdata(dataset->dirichlet->id, dataset->dirichlet)) - return 1; - } - } - - /* NeumannData */ - if (dataset->neumann) { - if (dataset->neumann->link) { - if (cgi_write_link(dataset->id, "NeumannData", - dataset->neumann->link, &dataset->neumann->id)) - return 1; - } - else { - if (cgi_new_node(dataset->id, "NeumannData", "BCData_t", - &dataset->neumann->id, "MT", 0, 0, 0)) return 1; - if (cgi_write_bcdata(dataset->neumann->id, dataset->neumann)) - return 1; - } - } - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(dataset->id, &dataset->descr[n])) return 1; - - /* ReferenceState_t */ - if (dataset->state && - cgi_write_state(dataset->id, dataset->state)) return 1; - - /* DataClass_t */ - if (dataset->data_class && - cgi_write_dataclass(dataset->id, dataset->data_class)) return 1; - - /* DimensionalUnits_t */ - if (dataset->units && - cgi_write_units(dataset->id, dataset->units)) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(dataset->id, &dataset->user_data[n])) return 1; - - return 0; -} - -int cgi_write_bcdata(double bcdata_id, cgns_bcdata *bcdata) { - int n; - - /* DataArray_t */ - for (n=0; nnarrays; n++) - if (cgi_write_array(bcdata_id, &bcdata->array[n])) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(bcdata_id, &bcdata->descr[n])) return 1; - - /* DataClass_t */ - if (bcdata->data_class && - cgi_write_dataclass(bcdata->id, bcdata->data_class)) return 1; - - /* DimensionalUnits_t */ - if (bcdata->units && - cgi_write_units(bcdata->id, bcdata->units)) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(bcdata->id, &bcdata->user_data[n])) return 1; - - return 0; -} - -int cgi_write_ptset(double parent_id, char_33 name, cgns_ptset *ptset, - int Idim, void *ptset_ptr) { - int dim_vals[12], ndim; - char_33 label; - - if (ptset->link) { - return cgi_write_link(parent_id, name, ptset->link, &ptset->id); - } - - /* Set label */ -#if 0 /* re-enable ElementList/ElementRange */ - if (ptset->type == PointRange || ptset->type == PointRangeDonor) -#else - if (ptset->type == PointRange || ptset->type == ElementRange || - ptset->type == PointRangeDonor) -#endif - strcpy(label,"IndexRange_t"); - else strcpy(label,"IndexArray_t"); - - /* Dimension vector */ - dim_vals[0]=Idim; - dim_vals[1]=ptset->npts; - ndim = 2; - - /* Create the node */ - if (cgi_new_node(parent_id, name, label, &ptset->id, - ptset->data_type, ndim, dim_vals, ptset_ptr)) return 1; - - return 0; -} - -int cgi_write_equations(double parent_id, cgns_equations *equations) { - int n, dim_vals; - double dummy_id; - cgns_governing *governing; - - if (equations->link) { - return cgi_write_link(parent_id, "FlowEquationSet", - equations->link, &equations->id); - } - - /* FlowEquationSet_t */ - if (cgi_new_node(parent_id, "FlowEquationSet", "FlowEquationSet_t", - &equations->id, "MT", 0, 0, 0)) return 1; - - /* EquationDimension */ - if (equations->equation_dim) { - dim_vals=1; - if (cgi_new_node(equations->id, "EquationDimension", "\"int\"", - &dummy_id, "I4", 1, &dim_vals, (void *)&equations->equation_dim)) - return 1; - } - - /* GoverningEquations_t */ - if (equations->governing) { - governing = equations->governing; - if (governing->link) { - if (cgi_write_link(equations->id, "GoverningEquations", - governing->link, &governing->id)) return 1; - } - else { - dim_vals = strlen(GoverningEquationsTypeName[governing->type]); - if (cgi_new_node(equations->id, "GoverningEquations", - "GoverningEquations_t", &governing->id, "C1", 1, &dim_vals, - GoverningEquationsTypeName[governing->type])) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(governing->id, &governing->descr[n])) return 1; - - /* DiffusionModel */ - if (governing->diffusion_model) { - dim_vals=governing->dim_vals; - if (cgi_new_node(governing->id, "DiffusionModel", - "\"int[1+...+IndexDimension]\"", &dummy_id, "I4", 1, - &dim_vals, (void *)governing->diffusion_model)) return 1; - } - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(governing->id, &governing->user_data[n])) return 1; - } - } - - /* GasModel_t */ - if (equations->gas && - cgi_write_model(equations->id, equations->gas)) return 1; - - /* ViscosityModel_t */ - if (equations->visc && - cgi_write_model(equations->id, equations->visc)) return 1; - - /* ThermalConductivityModel_t */ - if (equations->conduct && - cgi_write_model(equations->id, equations->conduct)) return 1; - - /* TurbulenceClosure_t */ - if (equations->closure && - cgi_write_model(equations->id, equations->closure)) return 1; - - /* TurbulenceModel_t */ - if (equations->turbulence) { - if (cgi_write_model(equations->id, equations->turbulence)) return 1; - - /* DiffusionModel */ - if (equations->turbulence->diffusion_model) { - dim_vals=equations->turbulence->dim_vals; - if (cgi_new_node(equations->turbulence->id, "DiffusionModel", - "\"int[1+...+IndexDimension]\"", &dummy_id, "I4", 1, &dim_vals, - (void *) equations->turbulence->diffusion_model)) return 1; - } - } - - /* ThermalRelaxationModel_t */ - if (equations->relaxation && - cgi_write_model(equations->id, equations->relaxation)) return 1; - - /* ChemicalKineticsModel_t */ - if (equations->chemkin && - cgi_write_model(equations->id, equations->chemkin)) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(equations->id, &equations->descr[n])) return 1; - - /* DataClass_t */ - if (equations->data_class && - cgi_write_dataclass(equations->id, equations->data_class)) return 1; - - /* DimensionalUnits_t */ - if (equations->units && - cgi_write_units(equations->id, equations->units)) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(equations->id, &equations->user_data[n])) return 1; - - return 0; -} - -int cgi_write_model(double parent_id, cgns_model *model) { - int n, dim_vals; - char_33 label; - - if (model->link) { - return cgi_write_link(parent_id, model->name, - model->link, &model->id); - } - - /* xModel_t */ - sprintf(label,"%s_t",model->name); - dim_vals = strlen(ModelTypeName[model->type]); - - if (cgi_new_node(parent_id, model->name, label, &model->id, - "C1", 1, &dim_vals, ModelTypeName[model->type])) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(model->id, &model->descr[n])) return 1; - - /* DataClass_t */ - if (model->data_class && - cgi_write_dataclass(model->id, model->data_class)) return 1; - - /* DimensionalUnits_t */ - if (model->units && - cgi_write_units(model->id, model->units)) return 1; - - /* DataArray */ - for (n=0; nnarrays; n++) - if (cgi_write_array(model->id, &model->array[n])) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(model->id, &model->user_data[n])) return 1; - - return 0; -} - -int cgi_write_state(double parent_id, cgns_state *state) { - int n; - - if (state->link) { - return cgi_write_link(parent_id, "ReferenceState", - state->link, &state->id); - } - - /* ReferenceState_t */ - if (cgi_new_node(parent_id, "ReferenceState", "ReferenceState_t", - &state->id, "MT", 0, 0, 0)) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(state->id, &state->descr[n])) return 1; - - /* ReferenceStateDescription */ - if (state->StateDescription && - cgi_write_descr(state->id, state->StateDescription)) return 1; - - /* DataClass_t */ - if (state->data_class && - cgi_write_dataclass(state->id, state->data_class)) return 1; - - /* DimensionalUnits_t */ - if (state->units && - cgi_write_units(state->id, state->units)) return 1; - - /* DataArray */ - for (n=0; nnarrays; n++) - if (cgi_write_array(state->id, &state->array[n])) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(state->id, &state->user_data[n])) return 1; - - return 0; -} - -int cgi_write_gravity(double parent_id, cgns_gravity *gravity) { - int n; - - if (gravity->link) { - return cgi_write_link(parent_id, "Gravity", - gravity->link, &gravity->id); - } - - /* Gravity_t */ - if (cgi_new_node(parent_id, "Gravity", "Gravity_t", - &gravity->id, "MT", 0, 0, 0)) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(gravity->id, &gravity->descr[n])) return 1; - - /* DataClass_t */ - if (gravity->data_class && - cgi_write_dataclass(gravity->id, gravity->data_class)) return 1; - - /* DimensionalUnits_t */ - if (gravity->units && - cgi_write_units(gravity->id, gravity->units)) return 1; - - /* DataArray */ - if (gravity->vector && cgi_write_array(gravity->id, gravity->vector)) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(gravity->id, &gravity->user_data[n])) return 1; - - return 0; -} - -int cgi_write_axisym(double parent_id, cgns_axisym *axisym) { - int n; - - if (axisym->link) { - return cgi_write_link(parent_id, "Axisymmetry", - axisym->link, &axisym->id); - } - - /* Axisymmetry_t */ - if (cgi_new_node(parent_id, "Axisymmetry", "Axisymmetry_t", - &axisym->id, "MT", 0, 0, 0)) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(axisym->id, &axisym->descr[n])) return 1; - - /* DataClass_t */ - if (axisym->data_class && - cgi_write_dataclass(axisym->id, axisym->data_class)) return 1; - - /* DimensionalUnits_t */ - if (axisym->units && - cgi_write_units(axisym->id, axisym->units)) return 1; - - /* DataArray */ - for (n=0; nnarrays; n++) - if (cgi_write_array(axisym->id, &axisym->array[n])) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(axisym->id, &axisym->user_data[n])) return 1; - - return 0; -} - -int cgi_write_rotating(double parent_id, cgns_rotating *rotating) { - int n; - - if (rotating->link) { - return cgi_write_link(parent_id, "RotatingCoordinates", - rotating->link, &rotating->id); - } - - /* RotatingCoordinates_t */ - if (cgi_new_node(parent_id, "RotatingCoordinates", "RotatingCoordinates_t", - &rotating->id, "MT", 0, 0, 0)) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(rotating->id, &rotating->descr[n])) return 1; - - /* DataClass_t */ - if (rotating->data_class && - cgi_write_dataclass(rotating->id, rotating->data_class)) return 1; - - /* DimensionalUnits_t */ - if (rotating->units && - cgi_write_units(rotating->id, rotating->units)) return 1; - - /* DataArray */ - for (n=0; nnarrays; n++) - if (cgi_write_array(rotating->id, &rotating->array[n])) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(rotating->id, &rotating->user_data[n])) return 1; - - return 0; -} - -int cgi_write_converg(double parent_id, cgns_converg *converg) { - int n; - int dim_vals; - - if (converg->link) { - return cgi_write_link(parent_id, converg->name, - converg->link, &converg->id); - } - - /* ConvergenceHistory_t */ - dim_vals = 1; - if (cgi_new_node(parent_id, converg->name, "ConvergenceHistory_t", - &converg->id, "I4", 1, &dim_vals, (void *)&converg->iterations)) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(converg->id, &converg->descr[n])) return 1; - - /* NormDefinitions */ - if (converg->NormDefinitions && - cgi_write_descr(converg->id, converg->NormDefinitions)) return 1; - - /* DataClass_t */ - if (converg->data_class && - cgi_write_dataclass(converg->id, converg->data_class)) return 1; - - /* DimensionalUnits_t */ - if (converg->units && - cgi_write_units(converg->id, converg->units)) return 1; - - /* DataArray */ - for (n=0; nnarrays; n++) - if (cgi_write_array(converg->id, &converg->array[n])) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(converg->id, &converg->user_data[n])) return 1; - - return 0; -} - -int cgi_write_discrete(double parent_id, cgns_discrete *discrete) { - int n, dim_vals; - double dummy_id; - - if (discrete->link) { - return cgi_write_link(parent_id, discrete->name, - discrete->link, &discrete->id); - } - - /* DiscreteData_t */ - if (cgi_new_node(parent_id, discrete->name, "DiscreteData_t", - &discrete->id, "MT", 0, 0, 0)) return 1; - - /* GridLocation_t */ - if (discrete->location != Vertex) { - dim_vals = strlen(GridLocationName[discrete->location]); - if (cgi_new_node(discrete->id, "GridLocation", "GridLocation_t", &dummy_id, - "C1", 1, &dim_vals, (void *)GridLocationName[discrete->location])) return 1; - } - - /* Rind_t */ - if (cgi_write_rind(discrete->id, discrete->rind_planes, Idim)) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(discrete->id, &discrete->descr[n])) return 1; - - /* DataClass_t */ - if (discrete->data_class && - cgi_write_dataclass(discrete->id, discrete->data_class)) return 1; - - /* DimensionalUnits_t */ - if (discrete->units && - cgi_write_units(discrete->id, discrete->units)) return 1; - - /* DataArray_t */ - for (n=0; nnarrays; n++) - if (cgi_write_array(discrete->id, &discrete->array[n])) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(discrete->id, &discrete->user_data[n])) return 1; - - return 0; -} - -int cgi_write_integral(double parent_id, cgns_integral *integral) { - int n; - - if (integral->link) { - return cgi_write_link(parent_id, integral->name, - integral->link, &integral->id); - } - - /* IntegralData_t */ - if (cgi_new_node(parent_id, integral->name, "IntegralData_t", - &integral->id, "MT", 0, 0, 0)) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(integral->id, &integral->descr[n])) return 1; - - /* DataClass_t */ - if (integral->data_class && - cgi_write_dataclass(integral->id, integral->data_class)) return 1; - - /* DimensionalUnits_t */ - if (integral->units && - cgi_write_units(integral->id, integral->units)) return 1; - - /* DataArray_t */ - for (n=0; nnarrays; n++) - if (cgi_write_array(integral->id, &integral->array[n])) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(integral->id, &integral->user_data[n])) return 1; - - return 0; -} - -int cgi_write_rmotion(double parent_id, cgns_rmotion *rmotion) { - int n, dim_vals; - - if (rmotion->link) { - return cgi_write_link(parent_id, rmotion->name, - rmotion->link, &rmotion->id); - } - - /* RigidGridMotion_t Name and RigidGridMotionType_t */ - dim_vals=strlen(RigidGridMotionTypeName[rmotion->type]); - if (cgi_new_node(parent_id, rmotion->name, "RigidGridMotion_t", &rmotion->id, - "C1", 1, &dim_vals, (void *)RigidGridMotionTypeName[rmotion->type])) return 1; - - /* Descriptor_t */ - - for (n=0; nndescr; n++) - if (cgi_write_descr(rmotion->id, &rmotion->descr[n])) return 1; - - /* DataClass_t */ - if (rmotion->data_class && - cgi_write_dataclass(rmotion->id, rmotion->data_class)) return 1; - - /* DimensionalUnits_t */ - if (rmotion->units && - cgi_write_units(rmotion->id, rmotion->units)) return 1; - - /* DataArray_t */ - for (n=0; nnarrays; n++) - if (cgi_write_array(rmotion->id, &rmotion->array[n])) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(rmotion->id, &rmotion->user_data[n])) return 1; - - return 0; -} - -int cgi_write_amotion(double parent_id, cgns_amotion *amotion) { - int n, dim_vals; - double dummy_id; - - if (amotion->link) { - return cgi_write_link(parent_id, amotion->name, - amotion->link, &amotion->id); - } - - /* ArbitraryGridMotion_t Name and ArbitraryGridMotionType_t */ - dim_vals=strlen(ArbitraryGridMotionTypeName[amotion->type]); - if (cgi_new_node(parent_id, amotion->name, "ArbitraryGridMotion_t", &amotion->id, - "C1", 1, &dim_vals, (void *)ArbitraryGridMotionTypeName[amotion->type])) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(amotion->id, &amotion->descr[n])) return 1; - - /* GridLocation_t */ - if (amotion->location != Vertex) { - dim_vals = strlen(GridLocationName[amotion->location]); - if (cgi_new_node(amotion->id, "GridLocation", "GridLocation_t", &dummy_id, - "C1", 1, &dim_vals, (void *)GridLocationName[amotion->location])) return 1; - } - - /* Rind_t */ - if (cgi_write_rind(amotion->id, amotion->rind_planes, Idim)) return 1; - - /* DataClass_t */ - if (amotion->data_class && - cgi_write_dataclass(amotion->id, amotion->data_class)) return 1; - - /* DimensionalUnits_t */ - if (amotion->units && - cgi_write_units(amotion->id, amotion->units)) return 1; - - /* DataArray_t */ - for (n=0; nnarrays; n++) - if (cgi_write_array(amotion->id, &amotion->array[n])) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(amotion->id, &amotion->user_data[n])) return 1; - - return 0; -} - -int cgi_write_biter(double parent_id, cgns_biter *biter) { - int n, dim_vals; - - if (biter->link) { - return cgi_write_link(parent_id, biter->name, - biter->link, &biter->id); - } - - /* BaseIterativeData_t name and NumberOfSteps */ - dim_vals=1; - if (cgi_new_node(parent_id, biter->name, "BaseIterativeData_t", - &biter->id, "I4", 1, &dim_vals, (void *)&biter->nsteps)) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(biter->id, &biter->descr[n])) return 1; - - /* DataClass_t */ - if (biter->data_class && - cgi_write_dataclass(biter->id, biter->data_class)) return 1; - - /* DimensionalUnits_t */ - if (biter->units && - cgi_write_units(biter->id, biter->units)) return 1; - - /* DataArray_t */ - for (n=0; nnarrays; n++) - if (cgi_write_array(biter->id, &biter->array[n])) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(biter->id, &biter->user_data[n])) return 1; - - return 0; -} - -int cgi_write_ziter(double parent_id, cgns_ziter *ziter) { - int n; - - if (ziter->link) { - return cgi_write_link(parent_id, ziter->name, - ziter->link, &ziter->id); - } - - /* ZoneIterativeData_t name */ - if (cgi_new_node(parent_id, ziter->name, "ZoneIterativeData_t", - &ziter->id, "MT", 0, 0, 0)) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(ziter->id, &ziter->descr[n])) return 1; - - /* DataClass_t */ - if (ziter->data_class && - cgi_write_dataclass(ziter->id, ziter->data_class)) return 1; - - /* DimensionalUnits_t */ - if (ziter->units && - cgi_write_units(ziter->id, ziter->units)) return 1; - - /* DataArray_t */ - for (n=0; nnarrays; n++) - if (cgi_write_array(ziter->id, &ziter->array[n])) return 1; - - /* UserDefinedData_t */ - for (n=0; nnuser_data; n++) - if (cgi_write_user_data(ziter->id, &ziter->user_data[n])) return 1; - - return 0; -} - -int cgi_write_array(double parent_id, cgns_array *array) { - int n, dim_vals; - - if (array->link) { - return cgi_write_link(parent_id, array->name, - array->link, &array->id); - } - - if (cgi_new_node(parent_id, array->name, "DataArray_t", &array->id, - array->data_type, array->data_dim, array->dim_vals, array->data)) - return 1; - - /* DimensionalExponents_t */ - if (array->exponents) { - dim_vals=5; - if (cgi_new_node(array->id, "DimensionalExponents", - "DimensionalExponents_t", &array->exponents->id, - array->exponents->data_type, 1, &dim_vals, array->exponents->data)) - return 1; - } - /* DataConversion_t */ - if (array->convert) { - dim_vals=2; - if (cgi_new_node(array->id, "DataConversion", "DataConversion_t", - &array->convert->id, array->convert->data_type, 1, &dim_vals, - array->convert->data)) return 1; - } - /* DataClass_t */ - if (array->data_class && - cgi_write_dataclass(array->id, array->data_class)) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(array->id, &array->descr[n])) return 1; - - /* DimensionalUnits_t */ - if (array->units && - cgi_write_units(array->id, array->units)) return 1; - - return 0; -} - -int cgi_write_rind(double parent_id, int *rind_planes, int index_dim) { - int n, dim_vals; - double dummy_id; - - /* write Rind only if different from the default (6*0) */ - if (rind_planes==0) return 0; - for (n=0; n<2*index_dim; n++) { - if (rind_planes[n]!=0) { - dim_vals=2*index_dim; - if (cgi_new_node(parent_id, "Rind", "Rind_t", &dummy_id, - "I4", 1, &dim_vals, (void *)rind_planes)) return 1; - return 0; - } - } - return 0; -} - -int cgi_write_units(double parent_id, cgns_units *units) { - char *string_data; - int dim_vals[2]; - double dummy_id; - - if (units->link) { - return cgi_write_link(parent_id, "DimensionalUnits", - units->link, &units->id); - } - - string_data = (char *) malloc ((32*5+1)*sizeof(char)); - if (!string_data) { - cgi_error("Error allocating memory in cgi_write_units."); - return 1; - } - sprintf(string_data,"%-32s%-32s%-32s%-32s%-32s",MassUnitsName[units->mass], - LengthUnitsName[units->length], TimeUnitsName[units->time], - TemperatureUnitsName[units->temperature], AngleUnitsName[units->angle]); - - dim_vals[0]=32; - dim_vals[1]=5; - - if (cgi_new_node(parent_id, "DimensionalUnits", "DimensionalUnits_t", - &dummy_id, "C1", 2, dim_vals, (void *)string_data)) return 1; - - free(string_data); - - return 0; -} - -int cgi_write_dataclass(double parent_id, DataClass_t data_class) { - int dim_vals; - double dummy_id; - - dim_vals=strlen(DataClassName[data_class]); - if (cgi_new_node(parent_id, "DataClass", "DataClass_t", &dummy_id, - "C1", 1, &dim_vals, (void *)DataClassName[data_class])) return 1; - - return 0; -} - -int cgi_write_descr(double parent_id, cgns_descr *descr) { - int dim_vals; - - if (descr->link) { - return cgi_write_link(parent_id, descr->name, - descr->link, &descr->id); - } - - dim_vals=strlen(descr->text); - if (cgi_new_node(parent_id, descr->name, "Descriptor_t", - &descr->id, "C1", 1, &dim_vals, (void *)descr->text)) return 1; - - return 0; -} - -int cgi_write_ordinal(double parent_id, int ordinal) { - int dim_vals; - double dummy_id; - - dim_vals=1; - if (cgi_new_node(parent_id, "Ordinal", "Ordinal_t", &dummy_id, - "I4", 1, &dim_vals, (void *)&ordinal)) return 1; - - return 0; -} - -int cgi_write_user_data(double parent_id, cgns_user_data *user_data) { - int n; - - if (user_data->link) { - return cgi_write_link(parent_id, user_data->name, - user_data->link, &user_data->id); - } - - /* UserDefinedData_t */ - if (cgi_new_node(parent_id, user_data->name, "UserDefinedData_t", - &user_data->id, "MT", 0, 0, 0)) return 1; - - /* Descriptor_t */ - for (n=0; nndescr; n++) - if (cgi_write_descr(user_data->id, &user_data->descr[n])) return 1; - - /* DataClass_t */ - if (user_data->data_class && - cgi_write_dataclass(user_data->id, user_data->data_class)) return 1; - - /* DimensionalUnits_t */ - if (user_data->units && - cgi_write_units(user_data->id, user_data->units)) return 1; - - /* DataArray_t */ - for (n=0; nnarrays; n++) - if (cgi_write_array(user_data->id, &user_data->array[n])) return 1; - - return 0; -} - -int cgi_write_link(double parent_id, char *name, cgns_link *link, double *id) { - int ierr; - - ADF_Link(parent_id, name, link->filename, link->name_in_file, id, &ierr); - if (ierr > 0) { - adf_error("ADF_Link",ierr); - return 1; - } - (cg->added)++; - return 0; -} - - -/* cgi_new_node creates an ADF node under parent_id and returns node_id */ -int cgi_new_node(double parent_id, char const *name, char const *label, - double *node_id, char const *data_type, - int ndim, int const *dim_vals, void const *data) { - int ierr, i; - - /* verify input */ - if (cgi_check_strlen(name) || cgi_check_strlen(label) || - cgi_check_strlen(data_type)) return 1; - - ADF_Create(parent_id, name, node_id, &ierr); - if (ierr>0) { - adf_error("ADF_Create",ierr); - return 1; - } - (cg->added)++; - ADF_Set_Label(*node_id, label, &ierr); - if (ierr>0) { - adf_error("ADF_Set_Label",ierr); - return 1; - } - /* return if empty */ - if (strcmp(data_type, "MT")==0) return 0; - - ADF_Put_Dimension_Information(*node_id, data_type, ndim, dim_vals, &ierr); - if (ierr>0) { - adf_error("ADF_Put_Dimension_Information", ierr); - return 1; - } - - if (data == NULL) return 0; - - /* verify that data doesn't contain NaN */ - if (strcmp(data_type,"I4")==0 || strcmp(data_type,"R4")==0 || - strcmp(data_type,"R8")==0) { - int ndata=1, nbad=0; - - for (i=0; i0) { - adf_error("ADF_Write_All_Data", ierr); - return 1; - } - return 0; -} - -int cgi_move_node(double current_parent_id, double node_id, - double new_parent_id, cchar_33 node_name) { - int ierr=0; - - ADF_Move_Child(current_parent_id, node_id, new_parent_id, &ierr); - if (ierr>0) { - adf_error("ADF_Move_Child",ierr); - return 1; - } - ADF_Put_Name(new_parent_id, node_id, node_name, &ierr); - if (ierr>0) { - adf_error("ADF_Put_Name",ierr); - return 1; - } - return 0; -} - -int cgi_delete_node (double parent_id, double node_id) { - int ierr=0; - (cg->deleted)++; - ADF_Delete (parent_id, node_id, &ierr); - if (ierr > 0) { - adf_error ("ADF_Delete", ierr); - return 1; - } - return 0; -} - -/***********************************************************************\ - * Alphanumerical sorting routine * -\***********************************************************************/ - -int cgi_sort_names(int nnam, double *ids) { - int i,j,k; - int leni, lenj; - char_33 temp; - double temp_id; - char_33 *names; - int ierr=0; - - names = CGNS_NEW(char_33, nnam); - for (i=0; i0) { - adf_error("ADF_Get_Name", ierr); - return 1; - } - } - - for (i=0; i(int)names[i][k]) { - break; - } - if (k==(int)(strlen(names[j])-1)) { - strcpy(temp, names[i]); - strcpy(names[i], names[j]); - strcpy(names[j], temp); - leni=strlen(names[i]); - temp_id = ids[i]; - ids[i]=ids[j]; - ids[j]=temp_id; - } - } - } - } - - free(names); - - return 0; -} - -/***********************************************************************\ - * ADF parser: returns the children id with "label" under "parent_id" * -\***********************************************************************/ - -int cgi_get_nodes(double parent_id, char *label, int *nnodes, double **id) { - int ierr, nid, n, nchildren, len; - char nodelabel[ADF_LABEL_LENGTH+1]; - double *idlist; -#if 0 - double nodeid; -#endif - - *nnodes = 0; - ADF_Number_of_Children (parent_id, &nchildren, &ierr); - if (ierr > 0) { - adf_error ("ADF_Number_of_Children", ierr); - return 1; - } - if (nchildren < 1) return 0; - idlist = CGNS_NEW (double, nchildren); -#if 0 - for (nid = 0, n = 1; n <= nchildren; n++) { - ADF_Children_IDs (parent_id, n, 1, &len, &nodeid, &ierr); - if (ierr > 0) { - adf_error ("ADF_Children_IDs", ierr); - return 1; - } - ADF_Get_Label (nodeid, nodelabel, &ierr); - if (ierr > 0) { - adf_error ("ADF_Get_Label", ierr); - return 1; - } - if (0 == strcmp (nodelabel, label)) - idlist[nid++] = nodeid; -#ifdef HAS_ADF_RELEASE_ID - else - ADF_Release_ID (nodeid); -#endif - } -#else - ADF_Children_IDs (parent_id, 1, nchildren, &len, idlist, &ierr); - if (ierr > 0) { - adf_error ("ADF_Children_IDs", ierr); - return 1; - } - if (len != nchildren) { - cgi_error ("mismatch in number of children and child IDs read"); - return 1; - } - nid = 0; - for (nid = 0, n = 0; n < nchildren; n++) { - ADF_Get_Label (idlist[n], nodelabel, &ierr); - if (ierr > 0) { - adf_error ("ADF_Get_Label", ierr); - return 1; - } - if (0 == strcmp (nodelabel, label)) { - if (nid < n) idlist[nid] = idlist[n]; - nid++; - } -#ifdef HAS_ADF_RELEASE_ID - else - ADF_Release_ID (idlist[n]); -#endif - } -#endif - if (nid > 0) { - *id = idlist; - *nnodes = nid; - } - else - free (idlist); - return 0; -} - -/***********************************************************************\ - * Data Types functions * -\***********************************************************************/ - -char *type_of(char_33 data_type) { - - if (strcmp(data_type, "I4")==0) return "int"; - else if (strcmp(data_type, "R4")==0) return "float"; - else if (strcmp(data_type, "R8")==0) return "double"; - else if (strcmp(data_type, "C1")==0) return "char"; - - else { - cgi_error("data_type '%s' not supported by function 'type_of'",data_type); - return 0; - } -} - -int size_of(char_33 data_type) { - - if (strcmp(data_type, "I4")==0) return sizeof(int); - else if (strcmp(data_type, "R4")==0) return sizeof(float); - else if (strcmp(data_type, "R8")==0) return sizeof(double); - else if (strcmp(data_type, "C1")==0) return sizeof(char); - - else { - cgi_error("data_type '%s' not supported by function 'size_of'",data_type); - return 0; - } -} - -char *cgi_adf_datatype(DataType_t type) { - - if (type==Integer) return "I4"; - else if (type == RealSingle) return "R4"; - else if (type == RealDouble) return "R8"; - else if (type == Character) return "C1"; - return "NULL"; -} - -DataType_t cgi_datatype(cchar_33 adf_type) { - - if (strcmp(adf_type, "I4")==0) return Integer; - else if (strcmp(adf_type, "R4")==0) return RealSingle; - else if (strcmp(adf_type, "R8")==0) return RealDouble; - else if (strcmp(adf_type, "C1")==0) return Character; - return DataTypeNull; -} - -/***********************************************************************\ - * Check input functions * -\***********************************************************************/ - -int cgi_zone_no(cgns_base *base, char *zonename, int *zone_no) { - int i; - - for (i=0; inzones; i++) { - if (strcmp(base->zone[i].name,zonename)==0) { - *zone_no = i+1; - return 0; - } - } - cgi_error("Zone %s not found",zonename); - return 1; -} - -int cgi_check_strlen(char const *string) { - - if (strlen(string) > 32) { - cgi_error("Name exceeds 32 characters limit: %s",string); - return 1; - } - return 0; -} - -int cgi_check_mode(char const *filename, int file_mode, int mode_wanted) { - - if (mode_wanted==MODE_READ && file_mode==MODE_WRITE) { - cgi_error("File %s not open for reading", filename); - return 1; - } - if (mode_wanted==MODE_WRITE && file_mode==MODE_READ) { - cgi_error("File %s not open for writing", filename); - return 1; - } - return 0; -} - -/***********************************************************************\ - * Miscellaneous * -\***********************************************************************/ - -int cgi_add_czone(char_33 zonename, int_6 range, int_6 donor_range, int index_dim, int *ndouble, - char_33 **Dzonename, int_6 **Drange, int_6 **Ddonor_range) { - - int differ=1, k, j; - - /* check if this interface was already found */ - for (k=0; k<(*ndouble); k++) { - differ=0; - if (strcmp(Dzonename[0][k],zonename)) { - differ=1; - continue; - } - for (j=0; j n_cgns_files) { - cgi_error("CGNS file %d is not open",file_number); - return 0; - } - cg = &(cgns_files[file_number-1]); - if (cg->mode == MODE_CLOSED) { - cgi_error("CGNS %d is closed",file_number); - return 0; - } - return cg; -} - -cgns_base *cgi_get_base(cgns_file *cg, int B) { - - if (B>cg->nbases || B<=0) { - cgi_error("Base number %d invalid",B); - return 0; - } - return &(cg->base[B-1]); -} - -cgns_zone *cgi_get_zone(cgns_file *cg, int B, int Z) { - cgns_base *base; - - base = cgi_get_base(cg, B); - if (base==0) return 0; - - if (Z>base->nzones || Z<=0) { - cgi_error("Zone number %d invalid",Z); - return 0; - } - return &(base->zone[Z-1]); -} - -cgns_family *cgi_get_family(cgns_file *cg, int B, int F) { - cgns_base *base; - - base = cgi_get_base(cg, B); - if (base==0) return 0; - - if (F>base->nfamilies || F<=0) { - cgi_error("Family number %d invalid",F); - return 0; - } - return &base->family[F-1]; -} - -cgns_biter *cgi_get_biter(cgns_file *cg, int B) { - cgns_base *base; - - base = cgi_get_base(cg, B); - if (base==0) return 0; - - if (base->biter == 0) { - cgi_error("BaseIterativeData_t node doesn't exist under CGNSBase %d",B); - return 0; - } else return base->biter; -} - -cgns_gravity *cgi_get_gravity(cgns_file *cg, int B) { - cgns_base *base; - - base = cgi_get_base(cg, B); - if (base==0) return 0; - - if (base->gravity==0) { - cgi_error("Gravity_t node doesn't exist under CGNSBase %d",B); - return 0; - } else return base->gravity; -} - -cgns_axisym *cgi_get_axisym(cgns_file *cg, int B) { - cgns_base *base; - - base = cgi_get_base(cg, B); - if (base==0) return 0; - - if (base->axisym==0) { - cgi_error("Axisymmetry_t node doesn't exist under CGNSBase %d",B); - return 0; - } else return base->axisym; -} - -cgns_rotating *cgi_get_rotating(cgns_file *cg, int B, int Z) { - cgns_base *base; - cgns_zone *zone; - - /* RotatingCoordinates_t under a base */ - if (Z==0) { - base = cgi_get_base(cg, B); - if (base==0) return 0; - - if (base->rotating==0) { - cgi_error("RotatingCoordinates_t node doesn't exist under CGNSBase %d",B); - return 0; - } else return base->rotating; - } else { - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return 0; - - if (zone->rotating==0) { - cgi_error("RotatingCoordinates_t node doesn't exist under zone %d",Z); - return 0; - } else return zone->rotating; - } -} - - -cgns_ziter *cgi_get_ziter(cgns_file *cg, int B, int Z) { - cgns_zone *zone; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return 0; - - if (zone->ziter == 0) { - cgi_error("ZoneIterativeData_t node doesn't exist under zone %d",Z); - return 0; - } else return zone->ziter; -} - -cgns_zcoor *cgi_get_zcoorGC(cgns_file *cg, int B, int Z) { - cgns_zone *zone; - int i, index_dim; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return 0; - - index_dim = zone->index_dim; - - if (zone->nzcoor == 0 && (cg->mode == MODE_WRITE || cg->mode == MODE_MODIFY)) { - zone->zcoor = CGNS_NEW(cgns_zcoor, 1); - strcpy(zone->zcoor->name, "GridCoordinates"); - zone->zcoor->id = 0; - zone->zcoor->link = 0; - zone->zcoor->ndescr = 0; - zone->zcoor->rind_planes = CGNS_NEW(int, 2*index_dim); - for (i=0; i<2*index_dim; i++) zone->zcoor->rind_planes[i]=0; - zone->zcoor->ncoords = 0; - zone->zcoor->data_class = DataClassNull; - zone->zcoor->units = 0; - zone->zcoor->nuser_data= 0; - - if (cg->mode == MODE_MODIFY) { - /* Create node GridCoordinates_t node in file */ - if (cgi_new_node(zone->id, "GridCoordinates", "GridCoordinates_t", - &zone->zcoor->id, "MT", 0, 0, 0)) return 0; - } - zone->nzcoor=1; - return zone->zcoor; - } else { - for (i=0; inzcoor; i++) { - if (strcmp(zone->zcoor[i].name,"GridCoordinates")==0) { - return &zone->zcoor[i]; - } - } - } - cgi_error("Node 'GridCoordinates' not found for zone '%s'",zone->name); - return 0; -} - -cgns_zcoor *cgi_get_zcoor(cgns_file *cg, int B, int Z, int C) { - cgns_zone *zone; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return 0; - - if (C>zone->nzcoor || C<=0) { - cgi_error("GridCoordinates node number %d invalid",C); - return 0; - } - return &(zone->zcoor[C-1]); -} - -cgns_sol *cgi_get_sol(cgns_file *cg, int B, int Z, int S) { - cgns_zone *zone; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return 0; - - if (S>zone->nsols || S<=0) { - cgi_error("FlowSolution node number %d invalid",S); - return 0; - } - return &(zone->sol[S-1]); -} - -cgns_section *cgi_get_section(cgns_file *cg, int B, int Z, int S) { - cgns_zone *zone; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return 0; - - if (S>zone->nsections || S<=0) { - cgi_error("Elements_t node number %d invalid",S); - return 0; - } - return &zone->section[S-1]; -} - -cgns_array *cgi_get_field(cgns_file *cg, int B, int Z, int S, int F) { - cgns_sol *sol; - - sol = cgi_get_sol(cg, B, Z, S); - if (sol==0) return 0; - - if (F>sol->nfields || F<=0) { - cgi_error("Solution array number %d invalid",F); - return 0; - } - return &(sol->field[F-1]); -} - -cgns_zconn *cgi_get_zconn(cgns_file *cg, int B, int Z) { - cgns_zone *zone; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return 0; - -/* Allocate automatically only in MODE_WRITE. In MODE_MODIFY, can't do it - because a cg_goto would create the node even if not wanted */ - if (zone->zconn == 0) { - if (cg->mode == MODE_WRITE) { - zone->zconn = CGNS_NEW(cgns_zconn, 1); - strcpy(zone->zconn->name, "ZoneGridConnectivity"); - zone->zconn->id=0; - zone->zconn->link=0; - zone->zconn->ndescr=0; - zone->zconn->n1to1=0; - zone->zconn->nconns=0; - zone->zconn->nholes=0; - zone->zconn->nuser_data=0; - - } else { - cgi_error("No grid connectivity information for zone %d", Z); - return 0; - } - } - return zone->zconn; -} - -cgns_cprop *cgi_get_cprop(cgns_file *cg, int B, int Z, int I) { - cgns_conn *conn; - - conn = cgi_get_conn(cg, B, Z, I); - if (conn==0) return 0; - - if (conn->cprop == 0) - cgi_error("GridConnectivityProperty_t node doesn't exist under GridConnectivity_t %d",I); - - return conn->cprop; -} - -cgns_hole *cgi_get_hole(cgns_file *cg, int B, int Z, int I) { - cgns_zconn *zconn; - - zconn = cgi_get_zconn(cg, B, Z); - if (zconn==0) return 0; - - if (I>zconn->nholes || I<=0) { - cgi_error("OversetHoles node number %d invalid",I); - return 0; - } - return &(zconn->hole[I-1]); -} - -cgns_conn *cgi_get_conn(cgns_file *cg, int B, int Z, int I) { - cgns_zconn *zconn; - - zconn = cgi_get_zconn(cg, B, Z); - if (zconn==0) return 0; - - if (I>zconn->nconns || I<=0) { - cgi_error("GridConnectivity_t node number %d invalid",I); - return 0; - } - return &(zconn->conn[I-1]); -} - -cgns_1to1 *cgi_get_1to1(cgns_file *cg, int B, int Z, int I) { - cgns_zconn *zconn; - - zconn = cgi_get_zconn(cg, B, Z); - if (zconn==0) return 0; - - if (I>zconn->n1to1 || I<=0) { - cgi_error("GridConnectivity1to1_t node number %d invalid",I); - return 0; - } - return &(zconn->one21[I-1]); -} - -cgns_zboco *cgi_get_zboco(cgns_file *cg, int B, int Z) { - cgns_zone *zone; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return 0; - -/* Allocate automatically only in MODE_WRITE. In MODE_MODIFY, can't do it - because a cg_goto would create the node even if not wanted */ - if (zone->zboco == 0) { - if (cg->mode == MODE_WRITE) { - zone->zboco = CGNS_NEW(cgns_zboco, 1); - strcpy(zone->zboco->name,"ZoneBC"); - zone->zboco->id=0; - zone->zboco->link=0; - zone->zboco->ndescr=0; - zone->zboco->nbocos=0; - zone->zboco->state=0; - zone->zboco->data_class=DataClassNull; - zone->zboco->units=0; - zone->zboco->nuser_data=0; - - } else { - cgi_error("No boundary condition data in zone %d",Z); - return 0; - } - } - return zone->zboco; -} - -cgns_bprop *cgi_get_bprop(cgns_file *cg, int B, int Z, int BC) { - cgns_boco *boco; - - boco = cgi_get_boco(cg, B, Z, BC); - if (boco==0) return 0; - - if (boco->bprop == 0) - cgi_error("BCProperty_t node doesn't exist under BC_t %d",BC); - return boco->bprop; -} - -cgns_boco *cgi_get_boco(cgns_file *cg, int B, int Z, int BC) { - cgns_zboco *zboco; - - zboco = cgi_get_zboco(cg, B, Z); - if (zboco==0) return 0; - - if (BC>zboco->nbocos || BC<=0) { - cgi_error("BC_t node number %d invalid",BC); - return 0; - } - return &(zboco->boco[BC-1]); -} - -cgns_dataset *cgi_get_dataset(cgns_file *cg, int B, int Z, int BC, int DSet) { - - cgns_boco *boco = cgi_get_boco(cg, B, Z, BC); - if (boco==0) return 0; - - if (DSet>boco->ndataset || DSet<=0) { - cgi_error("BCDataSet_t node number %d invalid",DSet); - return 0; - } - return &boco->dataset[DSet-1]; -} - -cgns_bcdata *cgi_get_bcdata(cgns_file *cg, int B, int Z, int BC, int Dset, - BCDataType_t type) { - - cgns_dataset *dataset = cgi_get_dataset(cg, B, Z, BC, Dset); - if (dataset==0) return 0; - - if (type==Dirichlet) { - if (dataset->dirichlet==0) { - cgi_error("BCData_t type Dirichlet doesn't exist for Zone %d, BC=%d, BCDataSet=%d", - Z, BC, Dset); - return 0; - } else return dataset->dirichlet; - } else if (type==Neumann) { - if (dataset->neumann==0) { - cgi_error("BCData_t type Neumann doesn't exist for Zone %d, BC=%d, BCDataSet=%d", - Z, BC, Dset); - return 0; - } else return dataset->neumann; - } else { - cgi_error("BCData must be of type Dirichlet or Neumann"); - return 0; - } -} - -cgns_converg *cgi_get_converg(cgns_file *cg, int B, int Z) { - - if (Z==0) { - cgns_base *base=cgi_get_base(cg, B); - if (base==0) return 0; - - if (base->converg== 0) { - cgi_error("ConvergenceHistory_t node doesn't exist under CGNSBase %d",B); - return 0; - } else return base->converg; - } else { - cgns_zone *zone=cgi_get_zone(cg, B, Z); - if (zone==0) return 0; - - if (zone->converg== 0) { - cgi_error("ConvergenceHistory_t node doesn't exist under CGNSBase %d, Zone %d",B,Z); - return 0; - } else return zone->converg; - } -} - -cgns_equations *cgi_get_equations(cgns_file *cg, int B, int Z) { - - if (Z==0) { - cgns_base *base=cgi_get_base(cg, B); - if (base==0) return 0; - -/* todo: error checking if node doesn't exist in all these cgi_get_functions */ -/* also make sure that they are all initialized correctly */ - if (base->equations == 0) { - cgi_error("FlowEquationSet_t Node doesn't exist under CGNSBase %d",B); - return 0; - } else return base->equations; - } else { - cgns_zone *zone=cgi_get_zone(cg, B, Z); - if (zone==0) return 0; - - if (zone->equations == 0) { - cgi_error("FlowEquationSet_t Node doesn't exist under CGNSBase %d, Zone %d",B,Z); - return 0; - } else return zone->equations; - } -} - -cgns_governing *cgi_get_governing(cgns_file *cg, int B, int Z) { - - cgns_equations *eq=cgi_get_equations(cg, B, Z); - if (eq==0) return 0; - - if (eq->governing==0) { - if (Z==0) cgi_error("GoverningEquations_t undefined for CGNSBase %d",B); - else cgi_error("GoverningEquations_t undefined for CGNSBase %d, Zone %d", B, Z); - return 0; - } else return eq->governing; -} - -cgns_model *cgi_get_model(cgns_file *cg, int B, int Z, char *model) { - - cgns_equations *eq=cgi_get_equations(cg, B, Z); - if (eq==0) return 0; - - if (strcmp(model, "GasModel_t")==0 && eq->gas) - return eq->gas; - else if (strcmp(model, "ViscosityModel_t")==0 && eq->visc) - return eq->visc; - else if (strcmp(model, "ThermalConductivityModel_t")==0 && eq->conduct) - return eq->conduct; - else if (strcmp(model, "TurbulenceModel_t")==0 && eq->turbulence) - return eq->turbulence; - else if (strcmp(model, "TurbulenceClosure_t")==0 && eq->closure) - return eq->closure; - else if (strcmp(model, "ThermalRelaxationModel_t")==0 && eq->relaxation) - return eq->relaxation; - else if (strcmp(model, "ChemicalKineticsModel_t")==0 && eq->chemkin) - return eq->chemkin; - else { - if (Z==0) cgi_error("%s undefined for CGNSBase %d",model, B); - else cgi_error("%s undefined for CGNSBase %d, Zone %d",model, B, Z); - return 0; - } -} - -cgns_integral *cgi_get_integral(cgns_file *cg, int B, int Z, int N) { - - if (Z==0) { - cgns_base *base=cgi_get_base(cg, B); - if (base==0) return 0; - - if (N>base->nintegrals || N<=0) { - cgi_error("IntegralData_t node number %d invalid under CGNSBase %d",N, B); - return 0; - } else return &base->integral[N-1]; - } else { - cgns_zone *zone=cgi_get_zone(cg, B, Z); - if (zone==0) return 0; - - if (N>zone->nintegrals || N<=0) { - cgi_error("IntegralData_t node number %d invalid under CGNSBase %d, Zone %d",N,B,Z); - return 0; - } else return &zone->integral[N-1]; - } -} - -cgns_discrete *cgi_get_discrete(cgns_file *cg, int B, int Z, int D) { - cgns_zone *zone; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return 0; - - if (D>zone->ndiscrete || D<=0) { - cgi_error("DiscreteData node number %d invalid",D); - return 0; - } - return &zone->discrete[D-1]; -} - -cgns_rmotion *cgi_get_rmotion(cgns_file *cg, int B, int Z, int R) { - cgns_zone *zone; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return 0; - - if (R>zone->nrmotions || R<=0) { - cgi_error("RigidGridMotion node number %d invalid",R); - return 0; - } - return &zone->rmotion[R-1]; -} - -cgns_amotion *cgi_get_amotion(cgns_file *cg, int B, int Z, int R) { - cgns_zone *zone; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return 0; - - if (R>zone->namotions || R<=0) { - cgi_error("ArbitraryGridMotion node number %d invalid",R); - return 0; - } - return &zone->amotion[R-1]; -} - -cgns_state *cgi_get_state(cgns_file *cg, int B, int Z, int ZBC, int BC, - int Dset) { - - /* defined under CGNSBase_t */ - if (Z==0 && ZBC==0 && BC==0 && Dset==0) { - cgns_base *base = cgi_get_base(cg, B); - if (base==0) return 0; - if (base->state==0) { - cgi_error("ReferenceState_t undefined under CGNSBase %d",B); - return 0; - } else return base->state; - /* defined under Zone_t */ - } else if (ZBC==0 && BC==0 && Dset==0) { - cgns_zone *zone = cgi_get_zone(cg, B, Z); - if (zone==0) return 0; - if (zone->state==0) { - cgi_error("ReferenceState_t undefined under CGNSBase %d, Zone %d",B,Z); - return 0; - } else return zone->state; - /* defined under ZoneBC_t */ - } else if (BC==0 && Dset==0) { - cgns_zboco *zboco = cgi_get_zboco(cg, B, Z); - if (zboco==0) return 0; - if (zboco->state==0) { - cgi_error("ReferenceState_t undefined under CGNSBase %d, Zone %d, ZoneBC_t",B,Z); - return 0; - } else return zboco->state; - /* defined under BC_t */ - } else if (Dset==0) { - cgns_boco *boco = cgi_get_boco(cg, B, Z, BC); - if (boco==0) return 0; - if (boco->state==0) { - cgi_error("ReferenceState_t undefined under CGNSBase %d, Zone %d, BC_t %d",B,Z,BC); - return 0; - } else return boco->state; - /* defined under BCDataSet_t */ - } else { - cgns_dataset *dataset = cgi_get_dataset(cg, B, Z, BC, Dset); - if (dataset==0) return 0; - if (dataset->state==0) { - cgi_error("ReferenceState_t undefined under CGNSBase %d, Zone %d, BC_t %d, BCDataSet %d", B,Z,BC,Dset); - return 0; - } else return dataset->state; - } -} - - -/******************* Functions related to cg_goto **********************************/ - -static void *cgi_get_darray_posit(cgns_array *array, int narrays, int* index, int n, int m) { - - if (array == 0) - return 0; - else if (! (index[m] <= narrays && index[m] > 0)) - cgi_error("DataArray_t node number %d invalid",index[m]); - else if ((n-1) == m) - return (void *)&array[index[m]-1]; - - return 0; -} - -static void *cgi_get_user_data_posit(cgns_user_data *user_data, int nuser_data, - int* index, int n, int m) { - - if (user_data == 0) - return 0; - else if (! (index[m] <= nuser_data && index[m] > 0)) - cgi_error("UserDefinedData_t node number %d invalid",index[m]); - else if ((n-1) == m) - return (void *)&user_data[index[m]-1]; - else - return cgi_get_darray_posit(user_data[index[m]-1].array, - user_data[index[m]-1].narrays, index, n, m+1); - - return 0; -} - -void *cgi_get_posit(int fn, int B, int n, int *index, char **label, int *ier) { -/* This function returns the memory address pointed by the cg_goto arguments. *\ -\* All nodes that can be reached with cg_goto must be represented here. */ - int i, j; - int Z; -#define n_valid_labels 42 - static char *valid_labels[n_valid_labels] = { - "Zone_t", - "GridCoordinates_t", - "DataArray_t", - "FlowSolution_t", - "ZoneGridConnectivity_t", - "OversetHoles_t", - "GridConnectivity_t", - "GridConnectivity1to1_t", - "ZoneBC_t", - "BC_t", - "BCDataSet_t", - "BCData_t", - "DiscreteData_t", - "FlowEquationSet_t", - "GoverningEquations_t", - "GasModel_t", - "ViscosityModel_t", - "ThermalConductivityModel_t", - "TurbulenceModel_t", - "TurbulenceClosure_t", - "ThermalRelaxationModel_t", - "ChemicalKineticsModel_t", - "ConvergenceHistory_t", - "IntegralData_t", - "ReferenceState_t", - "Elements_t", - "Family_t", - "GeometryReference_t", - "RigidGridMotion_t", - "ArbitraryGridMotion_t", - "BaseIterativeData_t", - "ZoneIterativeData_t", - "UserDefinedData_t", - "Gravity_t", - "Axisymmetry_t", - "RotatingCoordinates_t", - "BCProperty_t", - "WallFunction_t", - "Area_t", - "GridConnectivityProperty_t", - "Periodic_t", - "AverageInterface_t" - }; - - /* initialize */ - posit=0; - (*ier)=0; - cg=0; - Z=0; - - /* check input labels */ - for (j=0; j 0) && (strcmp(label[0], "Zone_t") == 0)) { - Z = index[0]; - if (n == 1) { - cgns_zone *zone = cgi_get_zone(cg, B, Z); - posit = (void *)zone; - } - /* Process children of Zone_t. */ - else if ((n > 1) && (strcmp(label[1], "GridCoordinates_t") == 0)) { - cgns_zcoor *zcoor = cgi_get_zcoor(cg, B, Z, index[1]); - if (n == 2) - posit = (void *)zcoor; - else if (zcoor && (n > 2) && (strcmp(label[2], "DataArray_t") == 0)) - posit = cgi_get_darray_posit(zcoor->coord, zcoor->ncoords, index, n, 2); - else if (zcoor && (n > 2) && (strcmp(label[2], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(zcoor->user_data, zcoor->nuser_data, index, n, 2); - - } else if ((n > 1) && (strcmp(label[1], "ZoneIterativeData_t") == 0)) { - cgns_ziter *ziter = cgi_get_ziter(cg, B, Z); - if (n == 2) - posit = (void *)ziter; - else if (ziter && (n > 2) && (strcmp(label[2], "DataArray_t") == 0) ) - posit = cgi_get_darray_posit(ziter->array, ziter->narrays, index, n, 2); - else if (ziter && (n > 2) && (strcmp(label[2], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(ziter->user_data, ziter->nuser_data, index, n, 2); - - } else if ((n > 1) && (strcmp(label[1], "Elements_t") == 0)) { - cgns_zone *zone = cgi_get_zone(cg, B, Z); - cgns_section *section = 0; - - /* check index */ - if (zone && index[1] <= zone->nsections && index[1] > 0) - section = &zone->section[index[1]-1]; - else if (zone) - cgi_error("Elements_t node number %d invalid",index[1]); - - if (n == 2) - posit = (void *) section; - else if (section && (n > 2) && (strcmp(label[2], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(section->user_data, section->nuser_data, index, n, 2); - - } else if ((n > 1) && (strcmp(label[1], "FlowSolution_t") == 0)) { - cgns_sol *sol = cgi_get_sol(cg, B, Z, index[1]); - if (n == 2) - posit = (void *)sol; - else if (sol && (n > 2) && (strcmp(label[2], "DataArray_t") == 0) ) - posit = cgi_get_darray_posit(sol->field, sol->nfields, index, n, 2); - else if (sol && (n > 2) && (strcmp(label[2], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(sol->user_data, sol->nuser_data, index, n, 2); - - } else if ((n > 1) && (strcmp(label[1], "RigidGridMotion_t") == 0)) { - cgns_rmotion *rmotion = cgi_get_rmotion(cg, B, Z, index[1]); - if (n == 2) - posit = (void *)rmotion; - else if (rmotion && (n > 2) && (strcmp(label[2], "DataArray_t") == 0) ) - posit = cgi_get_darray_posit(rmotion->array, rmotion->narrays, index, n, 2); - else if (rmotion && (n > 2) && (strcmp(label[2], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(rmotion->user_data, rmotion->nuser_data, index, n, 2); - - } else if ((n > 1) && (strcmp(label[1], "ArbitraryGridMotion_t") == 0)) { - cgns_amotion *amotion = cgi_get_amotion(cg, B, Z, index[1]); - if (n == 2) - posit = (void *)amotion; - else if (amotion && (n > 2) && (strcmp(label[2], "DataArray_t") == 0) ) - posit = cgi_get_darray_posit(amotion->array, amotion->narrays, index, n, 2); - else if (amotion && (n > 2) && (strcmp(label[2], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(amotion->user_data, amotion->nuser_data, index, n, 2); - - } else if ((n > 1) && (strcmp(label[1], "ZoneGridConnectivity_t") == 0)) { - cgns_zconn *zconn = cgi_get_zconn(cg, B, Z); - if (n == 2) - posit = (void *)zconn; - else if (zconn && (n > 2) && (strcmp(label[2], "OversetHoles_t") == 0) ) { - cgns_hole *hole = cgi_get_hole(cg, B, Z, index[2]); - if (n == 3) - posit = (void *)hole; - else if (hole && (n > 3) && (strcmp(label[3], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(hole->user_data, hole->nuser_data, index, n, 3); - - } else if (zconn && (n > 2) && (strcmp(label[2], "GridConnectivity_t") == 0) ) { - cgns_conn *conn = cgi_get_conn(cg, B, Z, index[2]); - if (n == 3) - posit = (void *)conn; - else if (conn && (n > 3) && (strcmp(label[3], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(conn->user_data, conn->nuser_data, index, n, 3); - else if (conn && (n > 3) && (strcmp(label[3], "GridConnectivityProperty_t") == 0) ) { - cgns_cprop *cprop = cgi_get_cprop(cg, B, Z, index[2]); - if (n == 4) - posit = (void *) cprop; - else if (cprop && (n > 4) && (strcmp(label[4], "Periodic_t") == 0) ) { - cgns_cperio *cperio = cprop -> cperio; - if (n == 5) - posit = (void *) cperio; - else if (cperio && (n > 5) && (strcmp(label[5], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(cperio->user_data, cperio->nuser_data, index, n, 5); - else if (cperio && (n > 5) && (strcmp(label[5], "DataArray_t") == 0) ) - posit = cgi_get_darray_posit(cperio->array, cperio->narrays, index, n, 5); - } else if (cprop && (n > 4) && (strcmp(label[4], "AverageInterface_t") == 0) ) { - cgns_caverage *caverage = cprop -> caverage; - if (n == 5) - posit = (void *) caverage; - else if (caverage && (n > 5) && (strcmp(label[5], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(caverage->user_data, caverage->nuser_data, index, n, 5); - } else if (cprop && (n > 4) && (strcmp(label[4], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(cprop->user_data, cprop->nuser_data, index, n, 4); - } - - - } else if (zconn && (n > 2) && (strcmp(label[2], "GridConnectivity1to1_t") == 0) ) { - cgns_1to1 *conn1to1 = cgi_get_1to1(cg, B, Z, index[2]); - if (n == 3) - posit = (void *)conn1to1; - else if (conn1to1 && (n > 3) && (strcmp(label[3], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(conn1to1->user_data, conn1to1->nuser_data, index, n, 3); - - } else if (zconn && (n > 2) && (strcmp(label[2], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(zconn->user_data, zconn->nuser_data, index, n, 2); - - } else if ((n > 1) && (strcmp(label[1], "ZoneBC_t") == 0)) { - cgns_zboco *zboco = cgi_get_zboco(cg, B, Z); - if (n == 2) - posit = (void *)zboco; - else if (zboco && (n > 2) && (strcmp(label[2], "BC_t") == 0) ) { - cgns_boco *boco = cgi_get_boco(cg, B, Z, index[2]); - if (n == 3) - posit = (void *)boco; - else if (boco && (n > 3) && (strcmp(label[3], "BCDataSet_t") == 0) ) { - cgns_dataset *dataset = cgi_get_dataset(cg, B, Z, index[2], index[3]); - if (n == 4) - posit = (void *)dataset; - else if (dataset && (n > 4) && (strcmp(label[4], "BCData_t") == 0) ) { - cgns_bcdata *bcdata = cgi_get_bcdata(cg, B, Z, index[2], index[3], - (BCDataType_t)index[4]); - if (n == 5) - posit = (void *)bcdata; - else if (bcdata && (n > 5) && (strcmp(label[5], "DataArray_t") == 0) ) - posit = cgi_get_darray_posit(bcdata->array, bcdata->narrays, index, n, 5); - else if (bcdata && (n > 5) && (strcmp(label[5], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(bcdata->user_data, bcdata->nuser_data, - index, n, 5); - - } else if (dataset && (n > 4) && (strcmp(label[4], "ReferenceState_t") == 0) ) { - cgns_state *state = cgi_get_state(cg, B, Z, index[1], index[2], index[3]); - if (n == 4) - posit = (void *)state; - else if (state && (n > 4) && (strcmp(label[4], "DataArray_t") == 0)) - posit = cgi_get_darray_posit(state->array, state->narrays, index, n, 4); - else if (state && (n > 4) && (strcmp(label[4], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(state->user_data, state->nuser_data, - index, n, 4); - - } else if (dataset && (n > 4) && (strcmp(label[4], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(dataset->user_data, dataset->nuser_data, - index, n, 4); - - } else if (boco && (n > 3) && (strcmp(label[3], "ReferenceState_t") == 0) ) { - cgns_state *state = cgi_get_state(cg, B, Z, index[1], index[2], 0); - if (n == 4) - posit = (void *)state; - else if (state && (n > 4) && (strcmp(label[4], "DataArray_t") == 0)) - posit = cgi_get_darray_posit(state->array, state->narrays, index, n, 4); - else if (state && (n > 4) && (strcmp(label[4], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(state->user_data, state->nuser_data, index, n, 4); - - } else if (boco && (n > 3) && (strcmp(label[3], "BCProperty_t") == 0) ) { - cgns_bprop *bprop = cgi_get_bprop(cg, B, Z, index[2]); - if (n == 4) - posit = (void *) bprop; - else if (bprop && (n > 4) && (strcmp(label[4], "WallFunction_t") == 0) ) { - cgns_bcwall *bcwall = bprop -> bcwall; - if (n == 5) - posit = (void *) bcwall; - else if (bcwall && (n > 5) && (strcmp(label[5], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(bcwall->user_data, bcwall->nuser_data, index, n, 5); - } else if (bprop && (n > 4) && (strcmp(label[4], "Area_t") == 0) ) { - cgns_bcarea *bcarea = bprop -> bcarea; - if (n == 5) - posit = (void *) bcarea; - else if (bcarea && (n > 5) && (strcmp(label[5], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(bcarea->user_data, bcarea->nuser_data, index, n, 5); - else if (bcarea && (n > 5) && (strcmp(label[5], "DataArray_t") == 0)) - posit = cgi_get_darray_posit(bcarea->array, bcarea->narrays, index, n, 5); - } else if (bprop && (n > 4) && (strcmp(label[4], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(bprop->user_data, bprop->nuser_data, index, n, 4); - - } else if (boco && (n > 3) && (strcmp(label[3], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(boco->user_data, boco->nuser_data, index, n, 3); - - } else if (zboco && (n > 2) && (strcmp(label[2], "ReferenceState_t") == 0) ) { - cgns_state *state = cgi_get_state(cg, B, Z, index[1], 0, 0); - if (n == 3) - posit = (void *)state; - else if (state && (n > 3) && (strcmp(label[3], "DataArray_t") == 0)) - posit = cgi_get_darray_posit(state->array, state->narrays, index, n, 3); - else if (state && (n > 3) && (strcmp(label[3], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(state->user_data, state->nuser_data, index, n, 3); - - } else if (zboco && (n > 2) && (strcmp(label[2], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(zboco->user_data, zboco->nuser_data, index, n, 2); - - } else if ((n > 1) && (strcmp(label[1], "DiscreteData_t") == 0)) { - cgns_discrete *discrete = cgi_get_discrete(cg, B, Z, index[1]); - if (n == 2) - posit = (void *)discrete; - else if (discrete && (n > 2) && (strcmp(label[2], "DataArray_t") == 0) ) - posit = cgi_get_darray_posit(discrete->array, discrete->narrays, index, n, 2); - else if (discrete && (n > 2) && (strcmp(label[2], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(discrete->user_data, discrete->nuser_data, index, n, 2); - - } else if ((n > 1) && (strcmp(label[1], "FlowEquationSet_t") == 0)) { - if (n == 2) { - cgns_equations *equations = cgi_get_equations(cg, B, Z); - posit = (void *)equations; - - } else if ((n > 2) && (strcmp(label[2], "GoverningEquations_t") == 0) ) { - cgns_governing *governing = cgi_get_governing(cg, B, Z); - - if (n == 3) - posit = (void *)governing; - else if (governing && (n > 3) && (strcmp(label[3], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(governing->user_data, governing->nuser_data, - index, n, 3); - - } else if (n > 2 && (strcmp(label[2], "GasModel_t") == 0 - || strcmp(label[2], "ViscosityModel_t") == 0 - || strcmp(label[2], "ThermalConductivityModel_t") == 0 - || strcmp(label[2], "TurbulenceModel_t") == 0 - || strcmp(label[2], "TurbulenceClosure_t") == 0 - || strcmp(label[2], "ThermalRelaxationModel_t") == 0 - || strcmp(label[2], "ChemicalKineticsModel_t") == 0)) { - cgns_model *model = cgi_get_model(cg, B, Z, label[2]); - if (n == 3) - posit = (void *)model; - else if (model && (n > 3) && (strcmp(label[3], "DataArray_t") == 0)) - posit = cgi_get_darray_posit(model->array, model->narrays, index, n, 3); - else if (model && (n > 3) && (strcmp(label[3], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(model->user_data, model->nuser_data, index, n, 3); - - } else if ((n > 2) && (strcmp(label[2], "UserDefinedData_t") == 0)) { - cgns_equations *equations = cgi_get_equations(cg, B, Z); - if (equations) - posit = cgi_get_user_data_posit(equations->user_data, equations->nuser_data, - index, n, 2); - } - - } else if ((n > 1) && (strcmp(label[1], "ConvergenceHistory_t") == 0)) { - cgns_converg *converg = cgi_get_converg(cg, B, Z); - if (n == 2) - posit = (void *)converg; - else if (converg && (n > 2) && (strcmp(label[2], "DataArray_t") == 0) ) - posit = cgi_get_darray_posit(converg->array, converg->narrays, index, n, 2); - else if (converg && (n > 2) && (strcmp(label[2], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(converg->user_data, converg->nuser_data, index, n, 2); - - } else if ((n > 1) && (strcmp(label[1], "IntegralData_t") == 0)) { - cgns_integral *integral = cgi_get_integral(cg, B, Z, index[1]); - if (n == 2) - posit = (void *)integral; - else if (integral && (n > 2) && (strcmp(label[2], "DataArray_t") == 0) ) - posit = cgi_get_darray_posit(integral->array, integral->narrays, index, n, 2); - else if (integral && (n > 2) && (strcmp(label[2], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(integral->user_data, integral->nuser_data, index, n, 2); - - } else if ((n > 1) && (strcmp(label[1], "ReferenceState_t") == 0)) { - cgns_state *state = cgi_get_state(cg, B, Z, 0, 0, 0); - if (n == 2) - posit = (void *)state; - else if (state && (n > 2) && (strcmp(label[2], "DataArray_t") == 0)) - posit = cgi_get_darray_posit(state->array, state->narrays, index, n, 2); - else if (state && (n > 2) && (strcmp(label[2], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(state->user_data, state->nuser_data, index, n, 2); - - } else if ((n > 1) && (strcmp(label[1], "UserDefinedData_t") == 0)) { - cgns_zone *zone = cgi_get_zone(cg, B, Z); - if (zone) - posit = cgi_get_user_data_posit(zone->user_data, zone->nuser_data, index, n, 1); - - } else if ((n > 1) && (strcmp(label[1], "RotatingCoordinates_t") == 0)) { - cgns_rotating *rotating = cgi_get_rotating(cg, B, Z); - if (n == 2) - posit = (void *)rotating; - else if (rotating && (n > 2) && (strcmp(label[2], "DataArray_t") == 0)) - posit = cgi_get_darray_posit(rotating->array, rotating->narrays, index, n, 2); - else if (rotating && (n > 2) && (strcmp(label[2], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(rotating->user_data, rotating->nuser_data, index, n, 2); - } - /* Process children of the base node other than Zone_t. */ - } else if ((n > 0) && (strcmp(label[0], "ReferenceState_t") == 0)) { - cgns_state *state = cgi_get_state(cg, B, 0, 0, 0, 0); - if (n == 1) - posit = (void *)state; - else if (state && (n > 1) && (strcmp(label[1], "DataArray_t") == 0)) - posit = cgi_get_darray_posit(state->array, state->narrays, index, n, 1); - else if (state && (n > 1) && (strcmp(label[1], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(state->user_data, state->nuser_data, index, n, 1); - - } else if ((n > 0) && (strcmp(label[0], "Family_t") == 0)) { - cgns_family *family = cgi_get_family(cg, B, index[0]); - if (n == 1) { - posit = (void *)family; - } else if (family && (n > 1) && (strcmp(label[1], "GeometryReference_t") == 0) ) { - cgns_geo *geo = 0; - - /* check index */ - if (family && index[1] <= family->ngeos && index[1] > 0) - geo = &family->geo[index[1]-1]; - else - cgi_error("GeometryReference_t node number %d invalid",index[1]); - - if (n == 2) - posit = (void *)geo; - else if (geo && (n > 2) && (strcmp(label[2], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(geo->user_data, geo->nuser_data, index, n, 2); - - } else if (family && (n > 1) && (strcmp(label[1], "UserDefinedData_t") == 0) ) { - posit = cgi_get_user_data_posit(family->user_data, family->nuser_data, index, n, 1); - } - - } else if ((n > 0) && (strcmp(label[0], "BaseIterativeData_t") == 0)) { - cgns_biter *biter = cgi_get_biter(cg, B); - if (n == 1) - posit = (void *)biter; - else if (biter && (n > 1) && (strcmp(label[1], "DataArray_t") == 0) ) - posit = cgi_get_darray_posit(biter->array, biter->narrays, index, n, 1); - else if (biter && (n > 1) && (strcmp(label[1], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(biter->user_data, biter->nuser_data, index, n, 1); - - } else if ((n > 0) && (strcmp(label[0], "ConvergenceHistory_t") == 0)) { - cgns_converg *converg = cgi_get_converg(cg, B, 0); - if (n == 1) - posit = (void *)converg; - else if (converg && (n > 1) && (strcmp(label[1], "DataArray_t") == 0) ) - posit = cgi_get_darray_posit(converg->array, converg->narrays, index, n, 1); - else if (converg && (n > 1) && (strcmp(label[1], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(converg->user_data, converg->nuser_data, index, n, 1); - - } else if ((n > 0) && (strcmp(label[0], "FlowEquationSet_t") == 0)) { - if (n == 1) { - cgns_equations *equations = cgi_get_equations(cg, B, 0); - posit = (void *)equations; - } else if ((n > 1) && (strcmp(label[1], "GoverningEquations_t") == 0) ) { - cgns_governing *governing = cgi_get_governing(cg, B, 0); - - if (n == 2) - posit = (void *)governing; - else if (governing && (n > 2) && (strcmp(label[2], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(governing->user_data, governing->nuser_data, index, n, 2); - - } else if (n > 1 && (strcmp(label[1], "GasModel_t") == 0 - || strcmp(label[1], "ViscosityModel_t") == 0 - || strcmp(label[1], "ThermalConductivityModel_t") == 0 - || strcmp(label[1], "TurbulenceModel_t") == 0 - || strcmp(label[1], "TurbulenceClosure_t") == 0 - || strcmp(label[1], "ThermalRelaxationModel_t") == 0 - || strcmp(label[1], "ChemicalKineticsModel_t") == 0)) { - cgns_model *model = cgi_get_model(cg, B, 0, label[1]); - - if (n == 2) posit = (void *)model; - - else if (model && (n > 2) && (strcmp(label[2], "DataArray_t") == 0)) - posit = cgi_get_darray_posit(model->array, model->narrays, index, n, 2); - else if (model && (n > 2) && (strcmp(label[2], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(model->user_data, model->nuser_data, index, n, 2); - - } else if ((n > 1) && (strcmp(label[1], "UserDefinedData_t") == 0)) { - cgns_equations *equations = cgi_get_equations(cg, B, 0); - if (equations) - posit = cgi_get_user_data_posit(equations->user_data, equations->nuser_data, index, n, 1); - } - - } else if ((n > 0) && (strcmp(label[0], "IntegralData_t") == 0)) { - cgns_integral *integral = cgi_get_integral(cg, B, 0, index[0]); - if (n == 1) - posit = (void *)integral; - else if (integral && (n > 1) && (strcmp(label[1], "DataArray_t") == 0) ) - posit = cgi_get_darray_posit(integral->array, integral->narrays, index, n, 1); - else if (integral && (n > 1) && (strcmp(label[1], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(integral->user_data, integral->nuser_data, index, n, 1); - - } else if ((n > 0) && (strcmp(label[0], "UserDefinedData_t") == 0)) { - cgns_base *base = cgi_get_base(cg, B); - if (base) - posit = cgi_get_user_data_posit(base->user_data, base->nuser_data, index, n, 0); - - } else if ((n > 0) && (strcmp(label[0], "Gravity_t") == 0)) { - cgns_gravity *gravity = cgi_get_gravity(cg, B); - if (n == 1) - posit = (void *)gravity; - else if (gravity && (n > 1) && (strcmp(label[1], "DataArray_t") == 0) ) - posit = cgi_get_darray_posit(gravity->vector, gravity->narrays, index, n, 1); - else if (gravity && (n > 1) && (strcmp(label[1], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(gravity->user_data, gravity->nuser_data, index, n, 1); - - } else if ((n > 0) && (strcmp(label[0], "Axisymmetry_t") == 0)) { - cgns_axisym *axisym = cgi_get_axisym(cg, B); - if (n == 1) - posit = (void *)axisym; - else if (axisym && (n > 1) && (strcmp(label[1], "DataArray_t") == 0) ) - posit = cgi_get_darray_posit(axisym->array, axisym->narrays, index, n, 1); - else if (axisym && (n > 1) && (strcmp(label[1], "UserDefinedData_t") == 0) ) - posit = cgi_get_user_data_posit(axisym->user_data, axisym->nuser_data, index, n, 1); - - } else if ((n > 0) && (strcmp(label[0], "RotatingCoordinates_t") == 0)) { - cgns_rotating *rotating = cgi_get_rotating(cg, B, 0); - if (n == 1) - posit = (void *)rotating; - else if (rotating && (n > 1) && (strcmp(label[1], "DataArray_t") == 0)) - posit = cgi_get_darray_posit(rotating->array, rotating->narrays, index, n, 1); - else if (rotating && (n > 1) && (strcmp(label[1], "UserDefinedData_t") == 0)) - posit = cgi_get_user_data_posit(rotating->user_data, rotating->nuser_data, index, n, 1); - - } else { - cgi_error("The path prescribed in the 'cg_goto' function is not valid."); - (*ier)=CG_INCORRECT_PATH; - return 0; - } - - if (posit==0) { - cgi_error("The path specified in function 'cg_goto' lead to a non-existant node"); - (*ier)=CG_NODE_NOT_FOUND; - } - return posit; -} - - - -int (cgi_posit_id(double *posit_id)) { - -/* This function returns the ADF ID number (ADF address) of the ADF node *\ -|* pointed to by the arguments of the cg_goto function. Every ADF nodes *| -\* that can be reached with the cg_goto function must be represented here. */ - - /* check for valid posit */ - if (posit == 0) { - cgi_error("No current position set by cg_goto\n"); - return 1; - } - - if (strcmp(posit_label,"CGNSBase_t")==0) { - cgns_base *parent = (cgns_base *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"Zone_t")==0) { - cgns_zone *parent = (cgns_zone *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"GridCoordinates_t")==0) { - cgns_zcoor *parent = (cgns_zcoor *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"DataArray_t")==0) { - cgns_array *parent = (cgns_array *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"FlowSolution_t")==0) { - cgns_sol *parent = (cgns_sol *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"ZoneGridConnectivity_t")==0) { - cgns_zconn *parent = (cgns_zconn *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"OversetHoles_t")==0) { - cgns_hole *parent = (cgns_hole *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"GridConnectivity_t")==0) { - cgns_conn *parent = (cgns_conn *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"GridConnectivity1to1_t")==0) { - cgns_1to1 *parent = (cgns_1to1 *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"ZoneBC_t")==0) { - cgns_zboco *parent = (cgns_zboco *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"BC_t")==0) { - cgns_boco *parent = (cgns_boco *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"BCDataSet_t")==0) { - cgns_dataset *parent = (cgns_dataset *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"BCData_t")==0) { - cgns_bcdata *parent = (cgns_bcdata *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"DiscreteData_t")==0) { - cgns_discrete *parent = (cgns_discrete *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"FlowEquationSet_t")==0) { - cgns_equations *parent = (cgns_equations *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"GoverningEquations_t")==0) { - cgns_governing *parent = (cgns_governing *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"GasModel_t")==0 || - strcmp(posit_label,"ViscosityModel_t")==0 || - strcmp(posit_label,"ThermalConductivityModel_t")==0 || - strcmp(posit_label,"TurbulenceModel_t")==0 || - strcmp(posit_label,"TurbulenceClosure_t")==0 || - strcmp(posit_label,"ThermalRelaxationModel_t")==0 || - strcmp(posit_label,"ChemicalKineticsModel_t")==0) { - cgns_model *parent = (cgns_model *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"ConvergenceHistory_t")==0) { - cgns_converg *parent = (cgns_converg *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"IntegralData_t")==0) { - cgns_integral *parent = (cgns_integral *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"ReferenceState_t")==0) { - cgns_state *parent = (cgns_state *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"Family_t")==0) { - cgns_family *parent = (cgns_family *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"GeometryReference_t")==0) { - cgns_geo *parent = (cgns_geo *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"Elements_t")==0) { - cgns_section *parent = (cgns_section *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"RigidGridMotion_t")==0) { - cgns_rmotion *parent = (cgns_rmotion *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"ArbitraryGridMotion_t")==0) { - cgns_amotion *parent = (cgns_amotion *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"BaseIterativeData_t")==0) { - cgns_biter *parent = (cgns_biter *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"ZoneIterativeData_t")==0) { - cgns_ziter *parent = (cgns_ziter *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"UserDefinedData_t")==0) { - cgns_user_data *parent = (cgns_user_data *)posit; - (*posit_id) = parent->id; - - } else if (strcmp(posit_label,"Gravity_t")==0) { - cgns_gravity *gravity = (cgns_gravity *)posit; - (*posit_id) = gravity->id; - - } else if (strcmp(posit_label,"Axisymmetry_t")==0) { - cgns_axisym *axisym = (cgns_axisym *)posit; - (*posit_id) = axisym->id; - - } else if (strcmp(posit_label,"RotatingCoordinates_t")==0) { - cgns_rotating *rotating = (cgns_rotating *)posit; - (*posit_id) = rotating->id; - - } else if (strcmp(posit_label,"BCProperty_t")==0) { - cgns_bprop *bprop = (cgns_bprop *) posit; - (*posit_id) = bprop->id; - - } else if (strcmp(posit_label,"WallFunction_t")==0) { - cgns_bcwall *bcwall = (cgns_bcwall *) posit; - (*posit_id) = bcwall->id; - - } else if (strcmp(posit_label,"Area_t")==0) { - cgns_bcarea *bcarea = (cgns_bcarea *) posit; - (*posit_id) = bcarea->id; - - } else if (strcmp(posit_label,"GridConnectivityProperty_t")==0) { - cgns_cprop *cprop = (cgns_cprop *) posit; - (*posit_id) = cprop->id; - - } else if (strcmp(posit_label,"Periodic_t")==0) { - cgns_cperio *cperio = (cgns_cperio *) posit; - (*posit_id) = cperio->id; - - } else if (strcmp(posit_label,"AverageInterface_t")==0) { - cgns_caverage *caverage = (cgns_caverage *) posit; - (*posit_id) = caverage->id; - - } else { - cgi_error("Can't find the ADF ID of node %s",posit_label); - return 1; - } - - return 0; -} - -/* All cgi_xxxxx_address functions return the memory address of the given *\ - * xxxxx data structure, depending on the parent pointed to by cg_goto. * -\* All possible parents of a given data structure must be represented. */ - -cgns_descr *cgi_descr_address(int local_mode, int given_no, char const *given_name, int *ier) { - cgns_descr *descr=0; - int n, error1=0, error2=0; - double parent_id=0; - - /* check for valid posit */ - if (posit == 0) { - cgi_error("No current position set by cg_goto\n"); - (*ier) = CG_ERROR; - return 0; - } - -/* Possible parents of Descriptor_t node: - * CGNSBase_t, Zone_t, GridCoordinates_t, Elements_t, FlowSolution_t, - * DiscreteData_t, ZoneGridConnectivity_t, GridConnectivity1to1_t, - * GridConnectivity_t, OversetHoles_t, ZoneBC_t, BC_t, BCDataSet_t, - * BCData_t, FlowEquationSet_t, GoverningEquations_t, GasModel_t, - * ViscosityModel_t, ThermalConductivityModel_t, TurbulenceClosure_t, - * TurbulenceModel_t, ThermalRelaxationModel_t, ChemicalKineticsModel_t, - * ConvergenceHistory_t, IntegralData_t, ReferenceState_t, - * DataArray_t, Family_t, GeometryReference_t, RigidGridMotion_t, - * ArbitraryGridMotion_t, BaseIterativeData_t, ZoneIterativeData_t, - * UserDefinedData_t, Gravity_t, Axisymmetry_t, RotatingCoordinates_t, - * BCProperty_t, WallFunction_t, Area_t, - * GridConnectivityProperty_t, Periodic_t, AverageInterface_t - */ - - if (strcmp(posit_label,"CGNSBase_t")==0) - ADDRESS4MULTIPLE(cgns_base, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"Zone_t")==0) - ADDRESS4MULTIPLE(cgns_zone, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"GridCoordinates_t")==0) - ADDRESS4MULTIPLE(cgns_zcoor, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"Elements_t")==0) - ADDRESS4MULTIPLE(cgns_section, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"FlowSolution_t")==0) - ADDRESS4MULTIPLE(cgns_sol, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"DiscreteData_t")==0) - ADDRESS4MULTIPLE(cgns_discrete, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"ZoneGridConnectivity_t")==0) - ADDRESS4MULTIPLE(cgns_zconn, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"GridConnectivity1to1_t")==0) - ADDRESS4MULTIPLE(cgns_1to1, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"GridConnectivity_t")==0) - ADDRESS4MULTIPLE(cgns_conn, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"OversetHoles_t")==0) - ADDRESS4MULTIPLE(cgns_hole, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"ZoneBC_t")==0) - ADDRESS4MULTIPLE(cgns_zboco, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"BC_t")==0) - ADDRESS4MULTIPLE(cgns_boco, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"BCDataSet_t")==0) - ADDRESS4MULTIPLE(cgns_dataset, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"BCData_t")==0) - ADDRESS4MULTIPLE(cgns_bcdata, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"FlowEquationSet_t")==0) - ADDRESS4MULTIPLE(cgns_equations, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"GoverningEquations_t")==0) - ADDRESS4MULTIPLE(cgns_governing, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"GasModel_t")==0 || - strcmp(posit_label,"ViscosityModel_t")==0 || - strcmp(posit_label,"ThermalConductivityModel_t")==0 || - strcmp(posit_label,"TurbulenceModel_t")==0 || - strcmp(posit_label,"TurbulenceClosure_t")==0 || - strcmp(posit_label,"ThermalRelaxationModel_t")==0 || - strcmp(posit_label,"ChemicalKineticsModel_t")==0) - ADDRESS4MULTIPLE(cgns_model, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"ConvergenceHistory_t")==0) - ADDRESS4MULTIPLE(cgns_converg, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"IntegralData_t")==0) - ADDRESS4MULTIPLE(cgns_integral, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"ReferenceState_t")==0) - ADDRESS4MULTIPLE(cgns_state, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"DataArray_t")==0) - ADDRESS4MULTIPLE(cgns_array, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"Family_t")==0) - ADDRESS4MULTIPLE(cgns_family, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"GeometryReference_t")==0) - ADDRESS4MULTIPLE(cgns_geo, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"RigidGridMotion_t")==0) - ADDRESS4MULTIPLE(cgns_rmotion, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"ArbitraryGridMotion_t")==0) - ADDRESS4MULTIPLE(cgns_amotion, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"BaseIterativeData_t")==0) - ADDRESS4MULTIPLE(cgns_biter, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"ZoneIterativeData_t")==0) - ADDRESS4MULTIPLE(cgns_ziter, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"UserDefinedData_t")==0) - ADDRESS4MULTIPLE(cgns_user_data, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"Gravity_t")==0) - ADDRESS4MULTIPLE(cgns_gravity, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"Axisymmetry_t")==0) - ADDRESS4MULTIPLE(cgns_axisym, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"RotatingCoordinates_t")==0) - ADDRESS4MULTIPLE(cgns_rotating, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"BCProperty_t")==0) - ADDRESS4MULTIPLE(cgns_bprop, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"WallFunction_t")==0) - ADDRESS4MULTIPLE(cgns_bcwall, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"Area_t")==0) - ADDRESS4MULTIPLE(cgns_bcarea, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"GridConnectivityProperty_t")==0) - ADDRESS4MULTIPLE(cgns_cprop, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"Periodic_t")==0) - ADDRESS4MULTIPLE(cgns_cperio, ndescr, descr, cgns_descr) - else if (strcmp(posit_label,"AverageInterface_t")==0) - ADDRESS4MULTIPLE(cgns_caverage, ndescr, descr, cgns_descr) - else { - cgi_error("Descriptor_t node not supported under '%s' type node (cgi_descr_address)", - posit_label); - (*ier) = CG_INCORRECT_PATH; - return 0; - } - - if (error1) { - cgi_error("Duplicate child name found (%s) found under %s", - given_name, posit_label); - (*ier) = CG_ERROR; - return 0; - } - if (error2) { - cgi_error("Descriptor number %d doesn't exist under %s", - given_no, posit_label); - (*ier) = CG_NODE_NOT_FOUND; - return 0; - } - if (parent_id) { /* parent_id!=0 only when overwriting */ - if (cgi_delete_node (parent_id, descr->id)) { - (*ier) = CG_ERROR; - return 0; - } - cgi_free_descr(descr); - } - return descr; -} - -char *cgi_famname_address(int local_mode, int *ier) { - double *id, parent_id; - char *family_name=0; - int nnod; - - /* check for valid posit */ - if (posit == 0) { - cgi_error("No current position set by cg_goto\n"); - (*ier) = CG_ERROR; - return 0; - } - -/* Possible parents of FamilyName_t node: - * Zone_t, BC_t - */ - if (strcmp(posit_label,"Zone_t")==0) { - cgns_zone *zone = (cgns_zone *)posit; - family_name = zone->family_name; - parent_id = zone->id; - } else if (strcmp(posit_label,"BC_t")==0) { - cgns_boco *boco = (cgns_boco *)posit; - family_name = boco->family_name; - parent_id = boco->id; - - } else { - cgi_error("FamilyName_t node not supported under '%s' type node",posit_label); - (*ier) = CG_INCORRECT_PATH; - return 0; - } - if (cg->mode == MODE_MODIFY && local_mode == MODE_WRITE) { - if (cgi_get_nodes(parent_id, "FamilyName_t", &nnod, &id)) { - *ier = CG_ERROR; - return 0; - } - if (nnod>0) { - if (cgi_delete_node (parent_id, id[0])) { - (*ier) = CG_ERROR; - return 0; - } - free(id); - } - } - return family_name; -} - - -DataClass_t *cgi_dataclass_address(int local_mode, int *ier) { - double *id, parent_id; - DataClass_t *data_class=0; - int nnod; - - /* check for valid posit */ - if (posit == 0) { - cgi_error("No current position set by cg_goto\n"); - (*ier) = CG_ERROR; - return 0; - } - -/* Possible parents of DataClass_t node: - * CGNSBase_t, Zone_t, GridCoordinates_t, FlowSolution_t, DiscreteData_t, - * ZoneBC_t, BC_t, BCDataSet_t, BCData_t, FlowEquationSet_t, GasModel_t, - * ViscosityModel_t, ThermalConductivityModel_t, TurbulenceClosure_t, - * TurbulenceModel_t, ThermalRelaxationModel_t, ChemicalKineticsModel_t, - * ConvergenceHistory_t, IntegralData_t, ReferenceState_t, - * DataArray_t, RigidGridMotion_t, ArbitraryGridMotion_t, BaseIterativeData_t, - * ZoneIterativeData_t, UserDefinedData_t, Gravity_t, Axisymmetry_t - * RotatingCoordinates_t, Periodic_t - */ - if (strcmp(posit_label,"CGNSBase_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_base, data_class) - else if (strcmp(posit_label,"Zone_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_zone, data_class) - else if (strcmp(posit_label,"GridCoordinates_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_zcoor, data_class) - else if (strcmp(posit_label,"FlowSolution_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_sol, data_class) - else if (strcmp(posit_label,"DiscreteData_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_discrete, data_class) - else if (strcmp(posit_label,"ZoneBC_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_zboco, data_class) - else if (strcmp(posit_label,"BC_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_boco, data_class) - else if (strcmp(posit_label,"BCDataSet_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_dataset, data_class) - else if (strcmp(posit_label,"BCData_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_bcdata, data_class) - else if (strcmp(posit_label,"FlowEquationSet_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_equations, data_class) - else if (strcmp(posit_label,"GasModel_t")==0 || - strcmp(posit_label,"ViscosityModel_t")==0 || - strcmp(posit_label,"ThermalConductivityModel_t")==0 || - strcmp(posit_label,"TurbulenceModel_t")==0 || - strcmp(posit_label,"TurbulenceClosure_t")==0 || - strcmp(posit_label,"ThermalRelaxationModel_t")==0 || - strcmp(posit_label,"ChemicalKineticsModel_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_model, data_class) - else if (strcmp(posit_label,"ConvergenceHistory_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_converg, data_class) - else if (strcmp(posit_label,"IntegralData_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_integral, data_class) - else if (strcmp(posit_label,"ReferenceState_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_state, data_class) - else if (strcmp(posit_label,"DataArray_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_array, data_class) - else if (strcmp(posit_label,"RigidGridMotion_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_rmotion, data_class) - else if (strcmp(posit_label,"ArbitraryGridMotion_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_amotion, data_class) - else if (strcmp(posit_label,"BaseIterativeData_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_biter, data_class) - else if (strcmp(posit_label,"ZoneIterativeData_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_ziter, data_class) - else if (strcmp(posit_label,"UserDefinedData_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_user_data, data_class) - else if (strcmp(posit_label,"Gravity_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_gravity, data_class) - else if (strcmp(posit_label,"Axisymmetry_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_axisym, data_class) - else if (strcmp(posit_label,"RotatingCoordinates_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_rotating, data_class) - else if (strcmp(posit_label,"Periodic_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_cperio, data_class) - else { - cgi_error("DataClass_t node not supported under '%s' type node",posit_label); - (*ier) = CG_INCORRECT_PATH; - return 0; - } - if (cg->mode == MODE_MODIFY && local_mode == MODE_WRITE) { - if (cgi_get_nodes(parent_id, "DataClass_t", &nnod, &id)) return 0; - if (nnod>0) { - if (cgi_delete_node (parent_id, id[0])) { - (*ier) = CG_ERROR; - return 0; - } - free(id); - } - } - return data_class; -} - -cgns_units *cgi_units_address(int local_mode, int *ier) { - cgns_units *units=0; - double parent_id=0; - int error1=0; - - /* check for valid posit */ - if (posit == 0) { - cgi_error("No current position set by cg_goto\n"); - (*ier) = CG_ERROR; - return 0; - } - -/* Possible parents of DimensionalUnits_t node: - * CGNSBase_t, Zone_t, GridCoordinates_t, FlowSolution_t, DiscreteData_t, - * ZoneBC_t, BC_t, BCDataSet_t, BCData_t, FlowEquationSet_t, GasModel_t, - * ViscosityModel_t, ThermalConductivityModel_t, TurbulenceClosure_t, - * TurbulenceModel_t, ThermalRelaxationModel_t, ChemicalKineticsModel_t, - * ConvergenceHistory_t, IntegralData_t, ReferenceState_t, - * DataArray_t, RigidGridMotion_t, ArbitraryGridMotion_t, BaseIterativeData_t, - * ZoneIterativeData_t, UserDefinedData_t, Gravity_t, Axisymmetry_t - * RotatingCoordinates_t, Periodic_t - */ - if (strcmp(posit_label,"CGNSBase_t")==0) - ADDRESS4SINGLE(cgns_base, units, cgns_units, 1) - else if (strcmp(posit_label,"Zone_t")==0) - ADDRESS4SINGLE(cgns_zone, units, cgns_units, 1) - else if (strcmp(posit_label,"GridCoordinates_t")==0) - ADDRESS4SINGLE(cgns_zcoor, units, cgns_units, 1) - else if (strcmp(posit_label,"FlowSolution_t")==0) - ADDRESS4SINGLE(cgns_sol, units, cgns_units, 1) - else if (strcmp(posit_label,"DiscreteData_t")==0) - ADDRESS4SINGLE(cgns_discrete, units, cgns_units, 1) - else if (strcmp(posit_label,"ZoneBC_t")==0) - ADDRESS4SINGLE(cgns_zboco, units, cgns_units, 1) - else if (strcmp(posit_label,"BC_t")==0) - ADDRESS4SINGLE(cgns_boco, units, cgns_units, 1) - else if (strcmp(posit_label,"BCDataSet_t")==0) - ADDRESS4SINGLE(cgns_dataset, units, cgns_units, 1) - else if (strcmp(posit_label,"BCData_t")==0) - ADDRESS4SINGLE(cgns_bcdata, units, cgns_units, 1) - else if (strcmp(posit_label,"FlowEquationSet_t")==0) - ADDRESS4SINGLE(cgns_equations, units, cgns_units, 1) - else if (strcmp(posit_label,"GasModel_t")==0 || - strcmp(posit_label,"ViscosityModel_t")==0 || - strcmp(posit_label,"ThermalConductivityModel_t")==0 || - strcmp(posit_label,"TurbulenceModel_t")==0 || - strcmp(posit_label,"TurbulenceClosure_t")==0 || - strcmp(posit_label,"ThermalRelaxationModel_t")==0 || - strcmp(posit_label,"ChemicalKineticsModel_t")==0) - ADDRESS4SINGLE(cgns_model, units, cgns_units, 1) - else if (strcmp(posit_label,"ConvergenceHistory_t")==0) - ADDRESS4SINGLE(cgns_converg, units, cgns_units, 1) - else if (strcmp(posit_label,"IntegralData_t")==0) - ADDRESS4SINGLE(cgns_integral, units, cgns_units, 1) - else if (strcmp(posit_label,"ReferenceState_t")==0) - ADDRESS4SINGLE(cgns_state, units, cgns_units, 1) - else if (strcmp(posit_label,"DataArray_t")==0) - ADDRESS4SINGLE(cgns_array, units, cgns_units, 1) - else if (strcmp(posit_label,"RigidGridMotion_t")==0) - ADDRESS4SINGLE(cgns_rmotion, units, cgns_units, 1) - else if (strcmp(posit_label,"ArbitraryGridMotion_t")==0) - ADDRESS4SINGLE(cgns_amotion, units, cgns_units, 1) - else if (strcmp(posit_label,"BaseIterativeData_t")==0) - ADDRESS4SINGLE(cgns_biter, units, cgns_units, 1) - else if (strcmp(posit_label,"ZoneIterativeData_t")==0) - ADDRESS4SINGLE(cgns_ziter, units, cgns_units, 1) - else if (strcmp(posit_label,"UserDefinedData_t")==0) - ADDRESS4SINGLE(cgns_user_data, units, cgns_units, 1) - else if (strcmp(posit_label,"Gravity_t")==0) - ADDRESS4SINGLE(cgns_gravity, units, cgns_units, 1) - else if (strcmp(posit_label,"Axisymmetry_t")==0) - ADDRESS4SINGLE(cgns_axisym, units, cgns_units, 1) - else if (strcmp(posit_label,"RotatingCoordinates_t")==0) - ADDRESS4SINGLE(cgns_rotating, units, cgns_units, 1) - else if (strcmp(posit_label,"Periodic_t")==0) - ADDRESS4SINGLE(cgns_cperio, units, cgns_units, 1) - - else { - cgi_error("DimensionalUnits_t node not supported under '%s' type node",posit_label); - (*ier) = CG_INCORRECT_PATH; - return 0; - } - if (error1==1) { - cgi_error("DimensionalUnits_t already defined under %s",posit_label); - (*ier) = CG_ERROR; - return 0; - } - if (!units && local_mode == MODE_READ) { - cgi_error("DimensionalUnits_t Node doesn't exist under %s",posit_label); - (*ier) = CG_NODE_NOT_FOUND; - return 0; - } - if (parent_id) { - if (cgi_delete_node (parent_id, units->id)) { - (*ier) = CG_ERROR; - return 0; - } - cgi_free_units(units); - } - return units; -} - -int *cgi_ordinal_address(int local_mode, int *ier) { - double *id; - int nnod; - int *ordinal; - double parent_id; - - /* check for valid posit */ - if (posit == 0) { - cgi_error("No current position set by cg_goto\n"); - (*ier) = CG_ERROR; - return 0; - } - -/* Possible parents of Ordinal_t node: - * Zone_t, GridConnectivity1to1_t, GridConnectivity_t, BC_t, Family_t, - */ - if (strcmp(posit_label,"Zone_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_zone, ordinal) - - else if (strcmp(posit_label,"GridConnectivity1to1_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_1to1, ordinal) - - else if (strcmp(posit_label,"GridConnectivity_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_conn, ordinal) - - else if (strcmp(posit_label,"BC_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_boco, ordinal) - - else if (strcmp(posit_label,"Family_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_family, ordinal) - - else { - cgi_error("Ordinal_t node not supported under '%s' type node",posit_label); - (*ier) = CG_INCORRECT_PATH; - return 0; - } - if (cg->mode == MODE_MODIFY && local_mode == MODE_WRITE) { - if (cgi_get_nodes(parent_id, "Ordinal_t", &nnod, &id)) return 0; - if (nnod>0) { - if (cgi_delete_node (parent_id, id[0])) { - (*ier) = CG_ERROR; - return 0; - } - free(id); - } - } - return ordinal; -} - -int *cgi_rind_address(int local_mode, int *ier) { - int *rind_planes=0, nnod; - double parent_id=0, *id; - int error1=0, index_dim; - - /* check for valid posit */ - if (posit == 0) { - cgi_error("No current position set by cg_goto\n"); - (*ier) = CG_ERROR; - return 0; - } - - if (posit_base && posit_zone) { - index_dim = cg->base[posit_base-1].zone[posit_zone-1].index_dim; - } else { - cgi_error("Can't find IndexDimension in cgi_rind_address"); - (*ier) = CG_ERROR; - return 0; - } - -/* Possible parents of Rind_t: - * GridCoordinates_t, FlowSolution_t,DiscreteData_t, ArbitraryGridMotion_t - */ - if (strcmp(posit_label,"GridCoordinates_t")==0) - ADDRESS4SINGLE(cgns_zcoor, rind_planes, int, 2*index_dim) - else if (strcmp(posit_label,"FlowSolution_t")==0) - ADDRESS4SINGLE(cgns_sol, rind_planes, int, 2*index_dim) - else if (strcmp(posit_label,"DiscreteData_t")==0) - ADDRESS4SINGLE(cgns_discrete, rind_planes, int, 2*index_dim) - else if (strcmp(posit_label,"ArbitraryGridMotion_t")==0) - ADDRESS4SINGLE(cgns_amotion, rind_planes, int, 2*index_dim) - - else { - cgi_error("Rind_t node not supported under '%s' type node",posit_label); - (*ier) = CG_INCORRECT_PATH; - return 0; - } - -/* Corrected on July 27 2001 by Diane Poirier - if (error1==1) { - cgi_error("Rind_t already defined under %s",posit_label); - (*ier) = CG_ERROR; - return 0; - } -*/ - if (!rind_planes && local_mode == MODE_READ) { - cgi_error("Rind_t node doesn't exist under %s",posit_label); - (*ier) = CG_NODE_NOT_FOUND; - return 0; - } - if (parent_id && cg->mode==MODE_MODIFY) { - if (cgi_get_nodes(parent_id, "Rind_t", &nnod, &id)) return 0; - if (nnod>0) { - if (cgi_delete_node (parent_id, id[0])) { - (*ier) = CG_ERROR; - return 0; - } - free(id); - } - } - return rind_planes; -} - -GridLocation_t *cgi_location_address(int local_mode, int *ier) { - double *id, parent_id; - GridLocation_t *location=0; - int nnod; - - /* check for valid posit */ - if (posit == 0) { - cgi_error("No current position set by cg_goto\n"); - (*ier) = CG_ERROR; - return 0; - } - -/* Possible parents for GridLocation_t: - * FlowSolution_t, DiscreteData_t, GridConnectivity_t, OversetHoles_t, BC_t, - * ArbitraryGridMotion_t - */ - if (strcmp(posit_label,"FlowSolution_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_sol, location) - else if (strcmp(posit_label,"DiscreteData_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_discrete, location) - else if (strcmp(posit_label,"GridConnectivity_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_conn, location) - else if (strcmp(posit_label,"OversetHoles_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_hole, location) - else if (strcmp(posit_label,"BC_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_boco, location) - else if (strcmp(posit_label,"ArbitraryGridMotion_t")==0) - ADDRESS4SINGLE_ALLOC(cgns_amotion, location) - - else { - cgi_error("GridLocation_t node not supported under '%s' type node",posit_label); - (*ier) = CG_INCORRECT_PATH; - return 0; - } - if (cg->mode == MODE_MODIFY && local_mode == MODE_WRITE) { - if (cgi_get_nodes(parent_id, "GridLocation_t", &nnod, &id)) return 0; - if (nnod>0) { - if (cgi_delete_node (parent_id, id[0])) { - (*ier) = CG_ERROR; - return 0; - } - free(id); - } - } - return location; -} - -cgns_conversion *cgi_conversion_address(int local_mode, int *ier) { - cgns_conversion *convert=0; - double parent_id=0; - int error1=0; - - /* check for valid posit */ - if (posit == 0) { - cgi_error("No current position set by cg_goto\n"); - (*ier) = CG_ERROR; - return 0; - } - -/* Possible parent: DataArray_t - */ - if (strcmp(posit_label,"DataArray_t")==0) - ADDRESS4SINGLE(cgns_array,convert, cgns_conversion, 1) - - else { - cgi_error("DataConversion_t node not supported under '%s' type node",posit_label); - (*ier) = CG_INCORRECT_PATH; - return 0; - } - if (error1==1) { - cgi_error("DataConversion_t already defined under %s",posit_label); - (*ier) = CG_ERROR; - return 0; - } - if (!convert && local_mode == MODE_READ) { - cgi_error("DataConversion_t node does not exist under %s",posit_label); - (*ier) = CG_NODE_NOT_FOUND; - return 0; - } - if (parent_id) { - if (cgi_delete_node (parent_id, convert->id)) { - (*ier) = CG_ERROR; - return 0; - } - cgi_free_convert(convert); - } - return convert; -} - -cgns_exponent *cgi_exponent_address(int local_mode, int *ier) { - cgns_exponent *exponents=0; - double parent_id=0; - int error1=0; - - /* check for valid posit */ - if (posit == 0) { - cgi_error("No current position set by cg_goto\n"); - (*ier) = CG_ERROR; - return 0; - } - -/* Possible parent: DataArray_t - */ - if (strcmp(posit_label,"DataArray_t")==0) - ADDRESS4SINGLE(cgns_array, exponents, cgns_exponent, 1) - - else { - cgi_error("DimensionalExponents_t node not supported under '%s' type node",posit_label); - (*ier) = CG_INCORRECT_PATH; - return 0; - } - if (error1==1) { - cgi_error("DimensionalExponents_t already defined under %s",posit_label); - (*ier) = CG_ERROR; - return 0; - } - if (!exponents && local_mode == MODE_READ) { - cgi_error("DimensionalExponents_t node does not exist under %s",posit_label); - (*ier) = CG_NODE_NOT_FOUND; - return 0; - } - if (parent_id) { - if (cgi_delete_node (parent_id, exponents->id)) { - (*ier) = CG_ERROR; - return 0; - } - cgi_free_exponents(exponents); - } - return exponents; -} - -cgns_integral *cgi_integral_address(int local_mode, int given_no, - char const *given_name, int *ier) { - cgns_integral *integral=0; - int n, error1=0, error2=0; - double parent_id=0; - - /* check for valid posit */ - if (posit == 0) { - cgi_error("No current position set by cg_goto\n"); - (*ier) = CG_ERROR; - return 0; - } - -/* Possible parents of IntegralData_t node: - * CGNSBase_t, Zone_t - */ - if (strcmp(posit_label,"CGNSBase_t")==0) - ADDRESS4MULTIPLE(cgns_base, nintegrals, integral, cgns_integral) - else if (strcmp(posit_label,"Zone_t")==0) - ADDRESS4MULTIPLE(cgns_zone, nintegrals, integral, cgns_integral) - else { - cgi_error("IntegralData_t node not supported under '%s' type node",posit_label); - (*ier) = CG_INCORRECT_PATH; - return 0; - } - if (error1) { - cgi_error("Duplicate child name found (%s) found under %s", - given_name, posit_label); - (*ier) = CG_ERROR; - return 0; - } - if (error2) { - cgi_error("IntegralData index number %d doesn't exist under %s", - given_no, posit_label); - (*ier) = CG_NODE_NOT_FOUND; - return 0; - } - if (parent_id) { /* parent_id!=0 only when overwriting */ - if (cgi_delete_node (parent_id, integral->id)) { - (*ier) = CG_ERROR; - return 0; - } - cgi_free_integral(integral); - } - return integral; -} - -cgns_equations *cgi_equations_address(int local_mode, int *ier) { - cgns_equations *equations=0; - double parent_id=0; - int error1=0; - - /* check for valid posit */ - if (posit == 0) { - cgi_error("No current position set by cg_goto\n"); - (*ier) = CG_ERROR; - return 0; - } - -/* Possible parents: CGNSBase_t, Zone_t - */ - if (strcmp(posit_label,"CGNSBase_t")==0) - ADDRESS4SINGLE(cgns_base, equations, cgns_equations, 1) - - else if (strcmp(posit_label,"Zone_t")==0) - ADDRESS4SINGLE(cgns_zone, equations, cgns_equations, 1) - - else { - cgi_error("FlowEquationSet_t node not supported under '%s' type node",posit_label); - (*ier) = CG_INCORRECT_PATH; - return 0; - } - if (error1==1) { - cgi_error("FlowEquationSet_t already defined under %s",posit_label); - (*ier) = CG_ERROR; - return 0; - } - if (!equations && local_mode == MODE_READ) { - cgi_error("FlowEquationSet_t Node doesn't exist under %s",posit_label); - (*ier) = CG_NODE_NOT_FOUND; - return 0; - } - if (parent_id) { - if (cgi_delete_node (parent_id, equations->id)) { - (*ier) = CG_ERROR; - return 0; - } - cgi_free_equations(equations); - } - return equations; -} - -cgns_state *cgi_state_address(int local_mode, int *ier) { - cgns_state *state=0; - double parent_id=0; - int error1=0; - - /* check for valid posit */ - if (posit == 0) { - cgi_error("No current position set by cg_goto\n"); - (*ier) = CG_ERROR; - return 0; - } - -/* Possible parents: CGNSBase_t, Zone_t, ZoneBC_t, BC_t - * BCDataSet_t - */ - if (strcmp(posit_label,"CGNSBase_t")==0) - ADDRESS4SINGLE(cgns_base, state, cgns_state, 1) - - else if (strcmp(posit_label,"Zone_t")==0) - ADDRESS4SINGLE(cgns_zone, state, cgns_state, 1) - - else if (strcmp(posit_label,"ZoneBC_t")==0) - ADDRESS4SINGLE(cgns_zboco, state, cgns_state, 1) - - else if (strcmp(posit_label,"BC_t")==0) - ADDRESS4SINGLE(cgns_boco, state, cgns_state, 1) - - else if (strcmp(posit_label,"BCDataSet_t")==0) - ADDRESS4SINGLE(cgns_dataset, state, cgns_state, 1) - - else { - cgi_error("ReferenceState_t node not supported under '%s' type node",posit_label); - (*ier) = CG_INCORRECT_PATH; - return 0; - } - if (error1==1) { - cgi_error("ReferenceState_t already defined under %s",posit_label); - (*ier) = CG_ERROR; - return 0; - } - if (!state && local_mode == MODE_READ) { - cgi_error("ReferenceState_t Node doesn't exist under %s",posit_label); - (*ier) = CG_NODE_NOT_FOUND; - return 0; - } - if (parent_id) { - if (cgi_delete_node (parent_id, state->id)) { - (*ier) = CG_ERROR; - return 0; - } - cgi_free_state(state); - } - return state; -} - -cgns_converg *cgi_converg_address(int local_mode, int *ier) { - cgns_converg *converg=0; - double parent_id=0; - int error1=0; - - /* check for valid posit */ - if (posit == 0) { - cgi_error("No current position set by cg_goto\n"); - (*ier) = CG_ERROR; - return 0; - } - -/* Possible parents for xxxConvergenceHistory_t node: - CGNSBase_t, Zone_t - */ - if (strcmp(posit_label,"CGNSBase_t")==0) { - ADDRESS4SINGLE(cgns_base, converg, cgns_converg, 1) - if (local_mode==MODE_WRITE) - strcpy(converg->name,"GlobalConvergenceHistory"); - - } else if (strcmp(posit_label,"Zone_t")==0) { - ADDRESS4SINGLE(cgns_zone, converg, cgns_converg, 1) - if (local_mode==MODE_WRITE) - strcpy(converg->name,"ZoneConvergenceHistory"); - - } else { - cgi_error("ConvergenceHistory_t node not supported under '%s' type node",posit_label); - (*ier) = CG_INCORRECT_PATH; - return 0; - } - if (error1==1) { - cgi_error("ConvergenceHistory_t already defined under %s",posit_label); - (*ier) = CG_ERROR; - return 0; - } - if (!converg && local_mode == MODE_READ) { - cgi_error("ConvergenceHistory_t Node doesn't exist under %s",posit_label); - (*ier) = CG_NODE_NOT_FOUND; - return 0; - } - if (parent_id) { - if (cgi_delete_node (parent_id, converg->id)) { - (*ier) = CG_ERROR; - return 0; - } - cgi_free_converg(converg); - } - return converg; -} - -cgns_governing *cgi_governing_address(int local_mode, int *ier) { - cgns_governing *governing; - int error1=0; - double parent_id=0; - - /* check for valid posit */ - if (posit == 0) { - cgi_error("No current position set by cg_goto\n"); - (*ier) = CG_ERROR; - return 0; - } - -/* Possible parents for GoverningEquations_t: - FlowEquationSet_t - */ - if (strcmp(posit_label,"FlowEquationSet_t")==0) - ADDRESS4SINGLE(cgns_equations, governing, cgns_governing,1) - else { - cgi_error("GoverningEquations_t node not supported under '%s' type node",posit_label); - (*ier) = CG_INCORRECT_PATH; - return 0; - } - if (error1==1) { - cgi_error("GoverningEquations_t already defined under %s",posit_label); - (*ier) = CG_ERROR; - return 0; - } - if (!governing && local_mode == MODE_READ) { - cgi_error("ConvergenceHistory_t Node doesn't exist under %s",posit_label); - (*ier) = CG_NODE_NOT_FOUND; - return 0; - } - if (parent_id) { - if (cgi_delete_node (parent_id, governing->id)) { - (*ier) = CG_ERROR; - return 0; - } - cgi_free_governing(governing); - } - return governing; -} - -int *cgi_diffusion_address(int local_mode, int *ier) { - int *diffusion_model=0, error1=0, nnod; - double parent_id=0, *id; - - /* check for valid posit */ - if (posit == 0) { - cgi_error("No current position set by cg_goto\n"); - (*ier) = CG_ERROR; - return 0; - } - -/* possible parents for DiffusionModel: - GoverningEquations_t, TurbulenceModel_t - */ - if (strcmp(posit_label,"GoverningEquations_t")==0) - ADDRESS4SINGLE(cgns_governing, diffusion_model, int, 6) - - else if (strcmp(posit_label,"TurbulenceModel_t")==0) - ADDRESS4SINGLE(cgns_model, diffusion_model, int, 6) - - else { - cgi_error("Diffusion Model node not supported under '%s' type node",posit_label); - (*ier) = CG_INCORRECT_PATH; - return 0; - } - if (error1==1) { - cgi_error("Diffusion Model already defined under %s",posit_label); - (*ier) = CG_ERROR; - return 0; - } - if (!diffusion_model && local_mode == MODE_READ) { - cgi_error("Diffusion Model Node doesn't exist under %s",posit_label); - (*ier) = CG_NODE_NOT_FOUND; - return 0; - } - if (parent_id) { - if (cgi_get_nodes(parent_id, "\"int[1+...+IndexDimension]\"", &nnod, &id)) return 0; - if (nnod>0) { - if (cgi_delete_node (parent_id, id[0])) { - (*ier) = CG_ERROR; - return 0; - } - free(id); - } - free(diffusion_model); - } - return diffusion_model; -} - -cgns_array *cgi_array_address(int local_mode, int given_no, char const *given_name, int *ier) { - cgns_array *array=0, *coord=0; - int n, error1=0, error2=0; - double parent_id=0; - - /* check for valid posit */ - if (posit == 0) { - cgi_error("No current position set by cg_goto\n"); - (*ier) = CG_ERROR; - return 0; - } - -/* Possible parents of DataArray_t node: - * GridCoordinates_t, Elements_t, FlowSolution_t, DiscreteData_t, GridConnectivity_t, BC_t, - * BCData_t, GasModel_t, ViscosityModel_t, ThermalConductivityModel_t, TurbulenceClosure_t, - * TurbulenceModel_t, ThermalRelaxationModel_t, ChemicalKineticsModel_t, - * ConvergenceHistory_t, IntegralData_t, ReferenceState_t, - * RigidGridMotion_t, ArbitraryGridMotion_t, BaseIterativeData_t, ZoneIterativeData_t, - * UserDefinedData_t, Gravity_t, Axisymmetry_t, RotatingCoordinates_t - * Area_t, Periodic_t - */ - - /* 0,N DataArray_t under GridCoordinates_t */ - if (strcmp(posit_label,"GridCoordinates_t")==0) { - ADDRESS4MULTIPLE(cgns_zcoor, ncoords, coord, cgns_array) - array = coord; - - /* 2 DataArray_t under Elements_t: connect and parent */ - } else if (strcmp(posit_label,"Elements_t")==0) { - cgns_section *section= (cgns_section *)posit; - if (local_mode==MODE_WRITE) { - if (strcmp(given_name,"ElementConnectivity") && strcmp(given_name,"ParentData")) { - cgi_error("User defined DataArray_t node not supported under '%s' type node",posit_label); - (*ier) = CG_ERROR; - return 0; - } - if (section->connect==0 && strcmp(given_name,"ElementConnectivity")==0) { - section->connect = CGNS_NEW(cgns_array, 1); - array = section->connect; - } else if (section->parent==0 && strcmp(given_name,"ParentData")==0) { - section->parent = CGNS_NEW(cgns_array, 1); - array = section->parent; - } else { - if (cg->mode == MODE_WRITE) error1=1; - else { - parent_id = section->id; - if (section->connect && strcmp(given_name,"ElementConnectivity")==0) - array = section->connect; - else if (section->parent && strcmp(given_name,"ParentData")==0) - array = section->parent; - } - } - } else if (local_mode == MODE_READ) { - if (section->connect && strcmp(given_name,"ElementConnectivity")==0) - array = section->connect; - else if (section->parent && strcmp(given_name,"ParentData")==0) - array = section->parent; - } - - /* 0,N DataArray_t under FlowSolution_t */ - } else if (strcmp(posit_label,"FlowSolution_t")==0) { - cgns_array *field; - ADDRESS4MULTIPLE(cgns_sol, nfields, field, cgns_array) - array = field; - - /* 0,N DataArray_t under DiscreteData_t */ - } else if (strcmp(posit_label,"DiscreteData_t")==0) { - ADDRESS4MULTIPLE(cgns_discrete, narrays, array, cgns_array) - - /* 0,1 DataArray_t under GridConnectivity_t */ - } else if (strcmp(posit_label,"GridConnectivity_t")==0) { - cgns_array *interpolants; - if (local_mode==MODE_WRITE && strcmp(given_name,"InterpolantsDonor")) { - cgi_error("User defined DataArray_t node not supported under '%s' type node",posit_label); - (*ier) = CG_ERROR; - return 0; - } - ADDRESS4SINGLE(cgns_conn, interpolants, cgns_array, 1) - array = interpolants; - - /* 0,1 DataArray_t (in SIDS is IndexArray_t) for InwardNormalList */ - } else if (strcmp(posit_label,"BC_t")==0) { - cgns_array *normal; - ADDRESS4SINGLE(cgns_boco, normal, cgns_array, 1) - array = normal; - - /* 0,N DataArray_t under BCData_t */ - } else if (strcmp(posit_label,"BCData_t")==0) { - ADDRESS4MULTIPLE(cgns_bcdata, narrays, array, cgns_array) - - /* 0,N DataArray_t under all Model_t */ - } else if (strcmp(posit_label,"GasModel_t")==0 || - strcmp(posit_label,"ViscosityModel_t")==0 || - strcmp(posit_label,"ThermalConductivityModel_t")==0 || - strcmp(posit_label,"TurbulenceModel_t")==0 || - strcmp(posit_label,"TurbulenceClosure_t")==0 || - strcmp(posit_label,"ThermalRelaxationModel_t")==0 || - strcmp(posit_label,"ChemicalKineticsModel_t")==0) { - ADDRESS4MULTIPLE(cgns_model, narrays, array, cgns_array) - - /* 0,N DataArray_t under ConvergenceHistory_t */ - } else if (strcmp(posit_label,"ConvergenceHistory_t")==0) { - ADDRESS4MULTIPLE(cgns_converg, narrays, array, cgns_array) - - /* 0,N DataArray_t under IntegralData_t */ - } else if (strcmp(posit_label,"IntegralData_t")==0) { - ADDRESS4MULTIPLE(cgns_integral, narrays, array, cgns_array) - - /* 0,N DataArray_t under ReferenceState_t */ - } else if (strcmp(posit_label,"ReferenceState_t")==0) { - ADDRESS4MULTIPLE(cgns_state, narrays, array, cgns_array) - - /* 0,N DataArray_t under RigidGridMotion_t: */ - } else if (strcmp(posit_label, "RigidGridMotion_t")==0) { - ADDRESS4MULTIPLE(cgns_rmotion, narrays, array, cgns_array) - - /* 0,N DataArray_t under ArbitraryGridMotion_t: */ - } else if (strcmp(posit_label, "ArbitraryGridMotion_t")==0) { - ADDRESS4MULTIPLE(cgns_amotion, narrays, array, cgns_array) - - /* 0,N DataArray_t under BaseIterativeData_t: */ - } else if (strcmp(posit_label, "BaseIterativeData_t")==0) { - ADDRESS4MULTIPLE(cgns_biter, narrays, array, cgns_array) - - /* 0,N DataArray_t under ZoneIterativeData_t: */ - } else if (strcmp(posit_label, "ZoneIterativeData_t")==0) { - ADDRESS4MULTIPLE(cgns_ziter, narrays, array, cgns_array) - - /* 0,N DataArray_t under UserDefinedData_t: */ - } else if (strcmp(posit_label, "UserDefinedData_t")==0) { - ADDRESS4MULTIPLE(cgns_user_data, narrays, array, cgns_array) - - /* 0,1 DataArray_t for GravityVector */ - } else if (strcmp(posit_label,"Gravity_t")==0) { - cgns_array *vector; - if (local_mode==MODE_WRITE && strcmp(given_name,"GravityVector")) { - cgi_error("User defined DataArray_t node not supported under '%s' type node",posit_label); - (*ier) = CG_ERROR; - return 0; - } - ADDRESS4SINGLE(cgns_gravity, vector, cgns_array, 1) - array = vector; - - /* 2,4 DataArray_t for Axisymmetry_t */ - } else if (strcmp(posit_label,"Axisymmetry_t")==0) { - if (local_mode==MODE_WRITE && strcmp(given_name,"AxisymmetryReferencePoint") && - strcmp(given_name,"AxisymmetryAxisVector") && - strcmp(given_name,"AxisymmetryAngle") && - strcmp(given_name,"CoordinateNames")) { - cgi_error("User defined DataArray_t node not supported under '%s' type node",posit_label); - (*ier) = CG_ERROR; - return 0; - } - ADDRESS4MULTIPLE(cgns_axisym, narrays, array, cgns_array) - - /* 2 DataArray_t for RotatingCoordinates_t */ - } else if (strcmp(posit_label,"RotatingCoordinates_t")==0) { - if (local_mode==MODE_WRITE && strcmp(given_name,"RotationCenter") && - strcmp(given_name,"RotationRateVector")) { - cgi_error("User defined DataArray_t node not supported under '%s' type node",posit_label); - (*ier) = CG_ERROR; - return 0; - } - ADDRESS4MULTIPLE(cgns_rotating, narrays, array, cgns_array) - - /* 2 DataArray_t for Area_t: SurfaceArea, RegionName */ - } else if (strcmp(posit_label,"Area_t")==0) { - if (local_mode==MODE_WRITE && strcmp(given_name,"SurfaceArea") && - strcmp(given_name,"RegionName")) { - cgi_error("User defined DataArray_t node not supported under '%s' type node",posit_label); - (*ier) = CG_ERROR; - return 0; - } - ADDRESS4MULTIPLE(cgns_bcarea, narrays, array, cgns_array) - - /* 3 DataArray_t for Periodic_t: RotationCenter, RotationAngle, Translation */ - } else if (strcmp(posit_label,"Periodic_t")==0) { - if (local_mode==MODE_WRITE && strcmp(given_name,"RotationCenter") && - strcmp(given_name,"RotationAngle") && strcmp(given_name,"Translation")) { - cgi_error("User defined DataArray_t node not supported under '%s' type node",posit_label); - (*ier) = CG_ERROR; - return 0; - } - ADDRESS4MULTIPLE(cgns_cperio, narrays, array, cgns_array) - - } else { - cgi_error("DataArray_t node not supported under '%s' type node",posit_label); - (*ier) = CG_INCORRECT_PATH; - return 0; - } - if (error1) { - cgi_error("Duplicate child name found (%s) found under %s", - given_name, posit_label); - (*ier) = CG_ERROR; - return 0; - } - if (error2) { - cgi_error("DataArray_t index number %d doesn't exist under %s", - given_no, posit_label); - (*ier) = CG_NODE_NOT_FOUND; - return 0; - } - if (parent_id) { /* parent_id!=0 only when overwriting */ - if (cgi_delete_node (parent_id, array->id)) { - (*ier) = CG_ERROR; - return 0; - } - cgi_free_array(array); - } - return array; -} - -cgns_model *cgi_model_address(int local_mode, char const *ModelLabel, int *ier) { - cgns_model *model=0; - double parent_id=0; - int error1=0; - - /* check for valid posit */ - if (posit == 0) { - cgi_error("No current position set by cg_goto\n"); - (*ier) = CG_ERROR; - return 0; - } - -/* Possible parents for all xxxModel_t and TurbulenceClosure_t: - FlowEquationSet_t - */ - if (strcmp(posit_label,"FlowEquationSet_t")==0) { - if (strcmp(ModelLabel, "GasModel_t")==0) { - cgns_model *gas; - ADDRESS4SINGLE(cgns_equations, gas, cgns_model, 1) - model = gas; - - } else if (strcmp(ModelLabel, "ViscosityModel_t")==0) { - cgns_model *visc; - ADDRESS4SINGLE(cgns_equations, visc, cgns_model, 1) - model = visc; - - } else if (strcmp(ModelLabel, "ThermalConductivityModel_t")==0) { - cgns_model *conduct; - ADDRESS4SINGLE(cgns_equations, conduct, cgns_model, 1) - model = conduct; - - } else if (strcmp(ModelLabel, "TurbulenceClosure_t")==0) { - cgns_model *closure; - ADDRESS4SINGLE(cgns_equations, closure, cgns_model, 1) - model = closure; - - } else if (strcmp(ModelLabel, "TurbulenceModel_t")==0) { - cgns_model *turbulence; - ADDRESS4SINGLE(cgns_equations, turbulence, cgns_model, 1) - model = turbulence; - - } else if (strcmp(ModelLabel, "ThermalRelaxationModel_t")==0) { - cgns_model *relaxation; - ADDRESS4SINGLE(cgns_equations, relaxation, cgns_model, 1) - model = relaxation; - - } else if (strcmp(ModelLabel, "ChemicalKineticsModel_t")==0) { - cgns_model *chemkin; - ADDRESS4SINGLE(cgns_equations, chemkin, cgns_model, 1) - model = chemkin; - - } else { - cgi_error("Incorrect model type %s",ModelLabel); - (*ier) = CG_ERROR; - return 0; - } - } else { - cgi_error("%s node not supported under '%s' type node",ModelLabel,posit_label); - (*ier)=CG_INCORRECT_PATH; - return 0; - } - if (!model && local_mode == MODE_READ) { - cgi_error("%s node doesn't exist under %s",ModelLabel,posit_label); - (*ier) = CG_NODE_NOT_FOUND; - return 0; - } - if (error1) { - cgi_error("%s node already defined under %s",ModelLabel,posit_label); - (*ier) = CG_ERROR; - return 0; - } - if (parent_id) { - if (cgi_delete_node (parent_id, model->id)) { - (*ier) = CG_ERROR; - return 0; - } - cgi_free_model(model); - } - return model; -} - - -cgns_user_data *cgi_user_data_address(int local_mode, int given_no, - char const *given_name, int *ier) { - cgns_user_data *user_data=0; - int n, error1=0, error2=0; - double parent_id=0; - - /* check for valid posit */ - if (posit == 0) { - cgi_error("No current position set by cg_goto\n"); - (*ier) = CG_ERROR; - return 0; - } - -/* Possible parents of UserDefinedData_t node: - * IntegralData_t, DiscreteData_t, ConvergenceHistory_t, ReferenceState_t, - * xxxModel_t, GoverningEquations_t, FlowEquationSet_t, BCData_t, BCDataSet_t, - * Elements_t, BC_t, ZoneBC_t, OversetHoles_t, GridConnectivity_t, - * GridConnectivity1to1_t, ZoneGridConnectivity_t, FlowSolution_t, - * GridCoordinates_t, RigidGridMotion_t, ArbitraryGridMotion_t, - * ZoneIterativeData_t, BaseIterativeData_t, Zone_t, GeometryReference_t, - * Family_t, CGNSBase_t, Gravity_t, Axisymmetry_t, RotatingCoordinates_t - * BCProperty_t, WallFunction_t, Area_t, - * GridConnectivityProperty_t, Periodic_t, AverageInterface_t - */ - if (strcmp(posit_label,"IntegralData_t")==0) - ADDRESS4MULTIPLE(cgns_integral, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"DiscreteData_t")==0) - ADDRESS4MULTIPLE(cgns_discrete, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"ConvergenceHistory_t")==0) - ADDRESS4MULTIPLE(cgns_converg, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"ReferenceState_t")==0) - ADDRESS4MULTIPLE(cgns_state, nuser_data, user_data, cgns_user_data) - else if ( (strcmp(posit_label,"GasModel_t")==0) - || (strcmp(posit_label,"ViscosityModel_t")==0) - || (strcmp(posit_label,"ThermalConductivityModel_t")==0) - || (strcmp(posit_label,"TurbulenceModel_t")==0) - || (strcmp(posit_label,"TurbulenceClosureModel_t")==0) - || (strcmp(posit_label,"ThermalRelaxationModel_t")==0) - || (strcmp(posit_label,"ChemicalKineticsModel_t")==0) ) - ADDRESS4MULTIPLE(cgns_model, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"GoverningEquations_t")==0) - ADDRESS4MULTIPLE(cgns_governing, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"FlowEquationSet_t")==0) - ADDRESS4MULTIPLE(cgns_equations, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"BCData_t")==0) - ADDRESS4MULTIPLE(cgns_bcdata, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"BCDataSet_t")==0) - ADDRESS4MULTIPLE(cgns_dataset, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"Elements_t")==0) - ADDRESS4MULTIPLE(cgns_section, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"BC_t")==0) - ADDRESS4MULTIPLE(cgns_boco, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"ZoneBC_t")==0) - ADDRESS4MULTIPLE(cgns_zboco, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"OversetHoles_t")==0) - ADDRESS4MULTIPLE(cgns_hole, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"GridConnectivity_t")==0) - ADDRESS4MULTIPLE(cgns_conn, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"GridConnectivity1to1_t")==0) - ADDRESS4MULTIPLE(cgns_1to1, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"ZoneGridConnectivity_t")==0) - ADDRESS4MULTIPLE(cgns_zconn, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"FlowSolution_t")==0) - ADDRESS4MULTIPLE(cgns_sol, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"GridCoordinates_t")==0) - ADDRESS4MULTIPLE(cgns_zcoor, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"RigidGridMotion_t")==0) - ADDRESS4MULTIPLE(cgns_rmotion, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"ArbitraryGridMotion_t")==0) - ADDRESS4MULTIPLE(cgns_amotion, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"ZoneIterativeData_t")==0) - ADDRESS4MULTIPLE(cgns_ziter, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"BaseIterativeData_t")==0) - ADDRESS4MULTIPLE(cgns_biter, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"Zone_t")==0) - ADDRESS4MULTIPLE(cgns_zone, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"GeometryReference_t")==0) - ADDRESS4MULTIPLE(cgns_geo, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"Family_t")==0) - ADDRESS4MULTIPLE(cgns_family, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"CGNSBase_t")==0) - ADDRESS4MULTIPLE(cgns_base, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"Gravity_t")==0) - ADDRESS4MULTIPLE(cgns_gravity, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"Axisymmetry_t")==0) - ADDRESS4MULTIPLE(cgns_axisym, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"RotatingCoordinates_t")==0) - ADDRESS4MULTIPLE(cgns_rotating, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"BCProperty_t")==0) - ADDRESS4MULTIPLE(cgns_bprop, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"WallFunction_t")==0) - ADDRESS4MULTIPLE(cgns_bcwall, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"Area_t")==0) - ADDRESS4MULTIPLE(cgns_bcarea, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"GridConnectivityProperty_t")==0) - ADDRESS4MULTIPLE(cgns_cprop, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"Periodic_t")==0) - ADDRESS4MULTIPLE(cgns_cperio, nuser_data, user_data, cgns_user_data) - else if (strcmp(posit_label,"AverageInterface_t")==0) - ADDRESS4MULTIPLE(cgns_caverage, nuser_data, user_data, cgns_user_data) - - else { - cgi_error("UserDefinedData_t node not supported under '%s' type node",posit_label); - (*ier) = CG_INCORRECT_PATH; - return 0; - } - if (error1) { - cgi_error("Duplicate child name found (%s) found under %s", - given_name, posit_label); - (*ier) = CG_ERROR; - return 0; - } - if (error2) { - cgi_error("UserDefinedData index number %d doesn't exist under %s", - given_no, posit_label); - (*ier) = CG_NODE_NOT_FOUND; - return 0; - } - if (parent_id) { /* parent_id!=0 only when overwriting */ - if (cgi_delete_node (parent_id, user_data->id)) { - (*ier) = CG_ERROR; - return 0; - } - cgi_free_user_data(user_data); - } - return user_data; -} - -cgns_rotating *cgi_rotating_address(int local_mode, int *ier) { - cgns_rotating *rotating=0; - double parent_id=0; - int error1=0; - - /* check for valid posit */ - if (posit == 0) { - cgi_error("No current position set by cg_goto\n"); - (*ier) = CG_ERROR; - return 0; - } - -/* Possible parents: CGNSBase_t, Zone_t - */ - if (strcmp(posit_label,"CGNSBase_t")==0) - ADDRESS4SINGLE(cgns_base, rotating, cgns_rotating, 1) - - else if (strcmp(posit_label,"Zone_t")==0) - ADDRESS4SINGLE(cgns_zone, rotating, cgns_rotating, 1) - - else { - cgi_error("RotatingCoordinates_t node not supported under '%s' type node",posit_label); - (*ier) = CG_INCORRECT_PATH; - return 0; - } - if (error1==1) { - cgi_error("RotatingCoordinates_t already defined under %s",posit_label); - (*ier) = CG_ERROR; - return 0; - } - if (!rotating && local_mode == MODE_READ) { - cgi_error("RotatingCoordinates_t Node doesn't exist under %s",posit_label); - (*ier) = CG_NODE_NOT_FOUND; - return 0; - } - if (parent_id) { - if (cgi_delete_node (parent_id, rotating->id)) { - (*ier) = CG_ERROR; - return 0; - } - cgi_free_rotating(rotating); - } - return rotating; -} - -/***********************************************************************\ - * Free memory * -\***********************************************************************/ - -void cgi_free_file(cgns_file *cg) { - int b; - - free(cg->filename); - if (cg->nbases) { - for (b=0; bnbases; b++) - cgi_free_base(&cg->base[b]); - free(cg->base); - } -} - -void cgi_free_base(cgns_base *base) { - int n; - - if (base->nzones) { - for (n=0; nnzones; n++) - cgi_free_zone(&base->zone[n]); - free(base->zone); - } - if (base->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&base->descr[n]); - free(base->descr); - } - if (base->state) { - cgi_free_state(base->state); - free(base->state); - } - if (base->units) { - cgi_free_units(base->units); - free(base->units); - } - if (base->equations) { - cgi_free_equations(base->equations); - free(base->equations); - } - if (base->converg) { - cgi_free_converg(base->converg); - free(base->converg); - } - if (base->nintegrals) { - for (n=0; nnintegrals; n++) - cgi_free_integral(&base->integral[n]); - free(base->integral); - } - if (base->nfamilies) { - for (n=0; nnfamilies; n++) - cgi_free_family(&base->family[n]); - free(base->family); - } - if (base->biter) { - cgi_free_biter(base->biter); - free(base->biter); - } - if (base->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&base->user_data[n]); - free(base->user_data); - } - if (base->gravity) { - cgi_free_gravity(base->gravity); - free(base->gravity); - } - if (base->axisym) { - cgi_free_axisym(base->axisym); - free(base->axisym); - } - if (base->rotating) { - cgi_free_rotating(base->rotating); - free(base->rotating); - } -} - -void cgi_free_zone(cgns_zone *zone) { - int n; - - if (zone->link) free(zone->link); - free(zone->nijk); - if (zone->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&zone->descr[n]); - free(zone->descr); - } - if (zone->nzcoor) { - for (n=0; nnzcoor; n++) - cgi_free_zcoor(&zone->zcoor[n]); - free(zone->zcoor); - } - if (zone->nsections) { - for (n=0; nnsections; n++) - cgi_free_section(&zone->section[n]); - free(zone->section); - } - if (zone->nsols) { - for (n=0; nnsols; n++) - cgi_free_sol(&zone->sol[n]); - free(zone->sol); - } - if (zone->ndiscrete) { - for (n=0; nndiscrete; n++) - cgi_free_discrete(&zone->discrete[n]); - free(zone->discrete); - } - if (zone->nintegrals) { - for (n=0; nnintegrals; n++) - cgi_free_integral(&zone->integral[n]); - free(zone->integral); - } - if (zone->zconn) { - cgi_free_zconn(zone->zconn); - free(zone->zconn); - } - if (zone->zboco) { - cgi_free_zboco(zone->zboco); - free(zone->zboco); - } - if (zone->state) { - cgi_free_state(zone->state); - free(zone->state); - } - if (zone->units) { - cgi_free_units(zone->units); - free(zone->units); - } - if (zone->equations) { - cgi_free_equations(zone->equations); - free(zone->equations); - } - if (zone->converg) { - cgi_free_converg(zone->converg); - free(zone->converg); - } - if (zone->nrmotions) { - for (n=0; nnrmotions; n++) - cgi_free_rmotion(&zone->rmotion[n]); - free(zone->rmotion); - } - if (zone->namotions) { - for (n=0; nnamotions; n++) - cgi_free_amotion(&zone->amotion[n]); - free(zone->amotion); - } - if (zone->ziter) { - cgi_free_ziter(zone->ziter); - free(zone->ziter); - } - if (zone->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&zone->user_data[n]); - free(zone->user_data); - } - if (zone->rotating) { - cgi_free_rotating(zone->rotating); - free(zone->rotating); - } -} - -void cgi_free_section(cgns_section *section) { - int n; - if (section->link) free(section->link); - if (section->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(§ion->descr[n]); - free(section->descr); - } - if (section->connect) { - cgi_free_array(section->connect); - free(section->connect); - } - if (section->parent) { - cgi_free_array(section->parent); - free(section->parent); - } - if (section->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(§ion->user_data[n]); - free(section->user_data); - } -} - -void cgi_free_family(cgns_family *family) { - int n; - if (family->link) free(family->link); - if (family->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&family->descr[n]); - free(family->descr); - } - if (family->nfambc) { - for (n=0; n>family->nfambc; n++) - cgi_free_fambc(&family->fambc[n]); - free(family->fambc); - } - if (family->ngeos) { - for (n=0; nngeos; n++) - cgi_free_geo(&family->geo[n]); - free(family->geo); - } - if (family->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&family->user_data[n]); - free(family->user_data); - } -} - -void cgi_free_fambc(cgns_fambc *fambc) { - if (fambc->link) free(fambc->link); -} - -void cgi_free_geo(cgns_geo *geo) { - int n; - if (geo->link) free(geo->link); - if (geo->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&geo->descr[n]); - free(geo->descr); - } - if (geo->file) free(geo->file); - if (geo->npart) { - for (n=0; nnpart; n++) - cgi_free_part(&geo->part[n]); - free(geo->part); - } - if (geo->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&geo->user_data[n]); - free(geo->user_data); - } -} - -void cgi_free_part(cgns_part *part) { - if (part->link) free(part->link); -} - -void cgi_free_zcoor(cgns_zcoor *zcoor) { - int n; - if (zcoor->link) free(zcoor->link); - if (zcoor->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&zcoor->descr[n]); - free(zcoor->descr); - } - if (zcoor->rind_planes) free(zcoor->rind_planes); - if (zcoor->ncoords) { - for (n=0; nncoords; n++) - cgi_free_array(&zcoor->coord[n]); - free(zcoor->coord); - } - if (zcoor->units) { - cgi_free_units(zcoor->units); - free(zcoor->units); - } - if (zcoor->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&zcoor->user_data[n]); - free(zcoor->user_data); - } -} - -void cgi_free_zboco(cgns_zboco *zboco) { - int n; - if (zboco->link) free(zboco->link); - if (zboco->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&zboco->descr[n]); - free(zboco->descr); - } - if (zboco->nbocos) { - for (n=0; nnbocos; n++) - cgi_free_boco(&zboco->boco[n]); - free(zboco->boco); - } - if (zboco->state) { - cgi_free_state(zboco->state); - free(zboco->state); - } - if (zboco->units) { - cgi_free_units(zboco->units); - free(zboco->units); - } - if (zboco->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&zboco->user_data[n]); - free(zboco->user_data); - } -} - -void cgi_free_zconn(cgns_zconn *zconn) { - int n; - if (zconn->link) free(zconn->link); - if (zconn->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&zconn->descr[n]); - free(zconn->descr); - } - if (zconn->n1to1) { - for (n=0; nn1to1; n++) - cgi_free_1to1(&zconn->one21[n]); - free(zconn->one21); - } - if (zconn->nconns) { - for (n=0; nnconns; n++) - cgi_free_conn(&zconn->conn[n]); - free(zconn->conn); - } - if (zconn->nholes) { - for (n=0; nnholes; n++) - cgi_free_hole(&zconn->hole[n]); - free(zconn->hole); - } - if (zconn->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&zconn->user_data[n]); - free(zconn->user_data); - } -} - -void cgi_free_sol(cgns_sol *sol) { - int n; - if (sol->link) free(sol->link); - if (sol->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&sol->descr[n]); - free(sol->descr); - } - if (sol->nfields) { - for (n=0; nnfields; n++) - cgi_free_array(&sol->field[n]); - free(sol->field); - } - if (sol->rind_planes) free(sol->rind_planes); - if (sol->units) { - cgi_free_units(sol->units); - free(sol->units); - } - if (sol->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&sol->user_data[n]); - free(sol->user_data); - } -} - -void cgi_free_1to1(cgns_1to1 *one21) { - int n; - if (one21->link) free(one21->link); - free(one21->transform); - if (one21->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&one21->descr[n]); - free(one21->descr); - } - if (one21->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&one21->user_data[n]); - free(one21->user_data); - } -} - -void cgi_free_hole(cgns_hole *hole) { - int n; - if (hole->link) free(hole->link); - if (hole->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&hole->descr[n]); - free(hole->descr); - } - if (hole->nptsets) { - for (n=0; nnptsets; n++) - cgi_free_ptset(&hole->ptset[n]); - free(hole->ptset); - } - if (hole->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&hole->user_data[n]); - free(hole->user_data); - } -} - -void cgi_free_conn(cgns_conn *conn) { - int n; - if (conn->link) free(conn->link); - if (conn->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&conn->descr[n]); - free(conn->descr); - } - if (conn->interpolants) { - cgi_free_array(conn->interpolants); - free(conn->interpolants); - } - if (conn->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&conn->user_data[n]); - free(conn->user_data); - } - if (conn->cprop) { - cgi_free_cprop(conn->cprop); - free(conn->cprop); - } -} - -void cgi_free_boco(cgns_boco *boco) { - int n; - if (boco->link) free(boco->link); - if (boco->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&boco->descr[n]); - free(boco->descr); - } - if (boco->ptset) cgi_free_ptset(boco->ptset); - if (boco->Nindex) free(boco->Nindex); - if (boco->normal) { - cgi_free_array(boco->normal); - free(boco->normal); - } - if (boco->ndataset) { - for (n=0; nndataset; n++) - cgi_free_dataset(&boco->dataset[n]); - free(boco->dataset); - } - if (boco->state) { - cgi_free_state(boco->state); - free(boco->state); - } - if (boco->units) { - cgi_free_units(boco->units); - free(boco->units); - } - if (boco->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&boco->user_data[n]); - free(boco->user_data); - } - if (boco->bprop) { - cgi_free_bprop(boco->bprop); - free(boco->bprop); - } -} - -void cgi_free_dataset(cgns_dataset *dataset) { - int n; - if (dataset->link) free(dataset->link); - if (dataset->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&dataset->descr[n]); - free(dataset->descr); - } - if (dataset->dirichlet) { - cgi_free_bcdata(dataset->dirichlet); - free(dataset->dirichlet); - } - if (dataset->neumann) { - cgi_free_bcdata(dataset->neumann); - free(dataset->neumann); - } - if (dataset->state) { - cgi_free_state(dataset->state); - free(dataset->state); - } - if (dataset->units) { - cgi_free_units(dataset->units); - free(dataset->units); - } - if (dataset->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&dataset->user_data[n]); - free(dataset->user_data); - } -} - -void cgi_free_bcdata(cgns_bcdata *bcdata) { - int n; - if (bcdata->link) free(bcdata->link); - if (bcdata->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&bcdata->descr[n]); - free(bcdata->descr); - } - if (bcdata->narrays) { - for (n=0; nnarrays; n++) - cgi_free_array(&bcdata->array[n]); - free(bcdata->array); - } - if (bcdata->units) { - cgi_free_units(bcdata->units); - free(bcdata->units); - } - if (bcdata->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&bcdata->user_data[n]); - free(bcdata->user_data); - } -} - -void cgi_free_ptset(cgns_ptset *ptset) { - if (ptset->link) free(ptset->link); - if (ptset->data) free(ptset->data); -} - -void cgi_free_equations(cgns_equations *equations) { - int n; - if (equations->link) free(equations->link); - if (equations->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&equations->descr[n]); - free(equations->descr); - } - if (equations->governing) { - cgi_free_governing(equations->governing); - free(equations->governing); - } - if (equations->gas) { - cgi_free_model(equations->gas); - free(equations->gas); - } - if (equations->visc) { - cgi_free_model(equations->visc); - free(equations->visc); - } - if (equations->conduct) { - cgi_free_model(equations->conduct); - free(equations->conduct); - } - if (equations->closure) { - cgi_free_model(equations->closure); - free(equations->closure); - } - if (equations->turbulence) { - if (equations->turbulence->diffusion_model) - free(equations->turbulence->diffusion_model); - cgi_free_model(equations->turbulence); - free(equations->turbulence); - } - if (equations->relaxation) { - cgi_free_model(equations->relaxation); - free(equations->relaxation); - } - if (equations->chemkin) { - cgi_free_model(equations->chemkin); - free(equations->chemkin); - } - if (equations->units) { - cgi_free_units(equations->units); - free(equations->units); - } - if (equations->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&equations->user_data[n]); - free(equations->user_data); - } -} - -void cgi_free_governing(cgns_governing *governing) { - int n; - if (governing->link) free(governing->link); - if (governing->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&governing->descr[n]); - free(governing->descr); - } - if (governing->diffusion_model) free(governing->diffusion_model); - if (governing->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&governing->user_data[n]); - free(governing->user_data); - } -} - -void cgi_free_model(cgns_model *model) { - int n; - if (model->link) free(model->link); - if (model->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&model->descr[n]); - free(model->descr); - } - if (model->narrays) { - for (n=0; nnarrays; n++) - cgi_free_array(&model->array[n]); - free(model->array); - } - if (model->units) { - cgi_free_units(model->units); - free(model->units); - } - if (model->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&model->user_data[n]); - free(model->user_data); - } -} - -void cgi_free_state(cgns_state *state) { - int n; - if (state->link) free(state->link); - if (state->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&state->descr[n]); - free(state->descr); - } - if (state->StateDescription) { - cgi_free_descr(state->StateDescription); - free(state->StateDescription); - } - if (state->narrays) { - for (n=0; nnarrays; n++) - cgi_free_array(&state->array[n]); - free(state->array); - } - if (state->units) { - cgi_free_units(state->units); - free(state->units); - } - if (state->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&state->user_data[n]); - free(state->user_data); - } -} - -void cgi_free_converg(cgns_converg *converg) { - int n; - if (converg->link) free(converg->link); - if (converg->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&converg->descr[n]); - free(converg->descr); - } - if (converg->NormDefinitions) { - cgi_free_descr(converg->NormDefinitions); - free(converg->NormDefinitions); - } - if (converg->narrays) { - for (n=0; nnarrays; n++) - cgi_free_array(&converg->array[n]); - free(converg->array); - } - if (converg->units) { - cgi_free_units(converg->units); - free(converg->units); - } - if (converg->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&converg->user_data[n]); - free(converg->user_data); - } -} - -void cgi_free_discrete(cgns_discrete *discrete) { - int n; - if (discrete->link) free(discrete->link); - if (discrete->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&discrete->descr[n]); - free(discrete->descr); - } - if (discrete->rind_planes) free(discrete->rind_planes); - if (discrete->narrays) { - for (n=0; nnarrays; n++) - cgi_free_array(&discrete->array[n]); - free(discrete->array); - } - if (discrete->units) { - cgi_free_units(discrete->units); - free(discrete->units); - } - if (discrete->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&discrete->user_data[n]); - free(discrete->user_data); - } -} - -void cgi_free_integral(cgns_integral *integral) { - int n; - if (integral->link) free(integral->link); - if (integral->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&integral->descr[n]); - free(integral->descr); - } - if (integral->narrays) { - for (n=0; nnarrays; n++) - cgi_free_array(&integral->array[n]); - free(integral->array); - } - if (integral->units) { - cgi_free_units(integral->units); - free(integral->units); - } - if (integral->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&integral->user_data[n]); - free(integral->user_data); - } -} - -void cgi_free_array(cgns_array *array) { - int n; - if (array->link) free(array->link); - if (array->data) free(array->data); - if (array->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&array->descr[n]); - free(array->descr); - } - if (array->units) { - cgi_free_units(array->units); - free(array->units); - } - if (array->exponents) { - cgi_free_exponents(array->exponents); - free(array->exponents); - } - if (array->convert) { - cgi_free_convert(array->convert); - free(array->convert); - } -} - -void cgi_free_convert(cgns_conversion *convert) { - if (convert->link) free(convert->link); - free(convert->data); -} - -void cgi_free_exponents(cgns_exponent *exponents) { - if (exponents->link) free(exponents->link); - free(exponents->data); -} - -void cgi_free_units(cgns_units *units) { - if (units->link) free(units->link); -} - -void cgi_free_descr(cgns_descr *descr) { - if (descr->link) free(descr->link); - if (descr->text) free(descr->text); -} - -void cgi_free_rmotion(cgns_rmotion *rmotion) { - int n; - if (rmotion->link) free(rmotion->link); - if (rmotion->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&rmotion->descr[n]); - free(rmotion->descr); - } - if (rmotion->narrays) { - for (n=0; nnarrays; n++) - cgi_free_array(&rmotion->array[n]); - free(rmotion->array); - } - if (rmotion->units) { - cgi_free_units(rmotion->units); - free(rmotion->units); - } - if (rmotion->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&rmotion->user_data[n]); - free(rmotion->user_data); - } -} - -void cgi_free_amotion(cgns_amotion *amotion) { - int n; - if (amotion->link) free(amotion->link); - if (amotion->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&amotion->descr[n]); - free(amotion->descr); - } - if (amotion->rind_planes) free(amotion->rind_planes); - if (amotion->narrays) { - for (n=0; nnarrays; n++) - cgi_free_array(&amotion->array[n]); - free(amotion->array); - } - if (amotion->units) { - cgi_free_units(amotion->units); - free(amotion->units); - } - if (amotion->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&amotion->user_data[n]); - free(amotion->user_data); - } -} - -void cgi_free_biter(cgns_biter *biter) { - int n; - if (biter->link) free(biter->link); - if (biter->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&biter->descr[n]); - free(biter->descr); - } - if (biter->narrays) { - for (n=0; nnarrays; n++) - cgi_free_array(&biter->array[n]); - free(biter->array); - } - if (biter->units) { - cgi_free_units(biter->units); - free(biter->units); - } - if (biter->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&biter->user_data[n]); - free(biter->user_data); - } -} - -void cgi_free_ziter(cgns_ziter *ziter) { - int n; - if (ziter->link) free(ziter->link); - if (ziter->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&ziter->descr[n]); - free(ziter->descr); - } - if (ziter->narrays) { - for (n=0; nnarrays; n++) - cgi_free_array(&ziter->array[n]); - free(ziter->array); - } - if (ziter->units) { - cgi_free_units(ziter->units); - free(ziter->units); - } - if (ziter->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&ziter->user_data[n]); - free(ziter->user_data); - } -} - -void cgi_free_gravity(cgns_gravity *gravity) { - int n; - if (gravity->link) free(gravity->link); - if (gravity->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&gravity->descr[n]); - free(gravity->descr); - } - if (gravity->vector) { - cgi_free_array(gravity->vector); - free(gravity->vector); - } - if (gravity->units) { - cgi_free_units(gravity->units); - free(gravity->units); - } - if (gravity->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&gravity->user_data[n]); - free(gravity->user_data); - } -} - -void cgi_free_axisym(cgns_axisym *axisym) { - int n; - if (axisym->link) free(axisym->link); - if (axisym->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&axisym->descr[n]); - free(axisym->descr); - } - if (axisym->units) { - cgi_free_units(axisym->units); - free(axisym->units); - } - if (axisym->narrays) { - for (n=0; nnarrays; n++) - cgi_free_array(&axisym->array[n]); - free(axisym->array); - } - if (axisym->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&axisym->user_data[n]); - free(axisym->user_data); - } -} - -void cgi_free_rotating(cgns_rotating *rotating) { - int n; - if (rotating->link) free(rotating->link); - if (rotating->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&rotating->descr[n]); - free(rotating->descr); - } - if (rotating->units) { - cgi_free_units(rotating->units); - free(rotating->units); - } - if (rotating->narrays) { - for (n=0; nnarrays; n++) - cgi_free_array(&rotating->array[n]); - free(rotating->array); - } - if (rotating->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&rotating->user_data[n]); - free(rotating->user_data); - } -} - -void cgi_free_bprop(cgns_bprop *bprop) { - int n; - if (bprop->link) free(bprop->link); - if (bprop->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&bprop->descr[n]); - free(bprop->descr); - } - if (bprop->bcwall) { - cgi_free_bcwall(bprop->bcwall); - free(bprop->bcwall); - } - if (bprop->bcarea) { - cgi_free_bcarea(bprop->bcarea); - free(bprop->bcarea); - } - if (bprop->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&bprop->user_data[n]); - free(bprop->user_data); - } -} - -void cgi_free_cprop(cgns_cprop *cprop) { - int n; - if (cprop->link) free(cprop->link); - if (cprop->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&cprop->descr[n]); - free(cprop->descr); - } - if (cprop->cperio) { - cgi_free_cperio(cprop->cperio); - free(cprop->cperio); - } - if (cprop->caverage) { - cgi_free_caverage(cprop->caverage); - free(cprop->caverage); - } - if (cprop->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&cprop->user_data[n]); - free(cprop->user_data); - } -} - -void cgi_free_bcwall(cgns_bcwall *bcwall) { - int n; - if (bcwall->link) free(bcwall->link); - if (bcwall->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&bcwall->descr[n]); - free(bcwall->descr); - } - if (bcwall->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&bcwall->user_data[n]); - free(bcwall->user_data); - } -} - -void cgi_free_bcarea(cgns_bcarea *bcarea) { - int n; - if (bcarea->link) free(bcarea->link); - if (bcarea->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&bcarea->descr[n]); - free(bcarea->descr); - } - if (bcarea->narrays) { - for (n=0; nnarrays; n++) - cgi_free_array(&bcarea->array[n]); - free(bcarea->array); - } - if (bcarea->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&bcarea->user_data[n]); - free(bcarea->user_data); - } -} - -void cgi_free_cperio(cgns_cperio *cperio) { - int n; - if (cperio->link) free(cperio->link); - if (cperio->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&cperio->descr[n]); - free(cperio->descr); - } - if (cperio->narrays) { - for (n=0; nnarrays; n++) - cgi_free_array(&cperio->array[n]); - free(cperio->array); - } - if (cperio->units) { - cgi_free_units(cperio->units); - free(cperio->units); - } - if (cperio->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&cperio->user_data[n]); - free(cperio->user_data); - } -} - -void cgi_free_caverage(cgns_caverage *caverage) { - int n; - if (caverage->link) free(caverage->link); - if (caverage->ndescr) { - for (n=0; nndescr; n++) - cgi_free_descr(&caverage->descr[n]); - free(caverage->descr); - } - if (caverage->nuser_data) { - for (n=0; nnuser_data; n++) - cgi_free_user_data(&caverage->user_data[n]); - free(caverage->user_data); - } -} - -void cgi_free_user_data(cgns_user_data *user_data) { - int n; - if (user_data->link) free(user_data->link); - if (user_data->narrays) { - for (n=0; nnarrays; n++) - cgi_free_array(&user_data->array[n]); - free(user_data->array); - } -} - -/***********************************************************************\ - * Return the string from enumeration * -\***********************************************************************/ - -int cgi_GridLocation(char *LocationName, GridLocation_t *type) { - int i; - for (i=0; iversion > CGNSLibVersion) { - (*type) = GridLocationUserDefined; - cgi_warning("Unrecognized Grid Location Type '%s' replaced with 'UserDefined'",LocationName); - return 0; - } - cgi_error("Unrecognized GridLocation: %s", LocationName); - return 1; -} - -int cgi_GridConnectivityType(char *GridConnectivityName, GridConnectivityType_t *type) { - int i; - for (i=0; iversion > CGNSLibVersion) { - (*type) = GridConnectivityTypeUserDefined; - cgi_warning("Unrecognized Grid Connectivity Type '%s' replaced with 'UserDefined'",GridConnectivityName); - return 0; - } - cgi_error("Unrecognized GridConnectivityType: %s", GridConnectivityName); - return 1; -} - -int cgi_PointSetType(char *PointSetName, PointSetType_t *type) { - int i; - for (i=0; iversion > CGNSLibVersion) { - (*type) = PointSetTypeUserDefined; - cgi_warning("Unrecognized Point Set Type '%s' replaced with 'UserDefined'",PointSetName); - return 0; - } - cgi_error("Unrecognized PointSetType: %s", PointSetName); - return 1; -} - -int cgi_BCType(char *BCName, BCType_t *type) { - int i; - for (i=0; iversion > CGNSLibVersion) { - (*type) = BCTypeUserDefined; - cgi_warning("Unrecognized BCType '%s' replaced with 'UserDefined'",BCName); - return 0; - } - cgi_error("Unrecognized BCType: %s", BCName); - return 1; -} - -int cgi_DataClass(char *Name, DataClass_t *data_class) { - int i; - for (i=0; iversion > CGNSLibVersion) { - (*data_class) = DataClassUserDefined; - cgi_warning("Unrecognized Data Class '%s' replaced with 'UserDefined'",Name); - return 0; - } - cgi_error("Unrecognized Data Class: %s",Name); - return 1; -} - -int cgi_MassUnits(char *Name, MassUnits_t *mass_unit) { - int i; - char_33 mass; - - for (i=31; i>=0 && Name[i]==' '; i--); - Name[i+1]='\0'; - strcpy(mass,Name); - - for (i=0; iversion > CGNSLibVersion) { - (*mass_unit) = MassUnitsUserDefined; - cgi_warning("Unrecognized Mass Unit '%s' replaced with 'UserDefined'",Name); - return 0; - } - (*mass_unit) = MassUnitsNull; - cgi_error("Unrecognized Mass Units Name: %s", Name); - return 1; -} - -int cgi_LengthUnits(char *Name, LengthUnits_t *length_unit) { - int i; - char_33 length; - - for (i=31; i>=0 && Name[i]==' '; i--); - Name[i+1]='\0'; - strcpy(length,Name); - - for (i=0; iversion > CGNSLibVersion) { - (*length_unit) = LengthUnitsUserDefined; - cgi_warning("Unrecognized Length Unit '%s' replaced with 'UserDefined'",Name); - return 0; - } - (*length_unit) = LengthUnitsNull; - cgi_error("Unrecognized Length Units Name: %s", Name); - return 1; -} - -int cgi_TimeUnits(char *Name, TimeUnits_t *time_unit) { - int i; - char_33 time; - - for (i=31; i>=0 && Name[i]==' '; i--); - Name[i+1]='\0'; - strcpy(time,Name); - - for (i=0; iversion > CGNSLibVersion) { - (*time_unit) = TimeUnitsUserDefined; - cgi_warning("Unrecognized Time Unit '%s' replaced with 'UserDefined'",Name); - return 0; - } - (*time_unit) = TimeUnitsNull; - cgi_error("Unrecognized Time Units Name: %s", Name); - return 1; -} - -int cgi_TemperatureUnits(char *Name, TemperatureUnits_t *temperature_unit) { - int i; - char_33 temp; - - for (i=31; i>=0 && Name[i]==' '; i--); - Name[i+1]='\0'; - strcpy(temp,Name); - - for (i=0; iversion > CGNSLibVersion) { - (*temperature_unit) = TemperatureUnitsUserDefined; - cgi_warning("Unrecognized Temperature Unit '%s' replaced with 'UserDefined'",Name); - return 0; - } - (*temperature_unit) = TemperatureUnitsNull; - cgi_error("Unrecognized Temperature Units Name: %s", Name); - return 1; -} - -int cgi_AngleUnits(char *Name, AngleUnits_t *angle_unit) { - int i; - char_33 angle; - - for (i=31; i>=0 && Name[i]==' '; i--); - Name[i+1]='\0'; - strcpy(angle,Name); - - for (i=0; iversion > CGNSLibVersion) { - (*angle_unit) = AngleUnitsUserDefined; - cgi_warning("Unrecognized Angle Unit '%s' replaced with 'UserDefined'",Name); - return 0; - } - (*angle_unit) = AngleUnitsNull; - cgi_error("Unrecognized Angle Units Name: %s", Name); - return 1; -} - -int cgi_GoverningEquationsType(char *Name, GoverningEquationsType_t *type) { - int i; - for (i=0; iversion > CGNSLibVersion) { - (*type) = GoverningEquationsUserDefined; - cgi_warning("Unrecognized Governing Equations Type '%s' replaced with 'UserDefined'",Name); - return 0; - } - cgi_error("Unrecognized Governing Equations Type: %s", Name); - return 1; -} - -int cgi_ModelType(char *Name, ModelType_t *type) { - int i; - for (i=0; iversion > CGNSLibVersion) { - (*type) = ModelTypeUserDefined; - cgi_warning("Unrecognized Model Type '%s' replaced with 'UserDefined'",Name); - return 0; - } - cgi_error("Unrecognized Model Type : %s", Name); - return 1; -} - -int cgi_ZoneType(char *Name, ZoneType_t *type) { - int i; - for (i=0; iversion > CGNSLibVersion) { - (*type) = ZoneTypeUserDefined; - cgi_warning("Unrecognized Zone Type '%s' replaced with 'UserDefined'",Name); - return 0; - } - cgi_error("Unrecognized Zone Type : %s", Name); - return 1; -} - -int cgi_RigidGridMotionType(char *Name, RigidGridMotionType_t *type) { - int i; - for (i=0; iversion > CGNSLibVersion) { - (*type) = RigidGridMotionTypeUserDefined; - cgi_warning("Unrecognized Rigid Grid Motion Type '%s' replaced with 'UserDefined'",Name); - return 0; - } - cgi_error("Unrecognized Rigid Grid Motion Type: %s", Name); - return 1; -} - -int cgi_ArbitraryGridMotionType(char *Name, ArbitraryGridMotionType_t *type) { - int i; - for (i=0; iversion > CGNSLibVersion) { - (*type) = ArbitraryGridMotionTypeUserDefined; - cgi_warning("Unrecognized Arbitrary Grid Motion Type '%s' replaced with 'UserDefined'",Name); - return 0; - } - cgi_error("Unrecognized Arbitrary Grid Motion Type: %s", Name); - return 1; -} - -int cgi_SimulationType(char *Name, SimulationType_t *type) { - int i; - for (i=0; iversion > CGNSLibVersion) { - (*type) = SimulationTypeUserDefined; - cgi_warning("Unrecognized Simulation Type '%s' replaced with 'UserDefined'",Name); - return 0; - } - cgi_error("Unrecognized Simulation Type: %s", Name); - return 1; -} - -int cgi_WallFunctionType(char *Name, WallFunctionType_t *type) { - int i; - for (i=0; iversion > CGNSLibVersion) { - (*type) = WallFunctionTypeUserDefined; - cgi_warning("Unrecognized Wall Function Type '%s' replaced with 'UserDefined'",Name); - return 0; - } - cgi_error("Unrecognized Wall Function Type: %s", Name); - return 1; -} - -int cgi_AreaType(char *Name, AreaType_t *type) { - int i; - for (i=0; iversion > CGNSLibVersion) { - (*type) = AreaTypeUserDefined; - cgi_warning("Unrecognized Area Type '%s' replaced with 'UserDefined'",Name); - return 0; - } - cgi_error("Unrecognized Area Type: %s", Name); - return 1; -} - -int cgi_AverageInterfaceType(char *Name, AverageInterfaceType_t *type) { - int i; - for (i=0; iversion > CGNSLibVersion) { - (*type) = AverageInterfaceTypeUserDefined; - cgi_warning("Unrecognized Average Interface Type '%s' replaced with 'UserDefined'",Name); - return 0; - } - cgi_error("Unrecognized Average Interface Type: %s", Name); - return 1; -} - -void cgi_array_print(char *routine, cgns_array *array) { - int n; - - printf("In %s:\n", routine); - printf("\t array->name='%s'\n",array->name); - printf("\t array->dim_vals="); - for (n=0; ndata_dim; n++) printf("%d ",array->dim_vals[n]); - printf("\n"); - printf("\t array->data_type='%s'\n",DataTypeName[cgi_datatype(array->data_type)]); - printf("\t array->id=%13.6e\n",array->id); - printf("\t array->ndescr=%d\n",array->ndescr); - for (n=0; nndescr; n++) printf("%s\n",array->descr->text); - if (array->data_class) - printf("\t array->data_class=%s\n",DataClassName[array->data_class]); - for (n=0; n<(array->dim_vals[0]*array->dim_vals[1]); n++) - printf("%d ", *((int *)array->data+n)); - - return; -} - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/cgnslib.c b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/cgnslib.c deleted file mode 100644 index 89abbeacf4..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/cgnslib.c +++ /dev/null @@ -1,7709 +0,0 @@ -/*********************************************************************** - * Revisions: - * - ***********************************************************************/ - -#ifndef MAKEDEPEND -#include -#include -#include -#include -#include -#include -#if !defined(_WIN32) || (defined(_WIN32) && defined(__NUTC__)) -#include -#else -#include /* suggested by MTI */ -#endif -#endif - -#include "cgnslib.h" -#include "cgns_header.h" -#include "libadf/ADF.h" - -#if defined(_WIN32) && !defined(__NUTC__) -#ifndef MAKEDEPEND -#include -#endif -#ifndef F_OK -#define R_OK 004 /* Test for Read permission */ -#define W_OK 002 /* Test for Write permission */ -#define X_OK 001 /* Test for eXecute permission */ -#define F_OK 000 /* Test for existence of File */ -#endif -/* fix for unresolved reference to __ftol2 when using VC7 with VC6 libs */ -/* see http://www.manusoft.com/Resources/ARXTips/Main.stm */ -#ifdef NEED_FTOL2 -#ifdef __cplusplus -extern "C" { -#endif -long _ftol(double); -long _ftol2(double dValue) {return _ftol(dValue);} -#ifdef __cplusplus -} -#endif -#endif -#endif - -/*********************************************************************** - * external variable declarations - ***********************************************************************/ -cgns_file *cgns_files = 0; -cgns_file *cg; -int n_cgns_files = 0; -void *posit = 0; -char_33 posit_label; -int posit_base, posit_zone; -int CGNSLibVersion=CGNS_VERSION;/* Version of the CGNSLibrary*1000 */ - /* Update also nVersions and VersionList, - and FileVersion in cgns_internals.c */ - -/*********************************************************************** - * Name strings - ***********************************************************************/ -char const * MassUnitsName[NofValidMassUnits] = - {"Null", "UserDefined", - "Kilogram", "Gram", "Slug", "PoundMass" - }; -char const * LengthUnitsName[NofValidLengthUnits] = - {"Null", "UserDefined", - "Meter", "Centimeter", "Millimeter", "Foot", "Inch" - }; -char const * TimeUnitsName[NofValidTimeUnits] = - {"Null", "UserDefined", - "Second" - }; -char const * TemperatureUnitsName[NofValidTemperatureUnits] = - {"Null", "UserDefined", - "Kelvin", "Celcius", "Rankine", "Fahrenheit" - }; -char const * AngleUnitsName[NofValidAngleUnits] = - {"Null", "UserDefined", - "Degree", "Radian" - }; -char const * DataClassName[NofValidDataClass] = - {"Null", "UserDefined", - "Dimensional", "NormalizedByDimensional", - "NormalizedByUnknownDimensional", "NondimensionalParameter", - "DimensionlessConstant" - }; -char const * GridLocationName[NofValidGridLocation] = - {"Null", "UserDefined", - "Vertex", "CellCenter", "FaceCenter", "IFaceCenter", - "JFaceCenter", "KFaceCenter", "EdgeCenter" - }; -char const * BCDataTypeName[NofValidBCDataTypes] = - {"Null", "UserDefined", - "Dirichlet", "Neumann" - }; -char const * GridConnectivityTypeName[NofValidGridConnectivityTypes] = - {"Null", "UserDefined", - "Overset", "Abutting", "Abutting1to1" - }; -char const * PointSetTypeName[NofValidPointSetTypes] = - {"Null", "UserDefined", - "PointList", "PointListDonor", - "PointRange", "PointRangeDonor", - "ElementRange", "ElementList", "CellListDonor" - }; -char const * GoverningEquationsTypeName[NofValidGoverningEquationsTypes]= - {"Null", "UserDefined", - "FullPotential", "Euler", "NSLaminar", - "NSTurbulent", "NSLaminarIncompressible", - "NSTurbulentIncompressible" - }; -char const * ModelTypeName[NofValidModelTypes]= - {"Null", "UserDefined", - "Ideal", "VanderWaals", "Constant", "PowerLaw", "SutherlandLaw", - "ConstantPrandtl", "EddyViscosity", "ReynoldsStress", "ReynoldsStressAlgebraic", - "Algebraic_BaldwinLomax", "Algebraic_CebeciSmith", - "HalfEquation_JohnsonKing", "OneEquation_BaldwinBarth", - "OneEquation_SpalartAllmaras", "TwoEquation_JonesLaunder", - "TwoEquation_MenterSST", "TwoEquation_Wilcox", - "CaloricallyPerfect", "ThermallyPerfect", - "ConstantDensity", "RedlichKwong", - "Frozen", "ThermalEquilib", "ThermalNonequilib", - "ChemicalEquilibCurveFit", "ChemicalEquilibMinimization", - "ChemicalNonequilib" - }; -char const * BCTypeName[NofValidBCTypes] = - {"Null", "UserDefined", - "BCAxisymmetricWedge", "BCDegenerateLine", "BCDegeneratePoint", - "BCDirichlet", "BCExtrapolate", "BCFarfield", "BCGeneral", - "BCInflow", "BCInflowSubsonic", "BCInflowSupersonic", "BCNeumann", - "BCOutflow", "BCOutflowSubsonic", "BCOutflowSupersonic", - "BCSymmetryPlane", "BCSymmetryPolar", "BCTunnelInflow", - "BCTunnelOutflow", "BCWall", "BCWallInviscid", "BCWallViscous", - "BCWallViscousHeatFlux", "BCWallViscousIsothermal", "FamilySpecified" - }; -char const * DataTypeName[NofValidDataTypes] = - {"Null", "UserDefined", - "Integer", "RealSingle", "RealDouble", "Character" - }; -char const * ElementTypeName[NofValidElementTypes] = - {"Null", "UserDefined", - "NODE", "BAR_2", "BAR_3", - "TRI_3", "TRI_6", - "QUAD_4", "QUAD_8", "QUAD_9", - "TETRA_4", "TETRA_10", - "PYRA_5", "PYRA_14", - "PENTA_6", "PENTA_15", "PENTA_18", - "HEXA_8", "HEXA_20", "HEXA_27", - "MIXED", "NGON_n" - }; -char const * ZoneTypeName[NofValidZoneTypes] = - {"Null", "UserDefined", - "Structured", "Unstructured" - }; -char const * RigidGridMotionTypeName[NofValidRigidGridMotionTypes] = - {"Null", "UserDefined", - "ConstantRate", "VariableRate" - }; -char const * ArbitraryGridMotionTypeName[NofValidArbitraryGridMotionTypes] = - {"Null", "UserDefined", - "NonDeformingGrid", "DeformingGrid" - }; -char const * SimulationTypeName[NofValidSimulationTypes] = - {"Null", "UserDefined", - "TimeAccurate", "NonTimeAccurate" - }; -char const * WallFunctionTypeName[NofValidWallFunctionTypes] = - {"Null", "UserDefined", "Generic" - }; -char const * AreaTypeName[NofValidAreaTypes] = - {"Null", "UserDefined", - "BleedArea", "CaptureArea" - }; -char const * AverageInterfaceTypeName[NofValidAverageInterfaceTypes] = - {"Null", "UserDefined", - "AverageAll", "AverageCircumferential", "AverageRadial", - "AverageI", "AverageJ", "AverageK" - }; - -/*********************************************************************** - * global variable definitions - ***********************************************************************/ -int n_open = 0; -int cgns_file_size = 0; -int temp_index; /* index of temporary names */ -int VersionList[] = {2300, 2200, 2100, 2000, 1270, 1200, 1100, 1050}; -#define nVersions (sizeof(VersionList)/sizeof(int)) -int cg_t1, cg_t0; - -/*********************************************************************** - * library functions - ***********************************************************************/ - -/*********************************************************************** - * cg_open(char *filename, int mode, int *file_number) - * - ***********************************************************************/ - -int cg_open(char const * filename, int mode, int *file_number) { - int not_found; - char *fmode; - int ierr, dim_vals; - double rootid, dummy_id; - float FileVersion; - - /* initialize temp_index */ - temp_index=0; - - /* determine accessibility of a file : - If the requested access is permitted, a value of 0 is returned. */ - - not_found = access(filename, F_OK) ; - - /* check file mode */ - switch(mode) { - case MODE_READ: - if (not_found) { - cgi_error("Error opening file: '%s' not found!", filename); - return CG_ERROR; - } - fmode = "READ_ONLY"; /* mode "r" */ - break; - case MODE_WRITE: - if (!not_found) { - unlink(filename); - /*cgi_error("Error opening file: '%s' already exists!", filename); - return CG_ERROR; - */ - } - fmode = "NEW"; /* mode "w+" */ - break; - case MODE_MODIFY: - if (not_found) { - cgi_error("Error opening file: '%s' not found!", filename); - return CG_ERROR; - } - fmode = "OLD"; /* mode "r+" */ - break; - default: - cgi_error("Unknown opening file mode: %d ??",mode); - return CG_ERROR; - } - - /* Open CGNS file */ - ADF_Database_Open(filename, fmode, "NATIVE", &rootid, &ierr); - if (ierr>0) { - adf_error("ADF_Database_Open",ierr); - return CG_ERROR; - } - n_open++; - - /* make sure there is enough space in the cgns_files array */ - if (cgns_file_size == 0) { - cgns_file_size = 1; - cgns_files = CGNS_NEW(cgns_file,cgns_file_size); - } else if (n_cgns_files == cgns_file_size) { - cgns_file_size *= 2; - cgns_files = CGNS_RENEW(cgns_file,cgns_file_size, cgns_files); - } - cg = &(cgns_files[n_cgns_files]); - n_cgns_files++; - (*file_number) = n_cgns_files; - - /* Keep in-memory copy of cgns file 'header' information */ - cg->mode = mode; - cg->filename = (char *) malloc(strlen(filename) + 1); - strcpy(cg->filename, filename); - cg->rootid=rootid; - cg->file_number = (*file_number); - cg->version = 0; - cg->deleted = 0; - cg->added = 0; - - /* CGNS-Library Version */ - if (mode == MODE_WRITE) { - dim_vals = 1; - FileVersion = (float) CGNS_DOTVERS; - if (cgi_new_node(cg->rootid, "CGNSLibraryVersion", - "CGNSLibraryVersion_t", &dummy_id, "R4", 1, &dim_vals, - (void *)&FileVersion)) return CG_ERROR; - cg->version = CGNSLibVersion; - } - else { - - /* read file version from file and set cg->version = FileVersion*1000 */ - if (cg_version(cg->file_number, &FileVersion)) return CG_ERROR; - - /* Check that the library version is at least as recent as the one used - to create the file being read */ - - if (cg->version > CGNSLibVersion) { - - /* This code allows reading version newer than the lib, - as long as the 1st digit of the versions are equal */ - if ((cg->version - (cg->version%1000)) > - (CGNSLibVersion - (CGNSLibVersion%1000))) { - cgi_error("The file %s was written with a more recent version of the CGNS library. You must update your CGNS library before trying to read this file.",filename); - return CG_ERROR; - } else { - cgi_warning("The file being read is more recent that the CGNS library used"); - } - } - } - - /* Get ADF Database version & dates, and ADF Library version */ - ADF_Database_Version(rootid, cg->dtb_version, cg->creation_date, - cg->modify_date, &ierr); - if (ierr>0) { - adf_error("ADF_Database_Version",ierr); - return CG_ERROR; - } - ADF_Library_Version(cg->adf_lib_version, &ierr); - if (ierr>0) { - adf_error("ADF_Library_Version",ierr); - return CG_ERROR; - } - - /* read CGNS file */ - if (mode == MODE_READ || mode == MODE_MODIFY) { - if (cgi_read(cg)) return CG_ERROR; - - /* update version number in modify mode */ - if (cg->version < CGNSLibVersion && mode == MODE_MODIFY) { - int nnod; - double *id; - FileVersion = (float)CGNS_DOTVERS; - if (cgi_get_nodes(cg->rootid, "CGNSLibraryVersion_t", &nnod, &id)) - return CG_ERROR; - if (nnod) { - ADF_Write_All_Data(id[0], (const char *)&FileVersion, &ierr); - if (ierr > 0) { - adf_error("ADF_Write_All_Data",ierr); - return CG_ERROR; - } - free(id); - } - else { - dim_vals = 1; - if (cgi_new_node(cg->rootid, "CGNSLibraryVersion", - "CGNSLibraryVersion_t", &dummy_id, "R4", 1, &dim_vals, - (void *)&FileVersion)) return CG_ERROR; - } - cg->version = CGNSLibVersion; - } - } else { - cg->nbases=0; - cg->base = 0; - } - - return CG_OK; -} - -int cg_version(int file_number, float *FileVersion) { - int nnod; - double *id; - float *data; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - -/* if open in MODE_WRITE */ - if (cg->version) { - (*FileVersion)=(float)(cg->version)/1000; - return CG_OK; - } - -/* if open in MODE_READ or MODE_MODIFY */ - /* get number of CGNSLibraryVersion_t nodes and their ADF_ID */ - if (cgi_get_nodes(cg->rootid, "CGNSLibraryVersion_t", &nnod, &id)) - return CG_ERROR; - if (nnod==0) { - cg->version=1050; - *FileVersion= (float) 1.05; - } else if (nnod!=1) { - cgi_error("More then one CGNSLibraryVersion_t node found under ROOT."); - return CG_ERROR; - } else { - int vers, ndim, dim_vals[12], temp_version; - char_33 node_name; - char_33 data_type; - - if (cgi_read_node(id[0], node_name, data_type, &ndim, dim_vals, - (void **)&data, 1)) { - cgi_error("Error reading CGNS-Library-Version"); - return CG_ERROR; - } - /* check data type */ - if (strcmp(data_type,"R4")!=0) { - cgi_error("Unexpected data type for CGNS-Library-Version='%s'",data_type); - return CG_ERROR; - } - /* check data dim */ - if (ndim != 1 || (dim_vals[0]!=1)) { - cgi_error("Wrong data dimension for CGNS-Library-Version"); - return CG_ERROR; - } - /* save data */ - *FileVersion = data[0]; - free(data); - cg->version = (int)(1000.0*(*FileVersion)+0.5); - - /* To prevent round off error in version number for file of older or current version */ - temp_version = cg->version; - /* cg->version = 0; Commented for fwd compatibility */ - for (vers=0; (unsigned) vers (VersionList[vers]-2) && - temp_version < (VersionList[vers]+2)) { - cg->version = VersionList[vers]; - break; - } - } - if (cg->version == 0) { - cgi_error("Error: Unable to determine the version number"); - return CG_ERROR; - } - - free(id); - } -#if DEBUG_VERSION - printf("FileVersion=%f\n",*FileVersion); - printf("cg->version=%d\n",cg->version); -#endif - - return CG_OK; -} - -int cg_close(int file_number) { - int ierr=0; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cg->mode == MODE_MODIFY && cg->deleted) { - char *temp_filename; - double output_id; - - temp_filename = CGNS_NEW(char, strlen(cg->filename)+6); - sprintf(temp_filename,"%s.temp",cg->filename); - unlink(temp_filename); - - ADF_Database_Open (temp_filename, "NEW", "NATIVE", &output_id, &ierr); - if (ierr > 0) { - adf_error ("ADF_Database_Open", ierr); - return CG_ERROR; - } - - ADF_Flush_to_Disk (cg->rootid, &ierr); - /* adf_cond copies & compressed data from input_id to output_id, then - closes output_id */ - adf_cond (cg->rootid, output_id); - ADF_Database_Close (cg->rootid, &ierr); - if (ierr > 0) { - adf_error ("ADF_Database_Close", ierr); - return CG_ERROR; - } - unlink (cg->filename); - if (rename (temp_filename, cg->filename)) { - cgi_error("rename of %s -> %s failed", temp_filename, cg->filename); - return CG_ERROR; - } - } - - else { - /* Close file */ - ADF_Database_Close (cg->rootid, &ierr); - if (ierr>0) { - adf_error("ADF_Database_Close",ierr); - return CG_ERROR; - } - } - - n_open--; - - /* Free the in-memory copy of the CGNS file - cg->mode = MODE_CLOSED; */ - - cgi_free_file(cg); - - return CG_OK; -} - -/*****************************************************************************\ - * Inquiry Functions for CGNSBase_t Nodes -\*****************************************************************************/ -int cg_nbases(int file_number, int *nbases) { - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - *nbases = cg->nbases; - return CG_OK; -} - -int cg_base_read(int file_number, int B, char *basename, int *cell_dim, - int *phys_dim) { - cgns_base *base; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - base = cgi_get_base(cg, B); - if (base==0) return CG_ERROR; - - *cell_dim = base->cell_dim; - *phys_dim = base->phys_dim; - strcpy(basename, base->name); - - return CG_OK; -} - -int cg_base_id(int file_number, int B, double *base_id) { - cgns_base *base; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - base = cgi_get_base(cg, B); - if (base==0) return CG_ERROR; - - *base_id = base->id; - return CG_OK; -} -/*****************************************************************************\ - * Inquiry Functions for Zone_t Nodes -\*****************************************************************************/ - -int cg_nzones(int file_number, int B, int *nzones) { - cgns_base *base; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - base = cgi_get_base(cg, B); - if (base==0) return CG_ERROR; - - *nzones = base->nzones; - return CG_OK; -} - -int cg_zone_type(int file_number, int B, int Z, ZoneType_t *type) { - cgns_zone *zone; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return CG_ERROR; - - *type = zone->type; - return CG_OK; -} - -int cg_zone_read(int file_number, int B, int Z, char *zonename, - int *nijk) { - cgns_zone *zone; - int i; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return CG_ERROR; - - strcpy(zonename, zone->name); - - for (i=0; i<3*(zone->index_dim); i++) nijk[i] = zone->nijk[i]; - - return CG_OK; -} - -int cg_zone_id(int file_number, int B, int Z, double *zone_id) { - cgns_zone *zone; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return CG_ERROR; - - *zone_id = zone->id; - return CG_OK; -} - -/*****************************************************************************\ - * Inquiry Functions for Family_t Nodes -\*****************************************************************************/ -int cg_nfamilies(int file_number, int B, int *nfamilies) { - cgns_base *base; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - base = cgi_get_base(cg, B); - if (base==0) return CG_ERROR; - - *nfamilies = base->nfamilies; - return CG_OK; -} - -int cg_family_read(int file_number, int B, int F, char *family_name, - int *nboco, int *ngeos) { - - cgns_family *family; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - family = cgi_get_family(cg, B, F); - if (family==0) return CG_ERROR; - - strcpy(family_name, family->name); - *nboco = family->nfambc; - *ngeos = family->ngeos; - - return CG_OK; -} - -int cg_fambc_read(int file_number, int B, int F, int BC, - char *fambc_name, BCType_t *bocotype) { - cgns_family *family; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - family = cgi_get_family(cg, B, F); - if (family==0) return CG_ERROR; - - if (BC<=0 || BC>family->nfambc) { - cgi_error("Invalid family b.c. number"); - return CG_ERROR; - } - strcpy(fambc_name,family->fambc[BC-1].name); - *bocotype = family->fambc[BC-1].type; - - return CG_OK; -} - -int cg_geo_read(int file_number, int B, int F, int G, char *geo_name, - char **geo_file, char *CAD_name, int *npart) { - cgns_family *family; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - family = cgi_get_family(cg, B, F); - if (family==0) return CG_ERROR; - - if (G<=0 || G>family->ngeos) { - cgi_error("Invalid geometry reference number"); - return CG_ERROR; - } - strcpy(geo_name,family->geo[G-1].name); - strcpy(CAD_name,family->geo[G-1].format); - - /* This string is not limited to 32 characters and can't be pre-allocated - in the application */ - geo_file[0]=CGNS_NEW(char,strlen(family->geo[G-1].file)+1); - strcpy(geo_file[0],family->geo[G-1].file); - - *npart=family->geo[G-1].npart; - - return CG_OK; -} - -int cg_part_read(int file_number, int B, int F, int G, int P, char *part_name) { - cgns_family *family; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - family = cgi_get_family(cg, B, F); - if (family==0) return CG_ERROR; - - if (P<=0 || P>family->geo[G-1].npart) { - cgi_error("Invalid part number"); - return CG_ERROR; - } - strcpy(part_name,family->geo[G-1].part[P-1].name); - return CG_OK; -} - -/*****************************************************************************\ - * Inquiry Functions for DiscreteData_t Nodes -\*****************************************************************************/ -int cg_ndiscrete(int file_number, int B, int Z, int *ndiscrete) { - cgns_zone *zone; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return CG_ERROR; - - (*ndiscrete) = zone->ndiscrete; - return CG_OK; -} - -int cg_discrete_read(int file_number, int B, int Z, int D, char *discrete_name) { - - cgns_discrete *discrete; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - discrete = cgi_get_discrete(cg, B, Z, D); - if (discrete==0) return CG_ERROR; - - strcpy(discrete_name, discrete->name); - - return CG_OK; -} -/*****************************************************************************\ - * Inquiry Functions for GridCoordinates_t Nodes -\*****************************************************************************/ -int cg_ngrids(int file_number, int B, int Z, int *ngrids) { - cgns_zone *zone; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - /* Get memory address for zone */ - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return CG_ERROR; - - (*ngrids) = zone->nzcoor; - return CG_OK; -} - -int cg_grid_read(int file_number, int B, int Z, int G, char *gridname) { - cgns_zcoor *zcoor; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - /* Get memory address for GridCoordinates_t node */ - zcoor = cgi_get_zcoor(cg, B, Z, G); - if (zcoor==0) return CG_ERROR; - - /* Return ADF name for the GridCoordinates_t node */ - strcpy(gridname,zcoor->name); - return CG_OK; -} - -/*****************************************************************************\ - * Inquiry Functions for GridCoordinates_t/DataArray_t Nodes -\*****************************************************************************/ -int cg_ncoords(int file_number, int B, int Z, int *ncoords) { - cgns_zcoor *zcoor; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - /* Get memory address for node "GridCoordinates" */ - zcoor = cgi_get_zcoorGC(cg, B, Z); - if (zcoor==0) *ncoords = 0; /* if ZoneGridCoordinates_t is undefined */ - else *ncoords = zcoor->ncoords; - return CG_OK; -} - -int cg_coord_info(int file_number, int B, int Z, int C, DataType_t *type, char *coordname) { - cgns_zcoor *zcoor; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - /* Get memory address for node "GridCoordinates" */ - zcoor = cgi_get_zcoorGC(cg, B, Z); - if (zcoor==0) return CG_ERROR; - - if (C>zcoor->ncoords || C<=0) { - cgi_error("coord number %d invalid",C); - return CG_ERROR; - } - *type = cgi_datatype(zcoor->coord[C-1].data_type); - strcpy(coordname, zcoor->coord[C-1].name); - - return CG_OK; -} - -int cg_coord_read(int file_number, int B, int Z, char const * coordname, DataType_t type, - int const * rmin, int const * rmax, void *coord_ptr) { - cgns_zcoor *zcoor; - cgns_array *coord; - int n, num=1, pos, i, j, k, c; - void *xyz; - int imin[3], imax[3]; - int ierr=0; - int read_full_range=1; - int npt=0; - int index_dim; - -/* define: rmin[0]<=i<=rmax[0] where the max range is 1<=i<=imax - rmin[1]<=j<=rmax[1] 1<=j<=jmax - only 3D rmin[2]<=k<=rmax[2] 1<=k<=kmax -*/ - - /* verify input */ - if (type!=RealSingle && type!=RealDouble) { - cgi_error("Invalid data type for coord. array: %d",type); - return CG_ERROR; - } - /* find address */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - /* Get memory address for node "GridCoordinates" */ - zcoor = cgi_get_zcoorGC(cg, B, Z); - if (zcoor==0) return CG_ERROR; - - /* find the coord address in the database */ - coord = 0; - for (c=0; cncoords; c++) { - if (strcmp(zcoor->coord[c].name, coordname)==0) { - coord = &zcoor->coord[c]; - break; - } - } - if (coord==0) { - cgi_error("Coordinate %s not found.",coordname); - return CG_NODE_NOT_FOUND; - } - - /* number of points in data array: */ - index_dim=cg->base[B-1].zone[Z-1].index_dim; - num = 1; - for (n=0; ndim_vals[n]; - - /* verify that range requested does not exceed range stored */ - for (n=0; n coord->dim_vals[n] || rmin[n]<1) { - cgi_error("Invalid range of data requested"); - return CG_ERROR; - } - } - - /* check if requested to return full range */ - for (n=0; ndim_vals[n]) { - read_full_range=0; - break; - } - } - - /* Read entire data array into 'xyz': */ - /* Decide not to use ADF_Read_Data due to the C/f77 ordering mismatch */ - if ((xyz=(void *)malloc(num*size_of(coord->data_type)))==NULL) { - cgi_error("Error allocating xyz"); - return CG_ERROR; - } - ADF_Read_All_Data(coord->id, (char *) xyz, &ierr); - if (ierr>0) { - adf_error("ADF_Read_All_Data",ierr); - return CG_ERROR; - } - /* qick transfer of data if same data types and if read whole array */ - if (read_full_range && type==cgi_datatype(coord->data_type)) { - memcpy(coord_ptr, xyz, num*size_of(coord->data_type)); - - } else { - /* Bring to 3D even if 2D or 1D */ - for (n=0; ndata_type)==RealSingle) { - for (k=imin[2]-1; kdim_vals[0] + k*coord->dim_vals[0]*coord->dim_vals[1]; - *((float *) coord_ptr+npt) = *((float *) xyz+pos); - npt++; - } - /* R4 - R8 */ - } else if (type==RealSingle && cgi_datatype(coord->data_type)==RealDouble) { - for (k=imin[2]-1; kdim_vals[0] + k*coord->dim_vals[0]*coord->dim_vals[1]; - *((float *) coord_ptr+npt) = (float)(*((double *) xyz+pos)); - npt++; - } - /* R8 - R4 */ - } else if (type==RealDouble && cgi_datatype(coord->data_type)==RealSingle) { - for (k=imin[2]-1; kdim_vals[0] + k*coord->dim_vals[0]*coord->dim_vals[1]; - *((double *) coord_ptr+npt) = (double)(*((float *) xyz+pos)); - npt++; - } - /* R8 - R8 */ - } else if (type==RealDouble && cgi_datatype(coord->data_type)==RealDouble) { - for (k=imin[2]-1; kdim_vals[0] + k*coord->dim_vals[0]*coord->dim_vals[1]; - *((double *) coord_ptr+npt) = *((double *) xyz+pos); - npt++; - } - } - } - free(xyz); - return CG_OK; -} - -int cg_coord_id(int file_number, int B, int Z, int C, double *coord_id) { - cgns_zcoor *zcoor; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - /* Get memory address for node "GridCoordinates" */ - zcoor = cgi_get_zcoorGC(cg, B, Z); - if (zcoor==0) return CG_ERROR; - - if (C>zcoor->ncoords || C<=0) { - cgi_error("coord number %d invalid",C); - return CG_ERROR; - } - - *coord_id = zcoor->coord[C-1].id; - return CG_OK; -} - -/*****************************************************************************\ - * Inquiry Functions for Elements_t Nodes -\*****************************************************************************/ - -int cg_nsections(int file_number, int B, int Z, int *nsections) { - cgns_zone *zone; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return CG_ERROR; - - (*nsections) = zone->nsections; - return CG_OK; -} - -int cg_section_read(int file_number, int B, int Z, int S, char *SectionName, - ElementType_t *type, int *start, int *end, int *nbndry, int *parent_flag) { - cgns_section *section; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - section = cgi_get_section(cg, B, Z, S); - if (section == 0) return CG_ERROR; - - strcpy(SectionName, section->name); - *type = section->el_type; - *start = section->range[0]; - *end = section->range[1]; - *nbndry = section->el_bound; - if (section->parent) *parent_flag=1; - else *parent_flag=0; - return CG_OK; -} - -/* This function was created for revision 1.2 to return the size of the - connectivity vector, which can't be known without it when type=MIXED */ - -int cg_ElementDataSize(int file_number, int B, int Z, int S, int *ElementDataSize) { - - cgns_section *section; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - section = cgi_get_section(cg, B, Z, S); - if (section == 0) return CG_ERROR; - - *ElementDataSize = section->connect->dim_vals[0]; - return CG_OK; -} - -int cg_elements_read(int file_number, int B, int Z, int S, int *elements, - int *parent_data) { - - cgns_section *section; - int npe, num, n, ElementDataSize=0; - ElementType_t el_type; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - section = cgi_get_section(cg, B, Z, S); - if (section == 0) return CG_ERROR; - - /* cgns_internals takes care of adjusting for version */ - ElementDataSize = section->connect->dim_vals[0]; - - /* Double check ElementDataSize (not necessary) */ - num = section->range[1] - section->range[0] +1; - if (section->el_type != MIXED) { - if (cg_npe(section->el_type, &npe)) return CG_ERROR; - if (ElementDataSize != num*npe) { - cgi_error("Error in recorded element connectivity array..."); - return CG_ERROR; - } - } else { - int count=0; - for (n=0; nconnect->data+count); - if (cg_npe(el_type, &npe)) return CG_ERROR; - count += (npe+1); - } - if (ElementDataSize!=count) { - cgi_error("Error in recorded element connectivity array..."); - return CG_ERROR; - } - } - memcpy(elements, (int *)section->connect->data, ElementDataSize*sizeof(int)); - - if (section->parent) { - memcpy(parent_data, section->parent->data, num*4*sizeof(int)); - } - return CG_OK; -} - -/*****************************************************************************\ - * Inquiry Functions for FlowSolution_t Nodes -\*****************************************************************************/ -int cg_nsols(int file_number, int B, int Z, int *nsols) { - cgns_zone *zone; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return CG_ERROR; - - *nsols = zone->nsols; - return CG_OK; -} - -int cg_sol_info(int file_number, int B, int Z, int S, char *solname, - GridLocation_t *location) { - cgns_sol *sol; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - sol = cgi_get_sol(cg, B, Z, S); - if (sol==0) return CG_ERROR; - - strcpy(solname, sol->name); - *location = sol->location; - return CG_OK; -} - -int cg_sol_id(int file_number, int B, int Z, int S, double *sol_id) { - cgns_sol *sol; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - sol = cgi_get_sol(cg, B, Z, S); - if (sol==0) return CG_ERROR; - - *sol_id = sol->id; - return CG_OK; -} - -/*****************************************************************************\ - * Inquiry Functions for flow field DataArray_t Nodes -\*****************************************************************************/ -int cg_nfields(int file_number, int B, int Z, int S, int *nfields) { - cgns_sol *sol; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - sol = cgi_get_sol(cg, B, Z, S); - if (sol==0) return CG_ERROR; - - *nfields = sol->nfields; - return CG_OK; -} - -int cg_field_info(int file_number, int B, int Z, int S, int F, DataType_t *type, - char *fieldname) { - cgns_array *field; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - field = cgi_get_field(cg, B, Z, S, F); - if (field==0) return CG_ERROR; - - strcpy(fieldname, field->name); - *type = cgi_datatype(field->data_type); - - return CG_OK; -} - -int cg_field_read(int file_number, int B, int Z, int S, char *fieldname, DataType_t type, - int *rmin, int *rmax, void *field_ptr) { - cgns_sol *sol; - cgns_array *field; - int n, num=1, pos, i, j, k, f; - void *values; - int imin[3], imax[3]; - int ierr=0; - int read_full_range=1; - int index_dim; - -/* define: rmin[0]<=i<=rmax[0] where the max range is 1<=i<=imax - rmin[1]<=j<=rmax[1] 1<=j<=jmax - only 3D rmin[2]<=k<=rmax[2] 1<=k<=kmax -*/ - /* verify input */ - if (type<0 || type>=NofValidDataTypes) { - cgi_error("Invalid data type requested for flow solution: %d",type); - return CG_ERROR; - } - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - sol = cgi_get_sol(cg, B, Z, S); - if (sol==0) return CG_ERROR; - field = 0; - for (f=0; fnfields; f++) { - if (strcmp(sol->field[f].name, fieldname)==0) { - field = cgi_get_field(cg, B, Z, S, f+1); - if (field==0) return CG_ERROR; - break; - } - } - if (field==0) { - cgi_error("Flow solution array %s not found",fieldname); - return CG_NODE_NOT_FOUND; - } - - /* number of points in data array: */ - index_dim=cg->base[B-1].zone[Z-1].index_dim; - num =1; - for (n=0; ndim_vals[n]; - - /* verify that range requested does not exceed range stored */ - for (n=0; n field->dim_vals[n] || rmin[n]<1) { - cgi_error("Invalid range of data requested"); - return CG_ERROR; - } - } - - /* check if requested to return full range */ - for (n=0; ndim_vals[n]) { - read_full_range=0; - break; - } - } - - /* Read entire data array into 'values': */ - /* Decide not to use ADF_Read_Data due to the C/f77 ordering mismatch */ - if ((values=(void *)malloc(num*size_of(field->data_type)))==NULL) { - cgi_error("Error allocating values"); - return CG_ERROR; - } - ADF_Read_All_Data(field->id, (char *) values, &ierr); - if (ierr>0) { - adf_error("ADF_Read_All_Data",ierr); - return CG_ERROR; - } - /* quick transfer of data if same data types and if read whole array */ - if (read_full_range && type == cgi_datatype(field->data_type)) { - memcpy(field_ptr, values, num*size_of(field->data_type)); - - } else { - /* Bring to 3D even if 2D or 1D */ - for (n=0; ndata_type)==Integer) { - for (k=imin[2]-1; kdim_vals[0] + k*field->dim_vals[0]*field->dim_vals[1]; - *((int *) field_ptr+n) = *((int *) values+pos); - n++; - } - /* I4 - R4 */ - } else if (type==Integer && cgi_datatype(field->data_type)==RealSingle) { - for (k=imin[2]-1; kdim_vals[0] + k*field->dim_vals[0]*field->dim_vals[1]; - *((int *) field_ptr+n) = (int) (*((float *) values+pos)); - n++; - } - /* I4 - R8 */ - } else if (type==Integer && cgi_datatype(field->data_type)==RealDouble) { - for (k=imin[2]-1; kdim_vals[0] + k*field->dim_vals[0]*field->dim_vals[1]; - *((int *) field_ptr+n) = (int) (*((double *) values+pos)); - n++; - } - /* R4 - I4 */ - } else if (type==RealSingle && cgi_datatype(field->data_type)==Integer) { - for (k=imin[2]-1; kdim_vals[0] + k*field->dim_vals[0]*field->dim_vals[1]; - *((float *) field_ptr+n) = (float) (*((int *) values+pos)); - n++; - } - /* R4 - R4 */ - } else if (type==RealSingle && cgi_datatype(field->data_type)==RealSingle) { - for (k=imin[2]-1; kdim_vals[0] + k*field->dim_vals[0]*field->dim_vals[1]; - *((float *) field_ptr+n) = *((float *) values+pos); - n++; - } - /* R4 - R8 */ - } else if (type==RealSingle && cgi_datatype(field->data_type)==RealDouble) { - for (k=imin[2]-1; kdim_vals[0] + k*field->dim_vals[0]*field->dim_vals[1]; - *((float *) field_ptr+n) = (float)(*((double *) values+pos)); - n++; - } - /* R8 - I4 */ - } else if (type==RealDouble && cgi_datatype(field->data_type)==Integer) { - for (k=imin[2]-1; kdim_vals[0] + k*field->dim_vals[0]*field->dim_vals[1]; - *((double *) field_ptr+n) = (double)(*((int *) values+pos)); - n++; - } - /* R8 - R4 */ - } else if (type==RealDouble && cgi_datatype(field->data_type)==RealSingle) { - for (k=imin[2]-1; kdim_vals[0] + k*field->dim_vals[0]*field->dim_vals[1]; - *((double *) field_ptr+n) = (double)(*((float *) values+pos)); - n++; - } - /* R8 - R8 */ - } else if (type==RealDouble && cgi_datatype(field->data_type)==RealDouble) { - for (k=imin[2]-1; kdim_vals[0] + k*field->dim_vals[0]*field->dim_vals[1]; - *((double *) field_ptr+n) = *((double *) values+pos); - n++; - } - } - } - free(values); - - return CG_OK; -} - -int cg_field_id(int file_number, int B, int Z, int S, int F, double *field_id) { - cgns_array *field; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - field = cgi_get_field(cg, B, Z, S, F); - if (field==0) return CG_ERROR; - - *field_id = field->id; - return CG_OK; -} - -/*****************************************************************************\ - * Inquiry Functions for OversetHoles_t Nodes -\*****************************************************************************/ - -int cg_nholes(int file_number, int B, int Z, int *nholes) { - cgns_zconn *zconn; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - zconn = cgi_get_zconn(cg, B, Z); - if (zconn==0) *nholes = 0; /* if ZoneGridConnectivity_t is undefined */ - else *nholes = zconn->nholes; - return CG_OK; -} - -int cg_hole_info(int file_number, int B, int Z, int I, char *holename, - GridLocation_t *location, PointSetType_t *ptset_type, int *nptsets, - int *npnts) { - - cgns_hole *hole; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - hole = cgi_get_hole(cg, B, Z, I); - if (hole==0) return CG_ERROR; - - strcpy(holename, hole->name); - *location = hole->location; - *ptset_type = hole->ptset[0].type; - *nptsets = hole->nptsets; - /* if multiple pointsets are defined, only PointRange is allowed */ - if (hole->nptsets==1) *npnts = hole->ptset[0].npts; - else *npnts = 2*hole->nptsets; - return CG_OK; -} - -int cg_hole_read(int file_number, int B, int Z, int I, int *pnts) { - cgns_hole *hole; - int ierr, set; - int index_dim; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - hole = cgi_get_hole(cg, B, Z, I); - if (hole==0) return CG_ERROR; - - index_dim = cg->base[B-1].zone[Z-1].index_dim; - - /* read point-set directly from ADF file */ - for (set=0; setnptsets; set++) { - if (hole->ptset[set].npts>0) { - ADF_Read_All_Data(hole->ptset[set].id, - (char *)((int *)pnts+2*index_dim*set), &ierr); - if (ierr>0) { - adf_error("ADF_Read_All_Data",ierr); - return CG_ERROR; - } - } else { - cgi_warning("Overset hole #%d set %d, of zone #%d, base #%d, contains no points", - I, set, Z, B); - } - } - - return CG_OK; -} - -int cg_hole_id(int file_number, int B, int Z, int I, double *hole_id) { - cgns_hole *hole; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - hole = cgi_get_hole(cg, B, Z, I); - if (hole==0) return CG_ERROR; - - *hole_id = hole->id; - return CG_OK; -} - -/*****************************************************************************\ - * Inquiry Functions for GridConnectivity_t Nodes -\*****************************************************************************/ - -int cg_nconns(int file_number, int B, int Z, int *nconns) { - cgns_zconn *zconn; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - zconn = cgi_get_zconn(cg, B, Z); - if (zconn==0) *nconns = 0; /* if ZoneGridConnectivity_t is undefined */ - else *nconns = zconn->nconns; - return CG_OK; -} - -/* in cg_conn_info, donor_datatype is useless starting with version 1.27, because - it's always I4. Howver this arg. is left for backward compatibility of API - and to be able to read old files */ -int cg_conn_info(int file_number, int B, int Z, int I, char *connectname, - GridLocation_t *location, GridConnectivityType_t *type, - PointSetType_t *ptset_type, int *npnts, char *donorname, - ZoneType_t *donor_zonetype, PointSetType_t *donor_ptset_type, - DataType_t *donor_datatype, int *ndata_donor) { - - int dZ; - cgns_conn *conn; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - conn = cgi_get_conn(cg, B, Z, I); - if (conn==0) return CG_ERROR; - - strcpy(connectname, conn->name); - *type = conn->type; - *location = conn->location; - *ptset_type = conn->ptset.type; - *npnts = conn->ptset.npts; - - /* information relative to donor */ - strcpy(donorname, conn->donor); - *donor_datatype = cgi_datatype(conn->dptset.data_type); - *ndata_donor = conn->dptset.npts; - *donor_ptset_type = conn->dptset.type; - - /* Find ZoneType_t of DonorZone given its name */ - *donor_zonetype = ZoneTypeNull; - - for (dZ=0; dZbase[B-1].nzones; dZ++) { - if (strcmp(cg->base[B-1].zone[dZ].name,donorname)==0) { - *donor_zonetype = cg->base[B-1].zone[dZ].type; - break; - } - } - if (*donor_zonetype == 0) { - cgi_error("cg_conn_info:donor zone %s does not exist",donorname); - return CG_ERROR; - } - return CG_OK; -} - -/* in cg_conn_read, donor_datatype is useless starting with version 1.27, because - it's always I4. However this arg. is left for backward compatibility of API - and to be able to read old files */ -int cg_conn_read(int file_number, int B, int Z, int I, int *pnts, - DataType_t donor_datatype, void *donor_data) { - char_33 data_type; - cgns_conn *conn; - void *dpnts; - int n, ierr, size, cell_dim; - - /* verify input */ - if (donor_datatype!=Integer && donor_datatype!=RealSingle && - donor_datatype!=RealDouble) { - cgi_error("Invalid datatype requested for a point set: %d", donor_datatype); - return CG_ERROR; - } - - /* Find address */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - conn = cgi_get_conn(cg, B, Z, I); - if (conn==0) return CG_ERROR; - - cell_dim = cg->base[B-1].cell_dim; - - /* read point-set of current zone from ADF file - always I4 integer */ - if (conn->ptset.npts>0) { - ADF_Read_All_Data(conn->ptset.id, (char *)pnts, &ierr); - if (ierr>0) { - adf_error("ADF_Read_All_Data",ierr); - return CG_ERROR; - } - } else { - cgi_warning("Interface receiver patch #%d of zone #%d, base #%d, contains no points", - I, Z, B); - } - - /* read donor points from ADF file - data_type may be I4, R4 or R8 */ - if (conn->dptset.npts>0) { - cgns_ptset dptset = conn->dptset; - int index_dim = 0; - for (n=0; nbase[B-1].nzones; n++) { - if (strcmp(cg->base[B-1].zone[n].name,conn->donor)==0) { - index_dim = cg->base[B-1].zone[n].type == Structured ? cell_dim : 1; - break; - } - } - if (index_dim == 0) { - cgi_error("cg_conn_read:donor zone %s does not exist",conn->donor); - return CG_ERROR; - } - size = index_dim*dptset.npts; - if ((dpnts=(void *)malloc(size*size_of(dptset.data_type)))==NULL) { - cgi_error("Error allocating dpnts..."); - return CG_ERROR; - } - ADF_Read_All_Data(dptset.id, (char *) dpnts, &ierr); - if (ierr>0) { - adf_error("ADF_Read_All_Data",ierr); - return CG_ERROR; - } - strcpy(data_type, dptset.data_type); - } else { - cgi_warning("Interface donor patch #%d of zone #%d, base #%d, contains no points", - I, Z, B); - return CG_OK; - } - - /* Return value in precision requested */ - if (donor_datatype==Integer && cgi_datatype(data_type)==Integer) { - for (n=0; nfilename, cg->mode, MODE_READ)) return CG_ERROR; - - conn = cgi_get_conn(cg, B, Z, I); - if (conn==0) return CG_ERROR; - - *conn_id = conn->id; - return CG_OK; -} - -/*****************************************************************************\ - * Inquiry Functions for GridConnectivity1to1_t Nodes -\*****************************************************************************/ - -int cg_n1to1(int file_number, int B, int Z, int *n1to1) { - cgns_zconn *zconn; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - zconn = cgi_get_zconn(cg, B, Z); - if (zconn==0) *n1to1 = 0; /* if ZoneGridConnectivity_t is undefined */ - else *n1to1 = zconn->n1to1; - return CG_OK; -} - -int cg_n1to1_global(int file_number, int B, int *n1to1_global) { - cgns_base *base; - cgns_zone *zone; - cgns_zconn *zconn; - int Z, I, D; - int_3 transform; - int_6 donor_range, range; - char_33 connectname, donorname; - /* added for zones interfacing themselves (C-topology) */ - int ndouble=0; - char_33 *Dzonename = 0; - int_6 *Drange = 0, *Ddonor_range = 0; - int index_dim; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - base = cgi_get_base(cg, B); - if (base==0) return CG_ERROR; - - *n1to1_global = 0; - for (Z=1; Z<=base->nzones; Z++) { - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return CG_ERROR; - index_dim = zone->index_dim; - zconn = cgi_get_zconn(cg, B, Z); - if (zconn==0) continue; /* if ZoneGridConnectivity_t is undefined */ - if (zconn->n1to1 ==0) continue; - for (I=1; I<=zconn->n1to1; I++) { - if (cg_1to1_read(file_number, B, Z, I, connectname, donorname, - range, donor_range, transform)) return CG_ERROR; - if (cgi_zone_no(base, donorname, &D)) return CG_ERROR; - - /* count each interface only once */ - if (Zname, range, donor_range, index_dim, - &ndouble, &Dzonename, &Drange, &Ddonor_range)) { - (*n1to1_global)++; - } - } - } /* loop through interfaces of a zone */ - } /* loop through zones */ - if (Dzonename) free(Dzonename); - if (Drange) free(Drange); - if (Ddonor_range) free(Ddonor_range); - - return CG_OK; -} - - -int cg_1to1_read(int file_number, int B, int Z, int I, char *connectname, - char *donorname, int *range, int *donor_range, int *transform) { - cgns_1to1 *one21; - int i, ierr, index_dim; - -/* in 2D, range[0], range[1] = imin, jmin - range[2], range[3] = imax, jmax - in 3D, range[0], range[1], range[2] = imin, jmin, kmin - range[3], range[4], range[5] = imax, jmax, kmax - */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - one21 = cgi_get_1to1(cg, B, Z, I); - if (one21==0) return CG_ERROR; - - /* read pointset from ADF file */ - if (one21->ptset.npts > 0) { - ADF_Read_All_Data(one21->ptset.id, (char *) range, &ierr); - if (ierr>0) { - adf_error("ADF_Read_All_Data",ierr); - return CG_ERROR; - } - } else { - cgi_warning("1to1 interface %d (receiver side) for zone %d base % is undefined", - I,Z,B); - } - - /* read donor pointset from ADF file */ - if (one21->dptset.npts > 0) { - ADF_Read_All_Data(one21->dptset.id, (char *) donor_range, &ierr); - if (ierr>0) { - adf_error("ADF_Read_All_Data",ierr); - return CG_ERROR; - } - } else { - cgi_warning("1to1 interface %d (donor side) for zone %d base % is undefined", - I,Z,B); - } - - /* read transform from internal database */ - index_dim = cg->base[B-1].zone[Z-1].index_dim; - for (i=0; itransform[i]; - - strcpy(connectname, one21->name); - strcpy(donorname, one21->donor); - return CG_OK; -} - -int cg_1to1_read_global(int file_number, int B, char **connectname, char **zonename, - char **donorname, int **range, int **donor_range, int **transform){ - - cgns_base *base; - cgns_zone *zone; - cgns_zconn *zconn; - int Z, I, D, n=0, j, index_dim; - char connect[33], donor[33]; - int rang[6], drang[6], trans[6]; - /* added for zones interfacing themselves (C-topology) */ - int ndouble=0; - char_33 *Dzonename = 0; - int_6 *Drange = 0, *Ddonor_range = 0; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - base = cgi_get_base(cg, B); - if (base==0) return CG_ERROR; - - for (Z=1; Z<=base->nzones; Z++) { - zone = cgi_get_zone(cg, B, Z); - if (zone->type==Unstructured) { - cgi_error("GridConnectivity1to1 is only applicable to structured zones."); - return CG_ERROR; - } - index_dim = zone->index_dim; - zconn = cgi_get_zconn(cg, B, Z); - if (zconn==0) continue; /* if ZoneGridConnectivity_t is undefined */ - if (zconn->n1to1 ==0) continue; - for (I=1; I<=zconn->n1to1; I++) { - if (cg_1to1_read(file_number, B, Z, I, connect, donor, rang, - drang, trans)) return CG_ERROR; - if (cgi_zone_no(base, donor, &D)) return CG_ERROR; - /* count each interface only once */ - if (Zname, rang, drang, index_dim, - &ndouble, &Dzonename, &Drange, &Ddonor_range))) { - strcpy(connectname[n], connect); - strcpy(zonename[n],zone->name); - strcpy(donorname[n], donor); - for (j=0; jfilename, cg->mode, MODE_READ)) return CG_ERROR; - - one21 = cgi_get_1to1(cg, B, Z, I); - if (one21==0) return CG_ERROR; - - *one21_id = one21->id; - return CG_OK; -} - -/*****************************************************************************\ - * Inquiry Functions for BC_t Nodes -\*****************************************************************************/ - -int cg_nbocos(int file_number, int B, int Z, int *nbocos) { - cgns_zboco *zboco; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - zboco = cgi_get_zboco(cg, B, Z); - if (zboco==0) *nbocos = 0; /* if ZoneBC_t is undefined */ - else *nbocos = zboco->nbocos; - return CG_OK; -} - -int cg_boco_info(int file_number, int B, int Z, int BC, char *boconame, - BCType_t *bocotype, PointSetType_t *ptset_type, int *npnts, - int *NormalIndex, int *NormalListFlag, DataType_t *NormalDataType, - int *ndataset) { - - cgns_boco *boco; - int n, index_dim; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - boco = cgi_get_boco(cg, B, Z, BC); - if (boco==0) return CG_ERROR; - - strcpy(boconame,boco->name); - *bocotype = boco->type; - *ptset_type = boco->ptset->type; - *npnts = boco->ptset->npts; - - index_dim = cg->base[B-1].zone[Z-1].index_dim; - if (boco->Nindex) { - for (n=0; nNindex[n]; - } else for (n=0; nnormal) { - *NormalListFlag=boco->ptset->size_of_patch*cg->base[B-1].phys_dim; - *NormalDataType = cgi_datatype(boco->normal->data_type); - } else { - *NormalListFlag=0; - *NormalDataType=DataTypeNull; - } - *ndataset = boco->ndataset; - - return CG_OK; -} - -int cg_boco_read(int file_number, int B, int Z, int BC, int *pnts, void *NormalList) { - cgns_boco *boco; - int ierr, phys_dim; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - boco = cgi_get_boco(cg, B, Z, BC); - if (boco==0) return CG_ERROR; - - /* Read point-set directly from ADF-file */ - if (boco->ptset->npts>0) { - ADF_Read_All_Data(boco->ptset->id, (char *) pnts, &ierr); - if (ierr>0) { - adf_error("ADF_Read_All_Data",ierr); - return CG_ERROR; - } - } else { - cgi_warning("B.C. patch %d of zone %d base %d is undefined", - BC, Z, B); - } - - /* if it exists, read NormalList */ - phys_dim=cg->base[B-1].phys_dim; - if (NormalList && boco->normal && boco->ptset->npts>0) { - memcpy(NormalList, boco->normal->data, - boco->ptset->size_of_patch*phys_dim*size_of(boco->normal->data_type)); - } - - return CG_OK; -} - -int cg_boco_id(int file_number, int B, int Z, int BC, double *boco_id) { - cgns_boco *boco; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - boco = cgi_get_boco(cg, B, Z, BC); - if (boco==0) return CG_ERROR; - - *boco_id = boco->id; - return CG_OK; -} - -/*****************************************************************************\ - * Inquiry Functions for BCDataSet_t Nodes -\*****************************************************************************/ - -int cg_dataset_read(int file_number, int B, int Z, int BC, int DSet, char *name, - BCType_t *BCType, int *DirichletFlag, int *NeumannFlag) { - - cgns_dataset *dataset; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - dataset = cgi_get_dataset(cg, B, Z, BC, DSet); - if (dataset==0) return CG_ERROR; - - strcpy(name, dataset->name); - *BCType = dataset->type; - if (dataset->dirichlet) *DirichletFlag=1; - else *DirichletFlag=0; - if (dataset->neumann) *NeumannFlag=1; - else *NeumannFlag=0; - - return CG_OK; -} - -/*****************************************************************************\ - * Inquiry Functions for RigidGridMotion_t Nodes -\*****************************************************************************/ - -int cg_n_rigid_motions(int file_number, int B, int Z, int *n_rigid_motions) { - cgns_zone *zone; - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return CG_ERROR; - - *n_rigid_motions = zone->nrmotions; - - return CG_OK; -} - -int cg_rigid_motion_read(int file_number, int B, int Z, int R, char *name, - RigidGridMotionType_t *type) { - - cgns_rmotion *rmotion; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - rmotion = cgi_get_rmotion(cg, B, Z, R); - if (rmotion==0) return CG_ERROR; - - strcpy(name, rmotion->name); - *type = rmotion->type; - - return CG_OK; -} - -/*****************************************************************************\ - * Inquiry Functions for ArbitraryGridMotion_t Nodes -\*****************************************************************************/ - -int cg_n_arbitrary_motions(int file_number, int B, int Z, int *n_arbitrary_motions) { - cgns_zone *zone; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return CG_ERROR; - - *n_arbitrary_motions = zone->namotions; - - return CG_OK; -} - -int cg_arbitrary_motion_read(int file_number, int B, int Z, int A, char *name, - ArbitraryGridMotionType_t *type) { - - cgns_amotion *amotion; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - amotion = cgi_get_amotion(cg, B, Z, A); - if (amotion==0) return CG_ERROR; - - strcpy(name, amotion->name); - *type = amotion->type; - - return CG_OK; -} - -/*****************************************************************************\ - * Inquiry Functions for SimulationType_t Node -\*****************************************************************************/ - -int cg_simulation_type_read(int file_number, int B, SimulationType_t *type) { - cgns_base *base; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - base = cgi_get_base(cg, B); - if (base==0) return CG_ERROR; - - *type = base->type; - - return CG_OK; -} - -/*****************************************************************************\ - * Inquiry Functions for BaseIterativeData_t Node -\*****************************************************************************/ - -int cg_biter_read(int file_number, int B, char *bitername, int *nsteps) { - cgns_biter *biter; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - biter = cgi_get_biter(cg, B); - if (biter==0) return CG_NODE_NOT_FOUND; - - *nsteps = biter->nsteps; - strcpy(bitername,biter->name); - - return CG_OK; -} - -/*****************************************************************************\ - * Inquiry Functions for ZoneIterativeData_t Node -\*****************************************************************************/ - -int cg_ziter_read(int file_number, int B, int Z, char *zitername) { - cgns_ziter *ziter; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - ziter = cgi_get_ziter(cg, B, Z); - if (ziter==0) return CG_NODE_NOT_FOUND; - - strcpy(zitername, ziter->name); - - return CG_OK; -} - -/*****************************************************************************\ - * Inquiry Function for Gravity_t Node -\*****************************************************************************/ - -int cg_gravity_read(int file_number, int B, float *gravity_vector) { - cgns_base *base; - cgns_gravity *gravity; - - /* get memory address for file */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - /* get memory address for base */ - base = cgi_get_base(cg, B); - if (base==0) return CG_ERROR; - - /* get memory address for gravity */ - gravity = cgi_get_gravity(cg, B); - if (gravity==0) return CG_NODE_NOT_FOUND; - - memcpy(gravity_vector, gravity->vector->data, base->phys_dim*sizeof(float)); - return CG_OK; -} - -/*****************************************************************************\ - * Inquiry Function for Axisymmetry_t Node -\*****************************************************************************/ - -int cg_axisym_read(int file_number, int B, float *ref_point, float *axis) { - int n; - cgns_base *base; - cgns_axisym *axisym; - - /* get memory address for file */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - /* get memory address for base (for base->phys_dim) */ - base = cgi_get_base(cg, B); - if (base==0) return CG_ERROR; - - /* get memory address for axisym */ - axisym = cgi_get_axisym(cg, B); - if (axisym==0) return CG_NODE_NOT_FOUND; - - for (n=0; nnarrays; n++) { - if (strcmp(axisym->array[n].name,"AxisymmetryReferencePoint")==0) - memcpy(ref_point, axisym->array[n].data, base->phys_dim*sizeof(float)); - else if (strcmp(axisym->array[n].name,"AxisymmetryAxisVector")==0) - memcpy(axis, axisym->array[n].data, base->phys_dim*sizeof(float)); - } - return CG_OK; -} - -/*****************************************************************************\ - * Inquiry Function for BCProperty_t Node -\*****************************************************************************/ - -int cg_bc_wallfunction_read(int file_number, int B, int Z, int BC, - WallFunctionType_t *WallFunctionType) { - cgns_bprop *bprop; - - /* get memory address for file */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - /* get memory address for bprop */ - bprop = cgi_get_bprop(cg, B, Z, BC); - if (bprop==0) return CG_NODE_NOT_FOUND; - - if (bprop->bcwall==0) { - cgi_error("BCProperty_t/WallFunction_t node doesn't exist under BC_t %d",BC); - return CG_NODE_NOT_FOUND; - } - *WallFunctionType = bprop->bcwall->type; - - return CG_OK; -} - -int cg_bc_area_read(int file_number, int B, int Z, int BC, - AreaType_t *AreaType, float *SurfaceArea, char *RegionName) { - int n; - cgns_bprop *bprop; - - /* get memory address for file */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - /* get memory address for bprop */ - bprop = cgi_get_bprop(cg, B, Z, BC); - if (bprop==0) return CG_NODE_NOT_FOUND; - - if (bprop->bcarea==0) { - cgi_error("BCProperty_t/Area_t node doesn't exist under BC_t %d",BC); - return CG_NODE_NOT_FOUND; - } - *AreaType = bprop->bcarea->type; - for (n=0; nbcarea->narrays; n++) { - if (strcmp("SurfaceArea",bprop->bcarea->array[n].name)==0) - memcpy(SurfaceArea, bprop->bcarea->array[n].data, sizeof(float)); - else if (strcmp("RegionName",bprop->bcarea->array[n].name)==0) { - memcpy(RegionName, bprop->bcarea->array[n].data, 32*sizeof(char)); - RegionName[32]='\0'; - } - } - - return CG_OK; -} - -/*****************************************************************************\ - * Inquiry Function for GridConnectivityProperty_t Node -\*****************************************************************************/ - -int cg_conn_periodic_read(int file_number, int B, int Z, int I, - float *RotationCenter, float *RotationAngle, float *Translation) { - - int n; - cgns_base *base; - cgns_cprop *cprop; - cgns_cperio *cperio; - - /* get memory address for file */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - /* get memory address for base (for base->phys_dim) */ - base = cgi_get_base(cg, B); - if (base==0) return CG_ERROR; - - /* get memory address for cprop */ - cprop = cgi_get_cprop(cg, B, Z, I); - if (cprop==0) return CG_NODE_NOT_FOUND; - - if (cprop->cperio == 0) { - cgi_error("GridConnectivityProperty_t/Periodic_t node doesn't exist under GridConnectivity_t %d",I); - return CG_NODE_NOT_FOUND; - } - cperio = cprop->cperio; - - /* Copy data to be returned */ - for (n=0; nnarrays; n++) { - if (strcmp(cperio->array[n].name,"RotationCenter")==0) - memcpy(RotationCenter, cperio->array[n].data, base->phys_dim*sizeof(float)); - else if (strcmp(cperio->array[n].name,"RotationAngle")==0) - memcpy(RotationAngle, cperio->array[n].data, base->phys_dim*sizeof(float)); - else if (strcmp(cperio->array[n].name,"Translation")==0) - memcpy(Translation, cperio->array[n].data, base->phys_dim*sizeof(float)); - } - - return CG_OK; -} - -int cg_conn_average_read(int file_number, int B, int Z, int I, - AverageInterfaceType_t *AverageInterfaceType) { - - cgns_cprop *cprop; - - /* get memory address for file */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - /* get memory address for cprop */ - cprop = cgi_get_cprop(cg, B, Z, I); - if (cprop==0) return CG_NODE_NOT_FOUND; - - if (cprop->caverage == 0) { - cgi_error("GridConnectivityProperty_t/AverageInterface_t node doesn't exist under GridConnectivity_t %d",I); - return CG_NODE_NOT_FOUND; - } - *AverageInterfaceType = cprop->caverage->type; - - return CG_OK; -} - -/*****************************************************************************\ - * Go - To Function -\*****************************************************************************/ - -int cg_goto(int file_number, int B, ...) { - int n=0; - va_list ap; - int *index; - char *label[20]; - int ier; - - /* initialize */ - posit_zone=0; - - /* set global variable cg */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - va_start(ap, B); - index = CGNS_NEW(int, 20); - - /* read variable argument list */ - for (n=0; n<20; n++) { - label[n] = va_arg(ap,char *); - if (label[n] == NULL || label[n][0] == 0) break; - if (strcmp("end",label[n])==0 || strcmp("END",label[n])==0) break; - index[n] = va_arg(ap, int); - if (strcmp(label[n],"Zone_t")==0) posit_zone= index[n]; - } - va_end(ap); - - posit_base = B; - posit = cgi_get_posit(file_number, B, n, index, label, &ier); - - if (n==0) strcpy(posit_label,"CGNSBase_t"); - else strcpy(posit_label,label[n-1]); - - free(index); - - return ier; -} - -/*****************************************************************************\ - * Read Multiple path nodes -\*****************************************************************************/ - -int cg_famname_read(char *family_name) { - char *famname; - int ier=0; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - famname = cgi_famname_address(MODE_READ, &ier); - if (famname==0) return ier; - - strcpy(family_name,famname); - if (!strlen(famname)) return CG_NODE_NOT_FOUND; - return CG_OK; -} - -int cg_convergence_read(int *iterations, char **NormDefinitions) { - cgns_converg *converg; - cgns_descr *descr; - int ier=0; - - /* verify input (cg set in cg_goto) */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - converg = cgi_converg_address(MODE_READ, &ier); - if (converg==0) return ier; - - (*iterations) = converg->iterations; - if (converg->NormDefinitions==0) { - NormDefinitions[0] = CGNS_NEW(char, 1); - NormDefinitions[0][0]='\0'; - } else { - descr = converg->NormDefinitions; - NormDefinitions[0] = CGNS_NEW(char, strlen(descr->text)+1); - strcpy(NormDefinitions[0], descr->text); - } - return CG_OK; -} - -int cg_state_read(char **StateDescription) { - cgns_state *state; - cgns_descr *descr; - int ier=0; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - state = cgi_state_address(MODE_READ, &ier); - if (state==0) return ier; - - if (state->StateDescription == 0) { - StateDescription[0]=CGNS_NEW(char, 1); - StateDescription[0][0]='\0'; - } else { - descr = state->StateDescription; - StateDescription[0]=CGNS_NEW(char, strlen(descr->text)+1); - strcpy(StateDescription[0], descr->text); - } - return CG_OK; -} - -int cg_equationset_read(int *EquationDimension, - int *GoverningEquationsFlag, int *GasModelFlag, - int *ViscosityModelFlag, int *ThermalConductivityModelFlag, - int *TurbulenceClosureFlag, int *TurbulenceModelFlag) { - cgns_equations *eq; - int ier=0; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - eq = cgi_equations_address(MODE_READ, &ier); - if (eq==0) return ier; - - (*EquationDimension) = eq->equation_dim; - if (eq->governing) (*GoverningEquationsFlag)=1; - else (*GoverningEquationsFlag)=0; - - if (eq->gas) (*GasModelFlag)=1; - else (*GasModelFlag)=0; - - if (eq->visc) (*ViscosityModelFlag)=1; - else (*ViscosityModelFlag)=0; - - if (eq->conduct) (*ThermalConductivityModelFlag)=1; - else (*ThermalConductivityModelFlag)=0; - - if (eq->closure) (*TurbulenceClosureFlag)=1; - else (*TurbulenceClosureFlag)=0; - - if (eq->turbulence) (*TurbulenceModelFlag)=1; - else (*TurbulenceModelFlag)=0; - - /* Version 2.1 chemistry extensions get their own read routine - ** for backward compatability. - */ - return CG_OK; -} - -int cg_equationset_chemistry_read(int *ThermalRelaxationFlag, - int *ChemicalKineticsFlag) { - cgns_equations *eq; - int ier=0; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - eq = cgi_equations_address(MODE_READ, &ier); - if (eq==0) return ier; - - if (eq->relaxation) (*ThermalRelaxationFlag)=1; - else (*ThermalRelaxationFlag)=0; - - if (eq->chemkin) (*ChemicalKineticsFlag)=1; - else (*ChemicalKineticsFlag)=0; - - return CG_OK; -} - -int cg_governing_read(GoverningEquationsType_t *EquationsType) { - cgns_governing *governing; - int ier=0; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - governing = cgi_governing_address(MODE_READ, &ier); - if (governing==0) return ier; - - (*EquationsType) = governing->type; - return CG_OK; -} - -int cg_diffusion_read(int *diffusion_model) { - int n, ndata, ier=0; - int *diffusion, index_dim; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - diffusion = cgi_diffusion_address(MODE_READ, &ier); - if (diffusion==0) return ier; - - if (posit_base && posit_zone) { - index_dim = cg->base[posit_base-1].zone[posit_zone-1].index_dim; - - /* If defined under CGNSBase_t node */ - } else if (posit_base) { - index_dim = cg->base[posit_base-1].cell_dim; - - } else { - cgi_error("Can't find IndexDimension in cg_diffusion_read."); - return CG_NO_INDEX_DIM; - } - if (index_dim==1) ndata=1; - else if (index_dim==2) ndata=3; - else if (index_dim==3) ndata=6; - else { - cgi_error("invalid value for IndexDimension"); - return CG_ERROR; - } - - for (n=0; nfilename, cg->mode, MODE_READ)) return CG_ERROR; - - model = cgi_model_address(MODE_READ, ModelLabel, &ier); - if (model==0) return ier; - - (*ModelType) = model->type; - - return CG_OK; -} - -int cg_narrays(int *narrays) { - -/* Possible parents: - * GridCoordinates_t, FlowSolution_t, DiscreteData_t, BC_t, - * BCData_t, GasModel_t, ViscosityModel_t, ThermalConductivityModel_t, TurbulenceClosure_t, - * TurbulenceModel_t, ThermalRelaxationModel_t, ChemicalKineticsModel_t, - * ConvergenceHistory_t, IntegralData_t, ReferenceState_t, - * RigidGridMotion_t, ArbitraryGridMotion_t, BaseIterativeData_t, ZoneIterativeData_t - * GridConnectivity_t, UserDefinedData_t, Gravity_t, Axisymmetry_t, RotatingCoordinates_t, - * Area_t, Periodic_t - */ - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - /* check for valid posit */ - if (posit == 0) { - cgi_error("No current position set by cg_goto\n"); - (*narrays) = 0; - return CG_ERROR; - } - if (strcmp(posit_label,"GridCoordinates_t")==0) { - cgns_zcoor *zcoor= (cgns_zcoor *)posit; - (*narrays) = zcoor->ncoords; - - } else if (strcmp(posit_label,"FlowSolution_t")==0) { - cgns_sol *sol = (cgns_sol *)posit; - (*narrays) = sol->nfields; - - } else if (strcmp(posit_label,"DiscreteData_t")==0) { - cgns_discrete *discrete = (cgns_discrete *)posit; - (*narrays) = discrete->narrays; - - } else if (strcmp(posit_label,"GridConnectivity_t")==0) { - cgns_conn *conn = (cgns_conn *)posit; - (*narrays) = conn->narrays; - - } else if (strcmp(posit_label,"BC_t")==0) { - /*cgns_boco *boco = (cgns_boco *)posit;*/ - (*narrays) = 1; /* Always supports exactly 1. */ - - } else if (strcmp(posit_label,"BCData_t")==0) { - cgns_bcdata *bcdata = (cgns_bcdata *)posit; - (*narrays) = bcdata->narrays; - - } else if (strcmp(posit_label,"GasModel_t")==0 || - strcmp(posit_label,"ViscosityModel_t")==0 || - strcmp(posit_label,"ThermalConductivityModel_t")==0 || - strcmp(posit_label,"TurbulenceModel_t")==0 || - strcmp(posit_label,"TurbulenceClosure_t")==0 || - strcmp(posit_label,"ThermalRelaxationModel_t")==0 || - strcmp(posit_label,"ChemicalKineticsModel_t")==0) { - cgns_model *model = (cgns_model *)posit; - (*narrays) = model->narrays; - - } else if (strcmp(posit_label,"ConvergenceHistory_t")==0) { - cgns_converg *converg = (cgns_converg *)posit; - (*narrays) = converg->narrays; - - } else if (strcmp(posit_label,"IntegralData_t")==0) { - cgns_integral *integral = (cgns_integral *)posit; - (*narrays) = integral->narrays; - - } else if (strcmp(posit_label,"ReferenceState_t")==0) { - cgns_state *state = (cgns_state *)posit; - (*narrays) = state->narrays; - - } else if (strcmp(posit_label,"RigidGridMotion_t")==0) { - cgns_rmotion *rmotion = (cgns_rmotion *)posit; - (*narrays) = rmotion->narrays; - - } else if (strcmp(posit_label,"ArbitraryGridMotion_t")==0) { - cgns_amotion *amotion = (cgns_amotion *)posit; - (*narrays) = amotion->narrays; - - } else if (strcmp(posit_label,"BaseIterativeData_t")==0) { - cgns_biter *biter = (cgns_biter *)posit; - (*narrays) = biter->narrays; - - } else if (strcmp(posit_label,"ZoneIterativeData_t")==0) { - cgns_ziter *ziter = (cgns_ziter *)posit; - (*narrays) = ziter->narrays; - - } else if (strcmp(posit_label,"UserDefinedData_t")==0) { - cgns_user_data *user_data = (cgns_user_data *)posit; - (*narrays) = user_data->narrays; - - } else if (strcmp(posit_label,"Gravity_t")==0) { - cgns_gravity *gravity = (cgns_gravity *)posit; - (*narrays) = gravity->narrays; - - } else if (strcmp(posit_label,"Axisymmetry_t")==0) { - cgns_axisym *axisym = (cgns_axisym *)posit; - (*narrays) = axisym->narrays; - - } else if (strcmp(posit_label,"RotatingCoordinates_t")==0) { - cgns_rotating *rotating = (cgns_rotating *)posit; - (*narrays) = rotating->narrays; - - } else if (strcmp(posit_label,"Area_t")==0) { - cgns_bcarea *bcarea = (cgns_bcarea *)posit; - (*narrays) = bcarea->narrays; - - } else if (strcmp(posit_label,"Periodic_t")==0) { - cgns_cperio *cperio = (cgns_cperio *)posit; - (*narrays) = cperio->narrays; - - } else { - cgi_error("User defined DataArray_t node not supported under '%s' type node",posit_label); - (*narrays) = 0; - return CG_INCORRECT_PATH; - } - return CG_OK; -} - -int cg_array_info(int A, char *ArrayName, DataType_t *DataType, - int *DataDimension, int *DimensionVector) { - - cgns_array *array; - int n, ier=0; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - array = cgi_array_address(MODE_READ, A, "dummy", &ier); - if (array==0) return ier; - - strcpy(ArrayName, array->name); - (*DataType) = cgi_datatype(array->data_type); - (*DataDimension) = array->data_dim; - for (n=0; ndata_dim; n++) DimensionVector[n] = array->dim_vals[n]; - - return CG_OK; -} - -int cg_array_read(int A, void *Data) { - cgns_array *array; - int n, num =1, ier=0, ierr=0; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - array = cgi_array_address(MODE_READ, A, "dummy", &ier); - if (array==0) return ier; - - for (n=0; ndata_dim; n++) num *= array->dim_vals[n]; - - if (array->data) - memcpy(Data, array->data, num*size_of(array->data_type)); - else { - ADF_Read_All_Data(array->id, (char *) Data, &ierr); - if (ierr>0) { - adf_error("ADF_Read_All_Data",ierr); - return CG_ERROR; - } - } - - return CG_OK; -} - -int cg_array_read_as(int A, DataType_t type, void *Data) { - cgns_array *array; - int n, num =1, ier=0, ierr=0; - void *array_data; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - array = cgi_array_address(MODE_READ, A, "dummy", &ier); - if (array==0) return ier; - - for (n=0; ndata_dim; n++) num *= array->dim_vals[n]; - - /* Special for Character arrays */ - if ((type==Character && cgi_datatype(array->data_type)!=Character) || - (type!=Character && cgi_datatype(array->data_type)==Character)) { - cgi_error("Error exit: Character array can only be read as character"); - return CG_ERROR; - } - if (type==Character) { - if (array->data) - memcpy(Data, array->data, num*size_of(array->data_type)); - else { - ADF_Read_All_Data(array->id, (char *) Data, &ierr); - if (ierr>0) { - adf_error("ADF_Read_All_Data",ierr); - return CG_ERROR; - } - } - return CG_OK; - } - - /* All numerical data types: */ - if (array->data) - array_data = array->data; - else { - array_data = (void *)malloc(num*size_of(array->data_type)); - if (array_data == NULL) { - cgi_error("Error allocating array_data"); - return CG_ERROR; - } - ADF_Read_All_Data(array->id, (char *) array_data, &ierr); - if (ierr>0) { - adf_error("ADF_Read_All_Data",ierr); - return CG_ERROR; - } - } - - /* Write "Data" using the data-type requested */ - /* I4 - I4 */ - if (type==Integer && cgi_datatype(array->data_type)==Integer) { - for (n=0; ndata_type)==RealSingle) { - for (n=0; ndata_type)==RealDouble) { - for (n=0; ndata_type)==Integer) { - for (n=0; ndata_type)==RealSingle) { - for (n=0; ndata_type)==RealDouble) { - for (n=0; ndata_type)==Integer) { - for (n=0; ndata_type)==RealSingle) { - for (n=0; ndata_type)==RealDouble) { - for (n=0; ndata) free(array_data); - - return CG_OK; -} - -int cg_nintegrals(int *nintegrals) { - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - /* check for valid posit */ - if (posit == 0) { - cgi_error("No current position set by cg_goto\n"); - (*nintegrals) = 0; - return CG_ERROR; - } - - if (strcmp(posit_label,"CGNSBase_t")==0) { - cgns_base *base= (cgns_base *)posit; - (*nintegrals) = base->nintegrals; - - } else if (strcmp(posit_label,"Zone_t")==0) { - cgns_zone *zone = (cgns_zone *)posit; - (*nintegrals) = zone->nintegrals; - } else { - cgi_error("IntegralData_t node not supported under '%s' type node",posit_label); - (*nintegrals) = 0; - return CG_INCORRECT_PATH; - } - return CG_OK; -} - -int cg_integral_read(int IntegralDataIndex, char *IntegralDataName) { - int ier=0; - cgns_integral *integral; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - integral = cgi_integral_address(MODE_READ, IntegralDataIndex, - "dummy", &ier); - if (integral==0) return ier; - - strcpy(IntegralDataName, integral->name); - return CG_OK; -} - -int cg_rind_read(int *RindData) { - int n, ier=0; - int *rind, index_dim; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - rind = cgi_rind_address(MODE_READ, &ier); - if (rind==0) return ier; - - if (posit_base && posit_zone) { - index_dim = cg->base[posit_base-1].zone[posit_zone-1].index_dim; - } else { - cgi_error("Can't find IndexDimension in cg_rind_read."); - return CG_NO_INDEX_DIM; - } - - for (n=0; n<2*index_dim; n++) RindData[n] = rind[n]; - return CG_OK; -} - -int cg_ndescriptors(int *ndescriptors) { - -/* Possible parents of Descriptor_t node: - * CGNSBase_t, Zone_t, GridCoordinates_t, Elements_t, FlowSolution_t, - * DiscreteData_t, ZoneGridConnectivity_t, GridConnectivity1to1_t, - * GridConnectivity_t, OversetHoles_t, ZoneBC_t, BC_t, BCDataSet_t, - * BCData_t, FlowEquationSet_t, GoverningEquations_t, GasModel_t, - * ViscosityModel_t, ThermalConductivityModel_t, TurbulenceClosure_t, - * TurbulenceModel_t, ThermalRelaxationModel_t, ChemicalKineticsModel_t, - * ConvergenceHistory_t, IntegralData_t, ReferenceState_t, - * DataArray_t, Family_t, GeometryReference_t, RigidGridMotion_t, - * ArbitraryGridMotion_t, BaseIterativeData_t, ZoneIterativeData_t, - * UserDefinedData_t, Gravity_t, Axisymmetry_t, RotatingCoordinates_t, - * BCProperty_t, WallFunction_t, Area_t, - * GridConnectivityProperty_t, Periodic_t, AverageInterface_t - */ - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - /* check for valid posit */ - if (posit == 0) { - cgi_error("No current position set by cg_goto\n"); - (*ndescriptors)=0; - return CG_ERROR; - } - - if (strcmp(posit_label,"CGNSBase_t")==0) - NDESCRIPTOR(cgns_base) - else if (strcmp(posit_label,"Zone_t")==0) - NDESCRIPTOR(cgns_zone) - else if (strcmp(posit_label,"GridCoordinates_t")==0) - NDESCRIPTOR(cgns_zcoor) - else if (strcmp(posit_label,"Elements_t")==0) - NDESCRIPTOR(cgns_section) - else if (strcmp(posit_label,"FlowSolution_t")==0) - NDESCRIPTOR(cgns_sol) - else if (strcmp(posit_label,"DiscreteData_t")==0) - NDESCRIPTOR(cgns_discrete) - else if (strcmp(posit_label,"ZoneGridConnectivity_t")==0) - NDESCRIPTOR(cgns_zconn) - else if (strcmp(posit_label,"GridConnectivity1to1_t")==0) - NDESCRIPTOR(cgns_1to1) - else if (strcmp(posit_label,"GridConnectivity_t")==0) - NDESCRIPTOR(cgns_conn) - else if (strcmp(posit_label,"OversetHoles_t")==0) - NDESCRIPTOR(cgns_hole) - else if (strcmp(posit_label,"ZoneBC_t")==0) - NDESCRIPTOR(cgns_zboco) - else if (strcmp(posit_label,"BC_t")==0) - NDESCRIPTOR(cgns_boco) - else if (strcmp(posit_label,"BCDataSet_t")==0) - NDESCRIPTOR(cgns_dataset) - else if (strcmp(posit_label,"BCData_t")==0) - NDESCRIPTOR(cgns_bcdata) - else if (strcmp(posit_label,"FlowEquationSet_t")==0) - NDESCRIPTOR(cgns_equations) - else if (strcmp(posit_label,"GoverningEquations_t")==0) - NDESCRIPTOR(cgns_governing) - else if (strcmp(posit_label,"GasModel_t")==0 || - strcmp(posit_label,"ViscosityModel_t")==0 || - strcmp(posit_label,"ThermalConductivityModel_t")==0 || - strcmp(posit_label,"TurbulenceModel_t")==0 || - strcmp(posit_label,"TurbulenceClosure_t")==0 || - strcmp(posit_label,"ThermalRelaxationModel_t")==0 || - strcmp(posit_label,"ChemicalKineticsModel_t")==0) - NDESCRIPTOR(cgns_model) - else if (strcmp(posit_label,"ConvergenceHistory_t")==0) - NDESCRIPTOR(cgns_converg) - else if (strcmp(posit_label,"IntegralData_t")==0) - NDESCRIPTOR(cgns_integral) - else if (strcmp(posit_label,"ReferenceState_t")==0) - NDESCRIPTOR(cgns_state) - else if (strcmp(posit_label,"DataArray_t")==0) - NDESCRIPTOR(cgns_array) - else if (strcmp(posit_label,"Family_t")==0) - NDESCRIPTOR(cgns_family) - else if (strcmp(posit_label,"GeometryReference_t")==0) - NDESCRIPTOR(cgns_geo) - else if (strcmp(posit_label,"RigidGridMotion_t")==0) - NDESCRIPTOR(cgns_rmotion) - else if (strcmp(posit_label,"ArbitraryGridMotion_t")==0) - NDESCRIPTOR(cgns_amotion) - else if (strcmp(posit_label,"BaseIterativeData_t")==0) - NDESCRIPTOR(cgns_biter) - else if (strcmp(posit_label,"ZoneIterativeData_t")==0) - NDESCRIPTOR(cgns_ziter) - else if (strcmp(posit_label,"UserDefinedData_t")==0) - NDESCRIPTOR(cgns_user_data) - else if (strcmp(posit_label,"Gravity_t")==0) - NDESCRIPTOR(cgns_gravity) - else if (strcmp(posit_label,"Axisymmetry_t")==0) - NDESCRIPTOR(cgns_axisym) - else if (strcmp(posit_label,"RotatingCoordinates_t")==0) - NDESCRIPTOR(cgns_rotating) - else if (strcmp(posit_label,"BCProperty_t")==0) - NDESCRIPTOR(cgns_bprop) - else if (strcmp(posit_label,"WallFunction_t")==0) - NDESCRIPTOR(cgns_bcwall) - else if (strcmp(posit_label,"Area_t")==0) - NDESCRIPTOR(cgns_bcarea) - else if (strcmp(posit_label,"GridConnectivityProperty_t")==0) - NDESCRIPTOR(cgns_cprop) - else if (strcmp(posit_label,"Periodic_t")==0) - NDESCRIPTOR(cgns_cperio) - else if (strcmp(posit_label,"AverageInterface_t")==0) - NDESCRIPTOR(cgns_caverage) - else { - cgi_error("Descriptor_t node not supported under '%s' type node",posit_label); - (*ndescriptors)=0; - return CG_INCORRECT_PATH; - } - return CG_OK; -} - -int cg_descriptor_read(int descr_no, char *descr_name, char **descr_text) { - cgns_descr *descr; - int ier=0; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - /* common part */ - descr = cgi_descr_address(MODE_READ, descr_no, "dummy", &ier); - if (descr==0) return ier; - - /* return Descriptor text and name */ - descr_text[0]=CGNS_NEW(char, strlen(descr->text)+1); - strcpy(descr_text[0], descr->text); - strcpy(descr_name, descr->name); - - return CG_OK; -} - -int cg_units_read(MassUnits_t *mass, LengthUnits_t *length, TimeUnits_t *time, - TemperatureUnits_t *temperature, AngleUnits_t *angle) { - - cgns_units *units; - int ier=0; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - units = cgi_units_address(MODE_READ, &ier); - if (units==0) return ier; - - (*mass) = units->mass; - (*length) = units->length; - (*time) = units->time; - (*temperature) = units->temperature; - (*angle) = units->angle; - return CG_OK; -} - -int cg_exponents_info(DataType_t *DataType) { - cgns_exponent *exponent; - int ier=0; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - exponent = cgi_exponent_address(MODE_READ, &ier); - if (exponent==0) return ier; - - (*DataType) = cgi_datatype(exponent->data_type); - return CG_OK; -} - -int cg_exponents_read(void *exponents) { - cgns_exponent *exponent; - int ier=0; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - exponent = cgi_exponent_address(MODE_READ, &ier); - if (exponent==0) return ier; - - if (cgi_datatype(exponent->data_type)==RealSingle) { - (*((float *)exponents+0)) = (*((float *) exponent->data+0)); - (*((float *)exponents+1)) = (*((float *) exponent->data+1)); - (*((float *)exponents+2)) = (*((float *) exponent->data+2)); - (*((float *)exponents+3)) = (*((float *) exponent->data+3)); - (*((float *)exponents+4)) = (*((float *) exponent->data+4)); - - } else if (cgi_datatype(exponent->data_type)==RealDouble) { - (*((double *)exponents+0)) = (*((double *) exponent->data+0)); - (*((double *)exponents+1)) = (*((double *) exponent->data+1)); - (*((double *)exponents+2)) = (*((double *) exponent->data+2)); - (*((double *)exponents+3)) = (*((double *) exponent->data+3)); - (*((double *)exponents+4)) = (*((double *) exponent->data+4)); - } - return CG_OK; -} - -int cg_conversion_info(DataType_t *DataType) { - cgns_conversion *conversion; - int ier=0; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - conversion = cgi_conversion_address(MODE_READ, &ier); - if (conversion==0) return ier; - - (*DataType) = cgi_datatype(conversion->data_type); - return CG_OK; -} - -int cg_conversion_read(void *ConversionFactors) { - cgns_conversion *conversion; - int ier=0; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - conversion = cgi_conversion_address(MODE_READ, &ier); - if (conversion==0) return ier; - - if (cgi_datatype(conversion->data_type)==RealSingle) { - *((float *)ConversionFactors+0) = *((float *) conversion->data+0); - *((float *)ConversionFactors+1) = *((float *) conversion->data+1); - - } else if (cgi_datatype(conversion->data_type)==RealDouble) { - *((double *)ConversionFactors+0) = *((double *) conversion->data+0); - *((double *)ConversionFactors+1) = *((double *) conversion->data+1); - } - return CG_OK; -} - -int cg_dataclass_read(DataClass_t *dataclass) { - DataClass_t *DataClass; - int ier=0; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - DataClass = cgi_dataclass_address(MODE_READ, &ier); - if (DataClass==0) return ier; - - if (*DataClass==DataClassNull) return CG_NODE_NOT_FOUND; - (*dataclass) = (*DataClass); - return CG_OK; -} - -int cg_gridlocation_read(GridLocation_t *GridLocation) { - GridLocation_t *location; - int ier=0; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - location = cgi_location_address(MODE_READ, &ier); - if (location==0) return ier; - - (*GridLocation) = (*location); - return CG_OK; -} - -int cg_ordinal_read(int *Ordinal) { - int *ordinal; - int ier=0; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - ordinal = cgi_ordinal_address(MODE_READ, &ier); - if (ordinal==0) return ier; - - (*Ordinal) = (*ordinal); - return CG_OK; -} - -int cg_is_link(int *path_length) { - int ierr; - double posit_id; - - *path_length = 0; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - if (cgi_posit_id(&posit_id)) return CG_ERROR; - - ADF_Is_Link(posit_id, path_length, &ierr); - if (ierr>0) { - adf_error("ADF_Is_Link",ierr); - return CG_ERROR; - } - - return CG_OK; -} - -int cg_link_read(char **filename, char **link_path) { - int ierr; - double posit_id; - char LinkFileName[ADF_FILENAME_LENGTH+1]; - char LinkPathName[ADF_FILENAME_LENGTH + ADF_MAX_LINK_DATA_SIZE + 1 + 1]; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - if (cgi_posit_id(&posit_id)) return CG_ERROR; - - ADF_Get_Link_Path(posit_id, LinkFileName, LinkPathName, &ierr); - if (ierr>0) { - adf_error("ADF_Get_Link_Path",ierr); - return CG_ERROR; - } - - if (strlen(LinkFileName) == 0) { - filename[0] = CGNS_NEW(char, 1); - filename[0][0]='\0'; - } else { - filename[0] = CGNS_NEW(char, strlen(LinkFileName)+1); - strcpy(filename[0], LinkFileName); - } - - if (strlen(LinkPathName) == 0) { - link_path[0] = CGNS_NEW(char, 1); - link_path[0][0]='\0'; - } else { - link_path[0] = CGNS_NEW(char, strlen(LinkPathName)+1); - strcpy(link_path[0], LinkPathName); - } - - return CG_OK; -} - -int cg_nuser_data(int *nuser_data) { - -/* Possible parents of UserDefinedData_t node: - * IntegralData_t, DiscreteData_t, ConvergenceHistory_t, ReferenceState_t, - * xxxModel_t, GoverningEquations_t, FlowEquationSet_t, BCData_t, BCDataSet_t, - * Elements_t, BC_t, ZoneBC_t, OversetHoles_t, GridConnectivity_t, - * GridConnectivity1to1_t, ZoneGridConnectivity_t, FlowSolution_t, - * GridCoordinates_t, RigidGridMotion_t, ArbitraryGridMotion_t, - * ZoneIterativeData_t, BaseIterativeData_t, Zone_t, GeometryReference_t, - * Family_t, CGNSBase_t, Gravity_t, Axisymmetry_t, RotatingCoordinates_t, - * BCProperty_t, WallFunction_t, Area_t, - * GridConnectivityProperty_t, Periodic_t, AverageInterface_t - */ - - /* This is valid and used during write as well as read mode. */ - - /* check for valid posit */ - if (posit == 0) { - cgi_error("No current position set by cg_goto\n"); - (*nuser_data) = 0; - return CG_ERROR; - } - - if (strcmp(posit_label,"IntegralData_t")==0) - (*nuser_data) = ((cgns_integral *)posit)->nuser_data; - else if (strcmp(posit_label,"DiscreteData_t")==0) - (*nuser_data) = ((cgns_discrete *)posit)->nuser_data; - else if (strcmp(posit_label,"ConvergenceHistory_t")==0) - (*nuser_data) = ((cgns_converg *)posit)->nuser_data; - else if (strcmp(posit_label,"ReferenceState_t")==0) - (*nuser_data) = ((cgns_state *)posit)->nuser_data; - else if ( (strcmp(posit_label,"GasModel_t")==0 || - strcmp(posit_label,"ViscosityModel_t")==0 || - strcmp(posit_label,"ThermalConductivityModel_t")==0 || - strcmp(posit_label,"TurbulenceModel_t")==0 || - strcmp(posit_label,"TurbulenceClosure_t")==0 || - strcmp(posit_label,"ThermalRelaxationModel_t")==0 || - strcmp(posit_label,"ChemicalKineticsModel_t")==0) ) - (*nuser_data) = ((cgns_model *)posit)->nuser_data; - else if (strcmp(posit_label,"GoverningEquations_t")==0) - (*nuser_data) = ((cgns_governing *)posit)->nuser_data; - else if (strcmp(posit_label,"FlowEquationSet_t")==0) - (*nuser_data) = ((cgns_equations *)posit)->nuser_data; - else if (strcmp(posit_label,"BCData_t")==0) - (*nuser_data) = ((cgns_bcdata *)posit)->nuser_data; - else if (strcmp(posit_label,"BCDataSet_t")==0) - (*nuser_data) = ((cgns_dataset *)posit)->nuser_data; - else if (strcmp(posit_label,"Elements_t")==0) - (*nuser_data) = ((cgns_section *)posit)->nuser_data; - else if (strcmp(posit_label,"BC_t")==0) - (*nuser_data) = ((cgns_boco *)posit)->nuser_data; - else if (strcmp(posit_label,"ZoneBC_t")==0) - (*nuser_data) = ((cgns_zboco *)posit)->nuser_data; - else if (strcmp(posit_label,"OversetHoles_t")==0) - (*nuser_data) = ((cgns_hole *)posit)->nuser_data; - else if (strcmp(posit_label,"GridConnectivity_t")==0) - (*nuser_data) = ((cgns_conn *)posit)->nuser_data; - else if (strcmp(posit_label,"GridConnectivity1to1_t")==0) - (*nuser_data) = ((cgns_1to1 *)posit)->nuser_data; - else if (strcmp(posit_label,"ZoneGridConnectivity_t")==0) - (*nuser_data) = ((cgns_zconn *)posit)->nuser_data; - else if (strcmp(posit_label,"FlowSolution_t")==0) - (*nuser_data) = ((cgns_sol *)posit)->nuser_data; - else if (strcmp(posit_label,"GridCoordinates_t")==0) - (*nuser_data) = ((cgns_zcoor *)posit)->nuser_data; - else if (strcmp(posit_label,"RigidGridMotion_t")==0) - (*nuser_data) = ((cgns_rmotion *)posit)->nuser_data; - else if (strcmp(posit_label,"ArbitraryGridMotion_t")==0) - (*nuser_data) = ((cgns_amotion *)posit)->nuser_data; - else if (strcmp(posit_label,"ZoneIterativeData_t")==0) - (*nuser_data) = ((cgns_ziter *)posit)->nuser_data; - else if (strcmp(posit_label,"BaseIterativeData_t")==0) - (*nuser_data) = ((cgns_biter *)posit)->nuser_data; - else if (strcmp(posit_label,"Zone_t")==0) - (*nuser_data) = ((cgns_zone *)posit)->nuser_data; - else if (strcmp(posit_label,"GeometryReference_t")==0) - (*nuser_data) = ((cgns_geo *)posit)->nuser_data; - else if (strcmp(posit_label,"Family_t")==0) - (*nuser_data) = ((cgns_family *)posit)->nuser_data; - else if (strcmp(posit_label,"CGNSBase_t")==0) - (*nuser_data) = ((cgns_base *)posit)->nuser_data; - else if (strcmp(posit_label,"Gravity_t")==0) - (*nuser_data) = ((cgns_gravity *)posit)->nuser_data; - else if (strcmp(posit_label,"Axisymmetry_t")==0) - (*nuser_data) = ((cgns_axisym *)posit)->nuser_data; - else if (strcmp(posit_label,"RotatingCoordinates_t")==0) - (*nuser_data) = ((cgns_rotating *)posit)->nuser_data; - else if (strcmp(posit_label,"BCProperty_t")==0) - (*nuser_data) = ((cgns_bprop *)posit)->nuser_data; - else if (strcmp(posit_label,"WallFunction_t")==0) - (*nuser_data) = ((cgns_bcwall *)posit)->nuser_data; - else if (strcmp(posit_label,"Area_t")==0) - (*nuser_data) = ((cgns_bcarea *)posit)->nuser_data; - else if (strcmp(posit_label,"GridConnectivityProperty_t")==0) - (*nuser_data) = ((cgns_cprop *)posit)->nuser_data; - else if (strcmp(posit_label,"Periodic_t")==0) - (*nuser_data) = ((cgns_cperio *)posit)->nuser_data; - else if (strcmp(posit_label,"AverageInterface_t")==0) - (*nuser_data) = ((cgns_caverage *)posit)->nuser_data; - - else { - cgi_error("UserDefinedData_t node not supported under '%s' type node",posit_label); - (*nuser_data) = 0; - return CG_INCORRECT_PATH; - } - return CG_OK; -} - -int cg_user_data_read(int Index, char *UserDataName) { - int ier=0; - cgns_user_data *user_data; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - user_data = cgi_user_data_address(MODE_READ, Index, - "dummy", &ier); - if (user_data==0) return ier; - - strcpy(UserDataName, user_data->name); - return CG_OK; -} - -int cg_rotating_read(float *rot_rate, float *rot_center) { - cgns_rotating *rotating; - cgns_base *base; - int ier=0, n; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_READ)) return CG_ERROR; - - rotating = cgi_rotating_address(MODE_READ, &ier); - if (rotating==0) return ier; - - if (posit_base) { - base = &cg->base[posit_base-1]; - } else { - cgi_error("Can't find the base"); - return CG_ERROR; - } - - for (n=0; nnarrays; n++) { - if (strcmp(rotating->array[n].name,"RotationCenter")==0) - memcpy(rot_center, rotating->array[n].data, base->phys_dim*sizeof(float)); - else if (strcmp(rotating->array[n].name,"RotationRateVector")==0) - memcpy(rot_rate, rotating->array[n].data, base->phys_dim*sizeof(float)); - } - return CG_OK; -} - -/*****************************************************************************\ - * Write Functions -\*****************************************************************************/ -int cg_base_write(int file_number, char const * basename, int cell_dim, int phys_dim, int *B) { - cgns_base *base; - int index; - int dim_vals; - int data[2]; - - /* verify input */ - if (cgi_check_strlen(basename)) return CG_ERROR; - if (cell_dim<1 || cell_dim>3 || phys_dim<1 || phys_dim>3) { - cgi_error("Invalid input: cell_dim=%d, phys_dim=%d",cell_dim,phys_dim); - return CG_ERROR; - } - /* get memory address for base */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - /* Overwrite a CGNSBase_t Node: */ - for (index=0; indexnbases; index++) { - if (strcmp(basename, cg->base[index].name)==0) { - - /* in MODE_WRITE, children names must be unique */ - if (cg->mode==MODE_WRITE) { - cgi_error("Duplicate child name found: %s",basename); - return CG_ERROR; - } - - /* overwrite an existing base */ - /* delete the existing base from file */ - if (cgi_delete_node(cg->rootid, cg->base[index].id)) - return CG_ERROR; - /* save the old in-memory address to overwrite */ - base = &(cg->base[index]); - /* free memory */ - cgi_free_base(base); - break; - } - } - /* ... or add a CGNSBase_t Node: */ - if (index==cg->nbases) { - if (cg->nbases == 0) { - cg->base = CGNS_NEW(cgns_base, cg->nbases+1); - } else { - cg->base = CGNS_RENEW(cgns_base, cg->nbases+1, cg->base); - } - base = &(cg->base[cg->nbases]); - cg->nbases ++; - } - (*B) = index+1; - - /* save data in memory and initialize base data structure */ - strcpy(base->name, basename); - base->cell_dim = cell_dim; - base->phys_dim = phys_dim; - base->id=0; - base->nzones=0; - base->ndescr=0; - base->nfamilies=0; - base->state=0; - base->data_class=DataClassNull; - base->units=0; - base->equations=0; - base->converg=0; - base->nintegrals=0; - base->biter=0; - base->type=SimulationTypeNull; - base->type_id=0; - base->nuser_data=0; - base->gravity=0; - base->axisym=0; - base->rotating=0; - - /* save data in file */ - data[0] = cell_dim; - data[1] = phys_dim; - dim_vals=2; - if (cgi_new_node(cg->rootid, base->name, "CGNSBase_t", &base->id, - "I4", 1, &dim_vals, (void *)data)) return CG_ERROR; - - return CG_OK; -} - -int cg_zone_write(int file_number, int B, char const *zonename, int const * nijk, - ZoneType_t type, int *Z) { - cgns_base *base; - cgns_zone *zone; - int index, i, index_dim; - int dim_vals[2]; - double dummy_id; - - /* verify input */ - if (cgi_check_strlen(zonename)) return CG_ERROR; - - /* get memory address file */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - /* Set index dimension */ - if (type == Structured) - index_dim = cg->base[B-1].cell_dim; - else if (type == Unstructured) - index_dim = 1; - else { - cgi_error("Invalid zone type - not Structured or Unstructured"); - return CG_ERROR; - } - - for (i=0; inzones; index++) { - if (strcmp(zonename, base->zone[index].name)==0) { - - /* in MODE_WRITE, children names must be unique */ - if (cg->mode==MODE_WRITE) { - cgi_error("Duplicate child name found: %s",zonename); - return CG_ERROR; - } - - /* overwrite an existing zone */ - /* delete the existing zone from file */ - if (cgi_delete_node(base->id, base->zone[index].id)) - return CG_ERROR; - /* save the old in-memory address to overwrite */ - zone = &(base->zone[index]); - /* free memory */ - cgi_free_zone(zone); - break; - } - } - /* ... or add a Zone_t Node: */ - if (index==base->nzones) { - if (base->nzones == 0) { - base->zone = CGNS_NEW(cgns_zone, base->nzones+1); - } else { - base->zone = CGNS_RENEW(cgns_zone, base->nzones+1, base->zone); - } - zone = &(base->zone[base->nzones]); - base->nzones++; - } - (*Z) = index+1; - - /* save data to zone */ - strcpy(zone->name,zonename); - if ((zone->nijk = (int *)malloc(index_dim*3*sizeof(int)))==NULL) { - cgi_error("Error allocating zone->nijk"); - return CG_ERROR; - } - for (i=0; i<3*index_dim; i++) zone->nijk[i] = nijk[i]; - zone->index_dim = index_dim; - zone->type = type; - - /* initialize */ - - zone->id = 0; - zone->link = 0; - zone->ndescr = 0; - zone->nzcoor = 0; - zone->nsections = 0; - zone->family_name[0]='\0'; - zone->nsols = 0; - zone->ndiscrete = 0; - zone->nintegrals = 0; - zone->zconn = 0; - zone->zboco = 0; - zone->state = 0; - zone->data_class = DataClassNull; - zone->units = 0; - zone->equations = 0; - zone->converg = 0; - zone->ordinal = 0; - zone->nrmotions = 0; - zone->namotions = 0; - zone->ziter = 0; - zone->nuser_data= 0; - zone->rotating = 0; - - /* save data in file */ - dim_vals[0]=zone->index_dim; - dim_vals[1]=3; - if (cgi_new_node(base->id, zone->name, "Zone_t", &zone->id, - "I4", 2, dim_vals, (void *)zone->nijk)) return CG_ERROR; - - dim_vals[0] = strlen(ZoneTypeName[type]); - if (cgi_new_node(zone->id, "ZoneType", "ZoneType_t", &dummy_id, - "C1", 1, dim_vals, ZoneTypeName[type])) return CG_ERROR; - - return CG_OK; -} - -int cg_family_write(int file_number, int B, char const * family_name, int *F) { - int index; - cgns_base *base; - cgns_family *family; - - /* verify input */ - if (cgi_check_strlen(family_name)) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - /* get memory address for base */ - base = cgi_get_base(cg, B); - if (base==0) return CG_ERROR; - - /* Overwrite a Family_t Node: */ - for (index=0; indexnfamilies; index++) { - if (strcmp(family_name, base->family[index].name)==0) { - - /* in MODE_WRITE, children names must be unique */ - if (cg->mode==MODE_WRITE) { - cgi_error("Duplicate child name found: %s",family_name); - return CG_ERROR; - } - - /* overwrite an existing zone */ - /* delete the existing zone from file */ - if (cgi_delete_node(base->id, base->family[index].id)) - return CG_ERROR; - /* save the old in-memory address to overwrite */ - family = &(base->family[index]); - /* free memory */ - cgi_free_family(family); - break; - } - } - /* ... or add a Family_t Node: */ - if (index==base->nfamilies) { - if (base->nfamilies == 0) { - base->family = CGNS_NEW(cgns_family, base->nfamilies+1); - } else { - base->family = CGNS_RENEW(cgns_family, base->nfamilies+1, base->family); - } - family = &(base->family[base->nfamilies]); - base->nfamilies++; - } - (*F) = index+1; - - strcpy(family->name, family_name); - family->id=0; - family->link = 0; - family->ndescr = 0; - family->nfambc = 0; - family->ngeos = 0; - family->ordinal = 0; - family->nuser_data= 0; - - /* save data in file */ - if (cgi_new_node(base->id, family->name, "Family_t", &family->id, - "MT", 0, 0, 0)) return CG_ERROR; - - return CG_OK; -} - -int cg_fambc_write(int file_number, int B, int F, char const * fambc_name, - BCType_t bocotype, int *BC) { - int index, length; - cgns_family *family; - cgns_fambc *fambc; - - /* verify input */ - if (cgi_check_strlen(fambc_name)) return CG_ERROR; - if (bocotype<0 || bocotype>=NofValidBCTypes) { - cgi_error("Invalid BCType: %d",bocotype); - return CG_ERROR; - } - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - /* get memory address for family */ - family = cgi_get_family(cg, B, F); - if (family==0) return CG_ERROR; - - /* Overwrite a FamilyBC_t Node: */ - for (index=0; indexnfambc; index++) { - if (strcmp(fambc_name, family->fambc[index].name)==0) { - - /* in MODE_WRITE, children names must be unique */ - if (cg->mode==MODE_WRITE) { - cgi_error("Duplicate child name found: %s",fambc_name); - return CG_ERROR; - } - - /* overwrite an existing zone */ - /* delete the existing fambc from file */ - if (cgi_delete_node(family->id, family->fambc[index].id)) - return CG_ERROR; - /* save the old in-memory address to overwrite */ - fambc = &(family->fambc[index]); - /* free memory */ - cgi_free_fambc(fambc); - break; - } - } - /* ... or add a FamilyBC_t Node: */ - if (index==family->nfambc) { - if (family->nfambc == 0) { - family->fambc = CGNS_NEW(cgns_fambc, family->nfambc+1); - } else { - family->fambc = CGNS_RENEW(cgns_fambc, family->nfambc+1, family->fambc); - } - fambc = &(family->fambc[family->nfambc]); - family->nfambc++; - } - (*BC) = index+1; - - strcpy(fambc->name, fambc_name); - fambc->id=0; - fambc->link = 0; - fambc->type = bocotype; - - /* save data in file */ - length = strlen(BCTypeName[bocotype]); - if (cgi_new_node(family->id, fambc->name, "FamilyBC_t", &fambc->id, - "C1", 1, &length, BCTypeName[bocotype])) return CG_ERROR; - return CG_OK; -} - -int cg_geo_write(int file_number, int B, int F, char const * geo_name, - char const * filename, char const * CADname, int *G) { - int index, length; - cgns_family *family; - cgns_geo *geo; - double dummy_id; - - /* verify input */ - if (cgi_check_strlen(geo_name)) return CG_ERROR; - if (cgi_check_strlen(CADname)) return CG_ERROR; - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - /* get memory address for family */ - family = cgi_get_family(cg, B, F); - if (family==0) return CG_ERROR; - - /* Overwrite a GeometryReference_t Node: */ - for (index=0; indexngeos; index++) { - if (strcmp(geo_name, family->geo[index].name)==0) { - - /* in MODE_WRITE, children names must be unique */ - if (cg->mode==MODE_WRITE) { - cgi_error("Duplicate child name found: %s",geo_name); - return CG_ERROR; - } - - /* overwrite an existing zone */ - /* delete the existing geo from file */ - if (cgi_delete_node(family->id, family->geo[index].id)) - return CG_ERROR; - /* save the old in-memory address to overwrite */ - geo = &(family->geo[index]); - /* free memory */ - cgi_free_geo(geo); - break; - } - } - /* ... or add a GeometryReference_t Node: */ - if (index==family->ngeos) { - if (family->ngeos == 0) { - family->geo = CGNS_NEW(cgns_geo, family->ngeos+1); - } else { - family->geo = CGNS_RENEW(cgns_geo, family->ngeos+1, family->geo); - } - geo = &(family->geo[family->ngeos]); - family->ngeos++; - } - (*G) = index+1; - - - strcpy(geo->name, geo_name); - strcpy(geo->format, CADname); - geo->id=0; - geo->link=0; - geo->ndescr=0; - geo->npart=0; - geo->nuser_data=0; - - length = strlen(filename); - if (length<=0) { - cgi_error("filename undefined for GeometryReference node!"); - return CG_ERROR; - } - geo->file = (char *)malloc((length+1)*sizeof(char)); - strcpy(geo->file, filename); - - /* save data in file */ - if (cgi_new_node(family->id, geo->name, "GeometryReference_t", &geo->id, - "MT", 0, 0, 0)) return CG_ERROR; - length = strlen(geo->file); - if (cgi_new_node(geo->id, "GeometryFile", "GeometryFile_t", &dummy_id, - "C1", 1, &length, geo->file)) return CG_ERROR; - length = strlen(geo->format); - if (cgi_new_node(geo->id, "GeometryFormat", "GeometryFormat_t", &dummy_id, - "C1", 1, &length, geo->format)) return CG_ERROR; - return CG_OK; -} - -int cg_part_write(int file_number, int B, int F, int G, char const * part_name, - int *P) { - int index; - cgns_geo *geo; - cgns_part *part; - cgns_family *family; - - /* verify input */ - if (cgi_check_strlen(part_name)) return CG_ERROR; - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - /* get memory address for geo */ - family = cgi_get_family(cg, B, F); - if (family==0) return CG_ERROR; - if (G > family->ngeos || G <=0) { - cgi_error("Invalid index for GeometryEntity_t node"); - return CG_ERROR; - } - geo = &family->geo[G-1]; - - /* Overwrite a GeometryEntity_t Node: */ - for (index=0; indexnpart; index++) { - if (strcmp(part_name, geo->part[index].name)==0) { - - /* in MODE_WRITE, children names must be unique */ - if (cg->mode==MODE_WRITE) { - cgi_error("Duplicate child name found: %s",part_name); - return CG_ERROR; - } - - /* overwrite an existing zone */ - /* delete the existing geo from file */ - if (cgi_delete_node(geo->id, geo->part[index].id)) - return CG_ERROR; - /* save the old in-memory address to overwrite */ - part = &(geo->part[index]); - /* free memory */ - cgi_free_part(part); - break; - } - } - /* ... or add a GeometryReference_t Node: */ - if (index==geo->npart) { - if (geo->npart == 0) { - geo->part = CGNS_NEW(cgns_part, geo->npart+1); - } else { - geo->part = CGNS_RENEW(cgns_part, geo->npart+1, geo->part); - } - part = &(geo->part[geo->npart]); - geo->npart++; - } - (*P) = index+1; - - strcpy(part->name, part_name); - part->id=0; - part->link=0; - - /* save data in file */ - if (cgi_new_node(geo->id, part->name, "GeometryEntity_t", &part->id, - "MT", 0, 0, 0)) return CG_ERROR; - return CG_OK; -} - -int cg_discrete_write(int file_number, int B, int Z, char const * discrete_name, int *D) { - cgns_zone *zone; - cgns_discrete *discrete; - int index; - - /* verify input */ - if (cgi_check_strlen(discrete_name)) return CG_ERROR; - - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return CG_ERROR; - - /* Overwrite a DiscreteData_t node: */ - for (index=0; indexndiscrete; index++) { - if (strcmp(discrete_name, zone->discrete[index].name)==0) { - - /* in MODE_WRITE, children names must be unique */ - if (cg->mode==MODE_WRITE) { - cgi_error("Duplicate child name found: %s",discrete_name); - return CG_ERROR; - } - - /* overwrite an existing solution */ - /* delete the existing solution from file */ - if (cgi_delete_node(zone->id, zone->discrete[index].id)) - return CG_ERROR; - /* save the old in-memory address to overwrite */ - discrete = &(zone->discrete[index]); - /* free memory */ - cgi_free_discrete(discrete); - break; - } - } - /* ... or add a FlowSolution_t Node: */ - if (index==zone->ndiscrete) { - if (zone->ndiscrete == 0) { - zone->discrete = CGNS_NEW(cgns_discrete, zone->ndiscrete+1); - } else { - zone->discrete = CGNS_RENEW(cgns_discrete, zone->ndiscrete+1, zone->discrete); - } - discrete = &zone->discrete[zone->ndiscrete]; - zone->ndiscrete++; - } - (*D) = index+1; - - /* save data in memory */ - strcpy(discrete->name, discrete_name); - - /* initialize other fields */ - discrete->id = 0; - discrete->link=0; - discrete->ndescr=0; - discrete->location=Vertex; - discrete->rind_planes=0; - discrete->narrays=0; - discrete->data_class=DataClassNull; - discrete->units=0; - discrete->nuser_data=0; - - /* save data in file */ - if (cgi_new_node(zone->id, discrete->name, "DiscreteData_t", &discrete->id, - "MT", 0, 0, 0)) return CG_ERROR; - return CG_OK; -} - - -int cg_coord_write(int file_number, int B, int Z, DataType_t type, char const * coordname, - void const * coord_ptr, int *C) { - cgns_zone *zone; - cgns_zcoor *zcoor; - cgns_array *coord; - int n, ierr=0; - int index, index_dim; - - /* verify input */ - if (cgi_check_strlen(coordname)) return CG_ERROR; - if (type!=RealSingle && type!=RealDouble) { - cgi_error("Invalid datatype for coord. array: %d", type); - return CG_ERROR; - } - /* get memory address for file */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - /* get memory address for zone */ - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return CG_ERROR; - - /* Get memory address for node "GridCoordinates" */ - zcoor = cgi_get_zcoorGC(cg, B, Z); - if (zcoor==0) return CG_ERROR; - - /* Overwrite a DataArray_t Node of same size, name and data-type: */ - for (index=0; indexncoords; index++) { - if (strcmp(coordname, zcoor->coord[index].name)==0) { - coord = &(zcoor->coord[index]); - - /* in MODE_WRITE, children names must be unique */ - if (cg->mode==MODE_WRITE) { - cgi_error("Duplicate child name found: %s",coordname); - return CG_ERROR; - } - - /* overwrite an existing coordinate vector */ - if (type==cgi_datatype(coord->data_type)) { - ADF_Write_All_Data(coord->id, (char *) coord_ptr, &ierr); - if (ierr>0) { - adf_error("ADF_Write_All_Data", ierr); - return CG_ERROR; - } - (*C) = index+1; - return CG_OK; - } - cgi_error("To overwrite array %s, use data-type '%s'", - coord->name, DataTypeName[cgi_datatype(coord->data_type)]); - return CG_ERROR; - } - } - - /* ... or add a DataArray_t Node: */ - if (zcoor->ncoords == 0) { - zcoor->coord = CGNS_NEW(cgns_array, zcoor->ncoords+1); - } else { - zcoor->coord = CGNS_RENEW(cgns_array, zcoor->ncoords+1, zcoor->coord); - } - coord = &(zcoor->coord[zcoor->ncoords]); - zcoor->ncoords++; - (*C) = zcoor->ncoords; - - /* save coord. data in memory */ - strcpy(coord->data_type,cgi_adf_datatype(type)); - strcpy(coord->name,coordname); - coord->id=0; /* initialize */ - coord->link=0; - index_dim = zone->index_dim; - for (n=0; ndim_vals[n] = zone->nijk[n] + zcoor->rind_planes[2*n] - + zcoor->rind_planes[2*n+1]; - coord->data_dim=index_dim; - coord->data=0; - coord->ndescr=0; - coord->data_class=DataClassNull; - coord->units=0; - coord->exponents=0; - coord->convert=0; - - /* Create GridCoodinates_t node if not already created */ - if (zcoor->id == 0) { - if (cgi_new_node(zone->id, "GridCoordinates", "GridCoordinates_t", - &zcoor->id, "MT", 0, 0, 0)) return CG_ERROR; - } - /* Create DataArray_t node on disk */ - if (cgi_new_node(zcoor->id, coord->name, "DataArray_t", &coord->id, - coord->data_type, index_dim, coord->dim_vals, coord_ptr)) return CG_ERROR; - - return CG_OK; -} - -int cg_section_write(int file_number, int B, int Z, char const * SectionName, ElementType_t type, - int start, int end, int nbndry, int const * elements, int *S) { - cgns_zone *zone; - cgns_section *section; - int index, num, npe; - int ElementDataSize=0; - - /* verify input */ - if (cgi_check_strlen(SectionName)) return CG_ERROR; - - /* Can't check the upper limit with NofValidElementTypes because - for NGON_n, type=NGON_n + npe */ - if (type<0) { - cgi_error("Invalid element type defined for section '%s'",SectionName); - return CG_ERROR; - } - if ((end-start)<0) { - cgi_error("Invalid element range defined for section '%s'",SectionName); - return CG_ERROR; - } - if (nbndry>(end-start+1)) { - cgi_error("Invalid boundary element number for section '%s'",SectionName); - return CG_ERROR; - } - - /* get file and check mode */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return CG_ERROR; - - /* Overwrite a Elements_t Node: */ - for (index=0; indexnsections; index++) { - if (strcmp(SectionName, zone->section[index].name)==0) { - - /* in MODE_WRITE, children names must be unique */ - if (cg->mode==MODE_WRITE) { - cgi_error("Duplicate child name found: %s",SectionName); - return CG_ERROR; - } - - /* overwrite an existing section */ - /* delete the existing section from file */ - if (cgi_delete_node(zone->id, zone->section[index].id)) - return CG_ERROR; - /* save the old in-memory address to overwrite */ - section = &(zone->section[index]); - /* free memory */ - cgi_free_section(section); - break; - } - } - /* ... or add a Elements_t Node: */ - if (index==zone->nsections) { - if (zone->nsections == 0) { - zone->section = CGNS_NEW(cgns_section, zone->nsections+1); - } else { - zone->section = CGNS_RENEW(cgns_section, zone->nsections+1, zone->section); - } - section = &(zone->section[zone->nsections]); - zone->nsections++; - } - (*S) = index+1; - - /* save data in memory */ - strcpy(section->name, SectionName); - section->el_type = type; - section->range[0] = start; - section->range[1] = end; - section->el_bound = nbndry; - - /* Compute ElementDataSize */ - num = end - start +1; - if (type!= MIXED) { - if (cg_npe(type, &npe)) return CG_ERROR; - ElementDataSize = num * npe; - } else { - int n; - ElementType_t el_type; - for (n=0; nconnect = CGNS_NEW(cgns_array, 1); - section->connect->data = (void *)malloc(ElementDataSize*sizeof(int)); - memcpy(section->connect->data, elements, ElementDataSize*sizeof(int)); - strcpy(section->connect->name,"ElementConnectivity"); - strcpy(section->connect->data_type,"I4"); - section->connect->data_dim=1; - section->connect->dim_vals[0]=ElementDataSize; - - /* initialize ... */ - section->id=0; - section->link=0; - section->ndescr=0; - section->parent=0; - section->nuser_data=0; - - /* initialize other fields */ - section->connect->id=0; - section->connect->link=0; - section->connect->ndescr=0; - section->connect->data_class=DataClassNull; - section->connect->units=0; - section->connect->exponents=0; - section->connect->convert=0; - - /* save data in file */ - if (cgi_write_section(zone->id, section)) return CG_ERROR; - return CG_OK; -} - -int cg_parent_data_write(int file_number, int B, int Z, int S, int const * parent_data) { - cgns_section *section; - cgns_array *parent; - int num; - - /* get file and check mode */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - section = cgi_get_section(cg, B, Z, S); - if (section == 0) return CG_ERROR; - - if (section->parent) { - if (cg->mode==MODE_WRITE) { - cgi_error("ParentData is already defined under Elements_t '%s'", - section->name); - return CG_ERROR; - } - if (cgi_delete_node(section->id, section->parent->id)) - return CG_ERROR; - cgi_free_array(section->parent); - } else - section->parent = CGNS_NEW(cgns_array, 1); - parent = section->parent; - - num = section->range[1]-section->range[0]+1; - strcpy(parent->data_type, "I4"); - parent->data = (void *)malloc(num*4*sizeof(int)); - if (!parent->data) { - cgi_error("Error allocating parent->data"); - return CG_ERROR; - } - memcpy(parent->data, parent_data, num*4*sizeof(int)); - strcpy(parent->name, "ParentData"); - parent->data_dim =2; - parent->dim_vals[0]=num; - parent->dim_vals[1]=4; - - /* initialize other fields */ - parent->id=0; - parent->link=0; - parent->ndescr=0; - parent->data_class=DataClassNull; - parent->units=0; - parent->exponents=0; - parent->convert=0; - - if(cgi_write_array(section->id, section->parent)) return CG_ERROR; - return CG_OK; -} - -int cg_grid_write(int file_number, int B, int Z, char const * zcoorname, int *G) { - cgns_zone *zone; - cgns_zcoor *zcoor; - int index, n, index_dim; - - /* verify input */ - if (cgi_check_strlen(zcoorname)) return CG_ERROR; - - /* get memory address */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return CG_ERROR; - - /* Overwrite a GridCoordinates_t Node: */ - for (index=0; indexnzcoor; index++) { - if (strcmp(zcoorname, zone->zcoor[index].name)==0) { - - /* in MODE_WRITE, children names must be unique */ - if (cg->mode==MODE_WRITE) { - cgi_error("Duplicate child name found: %s",zcoorname); - return CG_ERROR; - } - - /* overwrite an existing GridCoordinates_t node */ - /* delete the existing GridCoordinates_t from file */ - if (cgi_delete_node(zone->id, zone->zcoor[index].id)) - return CG_ERROR; - /* save the old in-memory address to overwrite */ - zcoor = &(zone->zcoor[index]); - /* free memory */ - cgi_free_zcoor(zcoor); - break; - } - } - /* ... or add a GridCoordinates_t Node: */ - if (index==zone->nzcoor) { - if (zone->nzcoor == 0) { - zone->zcoor = CGNS_NEW(cgns_zcoor, 1); - } else { - zone->zcoor = CGNS_RENEW(cgns_zcoor, zone->nzcoor+1, zone->zcoor); - } - zcoor = &(zone->zcoor[zone->nzcoor]); - zone->nzcoor++; - } - (*G) = index+1; - - /* save data in memory */ - strcpy(zcoor->name,zcoorname); - - /* initialize */ - zcoor->ncoords = 0; - zcoor->id=0; - zcoor->link=0; - zcoor->ndescr=0; - zcoor->data_class=DataClassNull; - zcoor->units=0; - zcoor->nuser_data=0; - - index_dim = zone->index_dim; - zcoor->rind_planes = (int *)malloc(index_dim*2*sizeof(int)); - if (!zcoor->rind_planes) { - cgi_error("Error allocating zcoor->rind_plane."); - return CG_ERROR; - } - for (n=0; nrind_planes[2*n]=zcoor->rind_planes[2*n+1]=0; - - /* save data in file */ - if (cgi_new_node(zone->id, zcoor->name, "GridCoordinates_t", &zcoor->id, - "MT", 0, 0, 0)) return CG_ERROR; - - return CG_OK; -} - -int cg_sol_write(int file_number, int B, int Z, char const * solname, - GridLocation_t location, int *S) { - cgns_zone *zone; - cgns_sol *sol; - int index, n, index_dim; - - /* verify input */ - if (cgi_check_strlen(solname)) return CG_ERROR; - if (location != Vertex && location != CellCenter && - location !=IFaceCenter && location != JFaceCenter && - location != KFaceCenter) { - cgi_error("Given grid location not supported for FlowSolution_t"); - return CG_ERROR; - } - /* if (location<0 || location >= NofValidGridLocation) { - cgi_error("Invalid input: GridLocation=%d ?",location); - return CG_ERROR; - } */ - - /* get memory address for FlowSolution node */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return CG_ERROR; - if (zone->type != Structured && (location == IFaceCenter || - location == JFaceCenter || location == KFaceCenter)) { - cgi_error ("GridLocation [IJK]FaceCenter only valid for Structured grid"); - return CG_ERROR; - } - - /* Overwrite a FlowSolution_t Node: */ - for (index=0; indexnsols; index++) { - if (strcmp(solname, zone->sol[index].name)==0) { - - /* in MODE_WRITE, children names must be unique */ - if (cg->mode==MODE_WRITE) { - cgi_error("Duplicate child name found: %s",solname); - return CG_ERROR; - } - - /* overwrite an existing solution */ - /* delete the existing solution from file */ - if (cgi_delete_node(zone->id, zone->sol[index].id)) - return CG_ERROR; - /* save the old in-memory address to overwrite */ - sol = &(zone->sol[index]); - /* free memory */ - cgi_free_sol(sol); - break; - } - } - /* ... or add a FlowSolution_t Node: */ - if (index==zone->nsols) { - if (zone->nsols == 0) { - zone->sol = CGNS_NEW(cgns_sol, zone->nsols+1); - } else { - zone->sol = CGNS_RENEW(cgns_sol, zone->nsols+1, zone->sol); - } - sol = &(zone->sol[zone->nsols]); - zone->nsols++; - } - (*S) = index+1; - - /* save data in memory */ - strcpy(sol->name,solname); - sol->location = location; - - /* initialize */ - sol->nfields = 0; - sol->id=0; - sol->link=0; - sol->ndescr=0; - sol->data_class=DataClassNull; - sol->units=0; - sol->nuser_data=0; - - index_dim = zone->index_dim; - sol->rind_planes = (int *)malloc(index_dim*2*sizeof(int)); - if (!sol->rind_planes) { - cgi_error("Error allocating sol->rind_plane."); - return CG_ERROR; - } - for (n=0; nrind_planes[2*n]=sol->rind_planes[2*n+1]=0; - - /* save data in file */ - if (cgi_new_node(zone->id, sol->name, "FlowSolution_t", &sol->id, - "MT", 0, 0, 0)) return CG_ERROR; - if (sol->location != Vertex) { - int length = strlen(GridLocationName[sol->location]); - double GL_id; - if (cgi_new_node(sol->id, "GridLocation", "GridLocation_t", &GL_id, - "C1", 1, &length, (void *)GridLocationName[sol->location])) return CG_ERROR; - } - - return CG_OK; -} - -int cg_field_write(int file_number, int B, int Z, int S, DataType_t type, char const * fieldname, - void const * field_ptr, int *F) { - cgns_zone *zone; - cgns_sol *sol; - cgns_array *field; - int ierr=0; - int index, index_dim; - - /* verify input */ - if (cgi_check_strlen(fieldname)) return CG_ERROR; - if (type!=RealSingle && type!=RealDouble && type!=Integer) { - cgi_error("Invalid datatype for solution array %s: %d",fieldname, type); - return CG_ERROR; - } - /* get memory addresses */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return CG_ERROR; - - sol = cgi_get_sol(cg, B, Z, S); - if (sol==0) return CG_ERROR; - - index_dim = zone->index_dim; - - /* Overwrite a DataArray_t Node: */ - for (index=0; indexnfields; index++) { - if (strcmp(fieldname, sol->field[index].name)==0) { - field = &(sol->field[index]); - - /* in MODE_WRITE, children names must be unique */ - if (cg->mode==MODE_WRITE) { - cgi_error("Duplicate child name found: %s",fieldname); - return CG_ERROR; - } - - /* overwrite an existing solution */ - if (type==cgi_datatype(field->data_type)) { - ADF_Write_All_Data(field->id, (const char *) field_ptr, &ierr); - if (ierr>0) { - adf_error("ADF_Write_All_Data", ierr); - return CG_ERROR; - } - (*F) = index+1; - return CG_OK; - } - cgi_error("To overwrite array %s, use data-type '%s'", - field->name, DataTypeName[cgi_datatype(field->data_type)]); - return CG_ERROR; - } - } - /* ... or add a DataArray_t Node: */ - if (sol->nfields == 0) { - sol->field = CGNS_NEW(cgns_array, sol->nfields+1); - } else { - sol->field = CGNS_RENEW(cgns_array, sol->nfields+1, sol->field); - } - field = &(sol->field[sol->nfields]); - sol->nfields++; - (*F) = sol->nfields; - - /* save data in memory */ - strcpy(field->data_type, cgi_adf_datatype(type)); - strcpy(field->name,fieldname); - field->data_dim = zone->index_dim; - if (cgi_datasize(index_dim, zone->nijk, sol->location, - sol->rind_planes, field->dim_vals)) return CG_ERROR; - - /* initialize */ - field->id = 0; - field->link= 0; - field->data=0; - field->ndescr= 0; - field->data_class= DataClassNull; - field->units= 0; - field->exponents= 0; - field->convert= 0; - - /* Save DataArray_t node on disk: */ - if (cgi_new_node(sol->id, field->name, "DataArray_t", &field->id, - field->data_type, index_dim, field->dim_vals, field_ptr)) return CG_ERROR; - - return CG_OK; -} - -int cg_hole_write(int file_number, int B, int Z, char const * holename, GridLocation_t location, - PointSetType_t ptset_type, int nptsets, int npnts, int const * pnts, int *I) { - cgns_zone *zone; - cgns_zconn *zconn; - cgns_hole *hole; - cgns_ptset *ptset; - char_33 PointSetName; - int index, set; - int i, index_dim; - - /* verify input */ - if (cgi_check_strlen(holename)) return CG_ERROR; - if (location != Vertex && location != CellCenter) { - cgi_error("cg_hole_write: GridLocation not Vertex or CellCenter"); - return CG_ERROR; - } - if (ptset_type!=PointList && ptset_type!=PointRange) { - cgi_error("Invalid input: ptset_type=%d ?",ptset_type); - return CG_ERROR; - } - if (!(ptset_type==PointRange && npnts==2*nptsets && nptsets>0) && - !(ptset_type==PointList && npnts>=0 && nptsets==1)) { - cgi_error("Invalid input: nptsets=%d, npoint=%d, point set type=%s", - nptsets, npnts, PointSetTypeName[ptset_type]); - return CG_ERROR; - } - /* get memory address for file */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - /* get memory address for zone */ - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return CG_ERROR; - - /* Allocate ZoneGridConnectivity data struct. if not already created */ - if (zone->zconn == 0) { - zone->zconn = CGNS_NEW(cgns_zconn, 1); - zconn = zone->zconn; - strcpy(zconn->name,"ZoneGridConnectivity"); - - /* initialize new ZoneGridConnectivity data structure */ - zconn->id = 0; - zconn->link= 0; - zconn->ndescr = 0; - zconn->n1to1 = 0; - zconn->nconns = 0; - zconn->nholes = 0; - zconn->nuser_data= 0; - } else zconn = zone->zconn; - - index_dim = zone->index_dim; - - /* Overwrite an OversetHoles_t Node: */ - for (index=0; indexnholes; index++) { - if (strcmp(holename, zconn->hole[index].name)==0) { - - /* in MODE_WRITE, children names must be unique */ - if (cg->mode==MODE_WRITE) { - cgi_error("Duplicate child name found: %s",holename); - return CG_ERROR; - } - - /* overwrite an existing Overset Hole */ - /* delete the existing Overset hole from file */ - if (cgi_delete_node(zconn->id, zconn->hole[index].id)) - return CG_ERROR; - /* save the old in-memory address to overwrite */ - hole = &(zconn->hole[index]); - cgi_free_hole(hole); - break; - } - } - /* ... or add an OversetHoles_t Node: */ - if (index==zconn->nholes) { - if (zconn->nholes == 0) { - zconn->hole = CGNS_NEW(cgns_hole, zconn->nholes+1); - } else { - zconn->hole = CGNS_RENEW(cgns_hole, zconn->nholes+1, zconn->hole); - } - hole = &(zconn->hole[zconn->nholes]); - zconn->nholes++; - } - (*I) = index+1; - - /* write hole info to internal memory */ - strcpy(hole->name,holename); - hole->location = location; - - hole->nptsets = nptsets; - hole->ptset = CGNS_NEW(cgns_ptset, nptsets); - for (set=0; setptset[set]; - ptset->type = ptset_type; - strcpy(ptset->data_type,"I4"); - if (ptset_type==PointRange) ptset->npts = 2; - else ptset->npts = npnts; - ptset->id = 0; - ptset->link = 0; - - /* Record the number of nodes or elements in the point set */ - if (ptset_type==PointList) - ptset->size_of_patch=npnts; - else if (ptset_type==PointRange) { - ptset->size_of_patch = 1; - for (i=0; isize_of_patch *= (pnts[i+index_dim]-pnts[i]+1); - } - } - - /* initialize */ - hole->id=0; - hole->link=0; - hole->ndescr=0; - hole->nuser_data=0; - - /* Create node ZoneGridConnectivity_t node, if not yet created */ - if (zconn->id==0) { - if (cgi_new_node(zone->id, "ZoneGridConnectivity", "ZoneGridConnectivity_t", - &zconn->id, "MT", 0, 0, 0)) return CG_ERROR; - } - if (cgi_new_node(zconn->id, hole->name, "OversetHoles_t", - &hole->id, "MT", 0, 0, 0)) return CG_ERROR; - - if (hole->location !=Vertex) { - double GL_id; - int length = strlen(GridLocationName[hole->location]); - if (cgi_new_node(hole->id, "GridLocation", "GridLocation_t", &GL_id, - "C1", 1, &length, GridLocationName[hole->location])) return CG_ERROR; - } - - for (set=0; setptset[set]; - - if (ptset->npts>0) { - /* Create Point Set node on disk */ - if (ptset->type==PointRange) - sprintf(PointSetName, "PointRange%d",set+1); - else - sprintf(PointSetName, PointSetTypeName[ptset->type]); - if (cgi_write_ptset(hole->id, PointSetName, ptset, index_dim, - (void *)((int *)pnts+2*index_dim*set))) return CG_ERROR; - } - } - - return CG_OK; -} - -int cg_conn_write(int file_number, int B, int Z, char const * connectname, GridLocation_t location, - GridConnectivityType_t type, PointSetType_t ptset_type, int npnts, int const * pnts, - char const * donorname, ZoneType_t donor_zonetype, PointSetType_t donor_ptset_type, - DataType_t donor_datatype, int ndata_donor, void const * donor_data, int *I) { - cgns_zone *zone; - cgns_zconn *zconn; - cgns_conn *conn; - cgns_ptset *dptset; - int i, size_of_zone, length; - int PointListSize, cell_dim; - int index, index_dim, index_dim_donor; - double GL_id, C_id; - - /* verify input */ - if (cgi_check_strlen(connectname)) return CG_ERROR; - if (cgi_check_strlen(donorname)) return CG_ERROR; - if (type <0 || type >= NofValidGridConnectivityTypes) { - cgi_error("Invalid input: GridConnectivityType=%d ?",type); - return CG_ERROR; - } - if (location != Vertex && location != CellCenter && - location != FaceCenter && location != IFaceCenter && - location != JFaceCenter && location != KFaceCenter) { - cgi_error("Invalid input: GridLocation=%d ?",location); - return CG_ERROR; - } - if (type == Overset && location != Vertex && location != CellCenter) { - cgi_error("GridLocation must be Vertex or CellCenter for Overset"); - return CG_ERROR; - } - if (ptset_type!=PointList && ptset_type!=PointRange) { - cgi_error("Invalid input: ptset_type=%d ?",ptset_type); - return CG_ERROR; - } - if (!(ptset_type==PointRange && npnts==2) && !(ptset_type==PointList && npnts>0)) { - cgi_error("Invalid input: npoint=%d, point set type=%s", - npnts, PointSetTypeName[ptset_type]); - return CG_ERROR; - } - if (donor_ptset_type!=CellListDonor && donor_ptset_type!=PointListDonor) { - cgi_error("Invalid point set type for donor %s",donorname); - return CG_ERROR; - } - if (donor_datatype != Integer) { - cgi_error("Invalid datatype for donor %s",donorname); - return CG_ERROR; - } -/* - if (donor_zonetype==Unstructured && (donor_ptset_type!=CellListDonor && - donor_ptset_type!=PointListDonor)) { - cgi_error("Invalid point set type for Unstructured donor %s",donorname); - return CG_ERROR; - } - if (donor_zonetype==Unstructured && donor_datatype != Integer) { - cgi_error("Invalid datatype for Unstructured donor %s",donorname); - return CG_ERROR; - } - if (donor_zonetype==Structured && donor_ptset_type!=PointListDonor) { - cgi_error("Invalid point set type for Structured donor %s",donorname); - return CG_ERROR; - } - if (donor_datatype!=RealSingle && donor_datatype!=Integer && - donor_datatype!=RealDouble) { - cgi_error("Invalid data type for donor_data: %d",donor_datatype); - return CG_ERROR; - } -*/ - - /* get memory address of file */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - /* get memory address of zone */ - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return CG_ERROR; - - if ((location == IFaceCenter || location == JFaceCenter || - location == KFaceCenter) && zone->type != Structured) { - cgi_error("GridLocation [IJK]FaceCenter only valid for Structured grids"); - return CG_ERROR; - } - - /* Allocate ZoneGridConnectivity data struct. if not already created */ - if (zone->zconn == 0) { - zone->zconn = CGNS_NEW(cgns_zconn, 1); - zconn = zone->zconn; - strcpy(zconn->name,"ZoneGridConnectivity"); - - /* initialize new ZoneGridConnectivity data structure */ - zconn->id = 0; - zconn->link= 0; - zconn->ndescr = 0; - zconn->n1to1 = 0; - zconn->nconns = 0; - zconn->nholes = 0; - zconn->nuser_data= 0; - } else zconn = zone->zconn; - - /* IndexDimension & CellDimension */ - index_dim = zone->index_dim; - cell_dim=cg->base[B-1].cell_dim; - - /* verify input */ - size_of_zone = 1; - for (i=0; inijk[i]; - if (npnts<0 || npnts>size_of_zone) { - cgi_error("Inconsistent number of points in point set"); - return CG_ERROR; - } -#if 0 /* causes problems when grid is unstructured */ - if (ptset_type==PointRange) { - if (location == Vertex) { - for (i=0; izone->nijk[i]) { - cgi_error("Invalid input range: %d->%d",pnts[i], pnts[i+index_dim]); - return CG_ERROR; - } - } - } else if (location == CellCenter) { - for (i=0; izone->nijk[i+index_dim]) { - cgi_error("Invalid input range: %d->%d",pnts[i], pnts[i+index_dim]); - return CG_ERROR; - } - } - } - } -#endif - - /* Compute PointListSize */ - if (ptset_type==PointRange) { - PointListSize = 1; - for (i=0; inconns; index++) { - if (strcmp(connectname, zconn->conn[index].name)==0) { - - /* in MODE_WRITE, children names must be unique */ - if (cg->mode==MODE_WRITE) { - cgi_error("Duplicate child name found: %s",connectname); - return CG_ERROR; - } - - /* overwrite an existing GridConnectivity_t Node */ - /* delete the existing GridConnectivity_t Node from file */ - if (cgi_delete_node(zconn->id, zconn->conn[index].id)) - return CG_ERROR; - /* save the old in-memory address to overwrite */ - conn = &(zconn->conn[index]); - cgi_free_conn(conn); - break; - } - } - /* ... or add a GridConnectivity_t Node: */ - if (index==zconn->nconns) { - if (zconn->nconns == 0) { - zconn->conn = CGNS_NEW(cgns_conn, zconn->nconns+1); - } else { - zconn->conn = CGNS_RENEW(cgns_conn, zconn->nconns+1, zconn->conn); - } - conn = &(zconn->conn[zconn->nconns]); - zconn->nconns++; - } - (*I) = index+1; - - /* write conn info to internal memory */ - strcpy(conn->name,connectname); - conn->type = type; - conn->location = location; - conn->ptset.id = 0; - conn->ptset.link = 0; - conn->ptset.type = ptset_type; - strcpy(conn->ptset.data_type,"I4"); - conn->ptset.npts = npnts; - conn->ptset.size_of_patch = PointListSize; - - /* ... initialize: */ - conn->id=0; - conn->link=0; - conn->ndescr=0; - conn->ordinal=0; - conn->nuser_data=0; - conn->cprop=0; - - /* ... donor: */ - strcpy(conn->donor,donorname); - conn->interpolants = 0; - dptset = &conn->dptset; - dptset->id = 0; - dptset->link = 0; - strcpy(dptset->name,PointSetTypeName[donor_ptset_type]); - dptset->type = donor_ptset_type; - strcpy(dptset->data_type, cgi_adf_datatype(donor_datatype)); - dptset->npts = ndata_donor; - dptset->size_of_patch = ndata_donor; - - /* Create node ZoneGridConnectivity_t node, if not yet created */ - if (zconn->id==0) { - if (cgi_new_node(zone->id, "ZoneGridConnectivity", "ZoneGridConnectivity_t", - &zconn->id, "MT", 0, 0, 0)) return CG_ERROR; - } - /* Create node GridConnectivity_t node */ - length = strlen(conn->donor); - if (cgi_new_node(zconn->id, conn->name, "GridConnectivity_t", &conn->id, - "C1", 1, &length, conn->donor)) return CG_ERROR; - - /* Create node GridConnectivityType_t */ - length = strlen(GridConnectivityTypeName[conn->type]); - if (cgi_new_node(conn->id,"GridConnectivityType","GridConnectivityType_t", - &C_id, "C1", 1, &length, GridConnectivityTypeName[conn->type])) return CG_ERROR; - - /* write GridLocation */ - if (conn->location != Vertex) { - length = strlen(GridLocationName[conn->location]); - if (cgi_new_node(conn->id, "GridLocation", "GridLocation_t", &GL_id, - "C1", 1, &length, GridLocationName[conn->location])) return CG_ERROR; - } - - /* Write Point Sets to disk */ - if (npnts>0) { - char_33 PointSetName; - strcpy (PointSetName, PointSetTypeName[conn->ptset.type]); - if (cgi_write_ptset(conn->id, PointSetName, &conn->ptset, index_dim, - (void *)pnts)) return CG_ERROR; - - /* Write pointset of donor */ - if (donor_zonetype==Structured) - index_dim_donor = cell_dim; - else - index_dim_donor=1; - strcpy (PointSetName, PointSetTypeName[donor_ptset_type]); - if (cgi_write_ptset(conn->id, PointSetName, dptset, index_dim_donor, - (void *)donor_data)) return CG_ERROR; - } - return CG_OK; -} - -int cg_conn_average_write(int file_number, int B, int Z, int I, - AverageInterfaceType_t AverageInterfaceType) { - - cgns_cprop *cprop; - cgns_caverage *caverage; - cgns_conn *conn; - int length; - double dummy_id; - - /* verify input */ - if (AverageInterfaceType<0 || AverageInterfaceType>=NofValidAverageInterfaceTypes) { - cgi_error("Invalid AverageInterfaceType: %d",AverageInterfaceType); - return CG_ERROR; - } - - /* get memory address of file */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - /* get memory address of GridConnectivity_t node */ - conn = cgi_get_conn(cg, B, Z, I); - if (conn==0) return CG_ERROR; - - /* Allocate GridConnectivityProperty_t data struct. if not already created */ - if (conn->cprop == 0) { - conn->cprop = CGNS_NEW(cgns_cprop, 1); - cprop = conn->cprop; - strcpy(cprop->name,"GridConnectivityProperty"); - cprop->id=0; - cprop->link=0; - cprop->ndescr=0; - cprop->nuser_data=0; - cprop->cperio=0; - cprop->caverage=0; - } else cprop = conn->cprop; - - /* Overwrite an AverageInterface_t Node: */ - if (cprop->caverage) { - /* in MODE_WRITE, children names must be unique */ - if (cg->mode==MODE_WRITE) { - cgi_error("AverageInterface_t already defined under GridConnectivityProperty_t"); - return CG_ERROR; - } - - /* overwrite an existing AverageInterface_t Node */ - /* delete the existing AverageInterface_t Node from file */ - if (cgi_delete_node(cprop->id, cprop->caverage->id)) - return CG_ERROR; - cgi_free_caverage(cprop->caverage); - } else - cprop->caverage = CGNS_NEW(cgns_caverage, 1); - caverage = cprop->caverage; - - /* write caverage info to internal memory */ - caverage->type = AverageInterfaceType; - - /* initialize other fields */ - strcpy(caverage->name,"AverageInterface"); - caverage->id = 0; - caverage->link = 0; - caverage->ndescr = 0; - caverage->nuser_data = 0; - - /* Create GridConnectivityProperty_t node if it doesn't yet exist */ - if (cprop->id==0) { - if (cgi_new_node(conn->id, "GridConnectivityProperty", - "GridConnectivityProperty_t", &cprop->id, "MT", 0, 0, 0)) return CG_ERROR; - } - /* Create the AverageInterface_t Node */ - if (cgi_new_node(cprop->id, "AverageInterface", "AverageInterface_t", - &caverage->id, "MT", 0, 0, 0)) return CG_ERROR; - - /* AverageInterface_t/AverageInterfaceType_t */ - length = strlen(AverageInterfaceTypeName[caverage->type]); - if (cgi_new_node(caverage->id, "AverageInterfaceType", "AverageInterfaceType_t", &dummy_id, - "C1", 1, &length, (void *)AverageInterfaceTypeName[caverage->type])) return CG_ERROR; - return CG_OK; -} - -int cg_conn_periodic_write(int file_number, int B, int Z, int I, - float const *RotationCenter, float const *RotationAngle, - float const *Translation) { - cgns_base *base; - cgns_conn *conn; - cgns_cprop *cprop; - cgns_cperio *cperio; - int n; - - /* get memory address of file */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - /* get memory address for base */ - base = cgi_get_base(cg, B); - if (base==0) return CG_ERROR; - - /* get memory address of GridConnectivity_t node */ - conn = cgi_get_conn(cg, B, Z, I); - if (conn==0) return CG_ERROR; - - /* Allocate GridConnectivityProperty_t data struct. if not already created */ - if (conn->cprop == 0) { - conn->cprop = CGNS_NEW(cgns_cprop, 1); - cprop = conn->cprop; - strcpy(cprop->name,"GridConnectivityProperty"); - cprop->id=0; - cprop->link=0; - cprop->ndescr=0; - cprop->nuser_data=0; - cprop->cperio=0; - cprop->caverage=0; - } else cprop = conn->cprop; - - /* Overwrite a Periodic_t Node: */ - if (cprop->cperio) { - /* in MODE_WRITE, children names must be unique */ - if (cg->mode==MODE_WRITE) { - cgi_error("Periodic_t already defined under GridConnectivityProperty_t."); - return CG_ERROR; - } - - /* overwrite an existing Periodic_t Node */ - /* delete the existing Periodic_t Node from file */ - if (cgi_delete_node(cprop->id, cprop->cperio->id)) - return CG_ERROR; - cgi_free_cperio(cprop->cperio); - } else - cprop->cperio = CGNS_NEW(cgns_cperio, 1); - cperio = cprop->cperio; - - /* write cperio info to internal memory */ - strcpy(cperio->name,"Periodic"); - cperio->id = 0; - cperio->link = 0; - cperio->ndescr = 0; - cperio->nuser_data = 0; - cperio->narrays = 3; - cperio->data_class=DataClassNull; - cperio->units=0; - - /* Create DataArray_t RotationCenter, RotationAngle, & Translation under Periodic_t */ - cperio->array = CGNS_NEW(cgns_array, 3); - - for (n=0; nnarrays; n++) { - strcpy(cperio->array[n].data_type, "R4"); - cperio->array[n].data = (void *)malloc(base->phys_dim*sizeof(float)); - if (!cperio->array[n].data) { - cgi_error("Error allocating cperio->array[n].data"); - return CG_ERROR; - } - cperio->array[n].data_dim=1; - cperio->array[n].dim_vals[0]=base->phys_dim; - cperio->array[n].id=0; - cperio->array[n].link=0; - cperio->array[n].ndescr=0; - cperio->array[n].data_class=DataClassNull; - cperio->array[n].units=0; - cperio->array[n].exponents=0; - cperio->array[n].convert=0; - } - memcpy(cperio->array[0].data,RotationCenter,base->phys_dim*sizeof(float)); - memcpy(cperio->array[1].data,RotationAngle,base->phys_dim*sizeof(float)); - memcpy(cperio->array[2].data,Translation,base->phys_dim*sizeof(float)); - strcpy(cperio->array[0].name,"RotationCenter"); - strcpy(cperio->array[1].name,"RotationAngle"); - strcpy(cperio->array[2].name,"Translation"); - - /* Create GridConnectivityProperty_t node if it doesn't yet exist */ - if (cprop->id==0) { - if (cgi_new_node(conn->id, "GridConnectivityProperty", - "GridConnectivityProperty_t", &cprop->id, "MT", 0, 0, 0)) return CG_ERROR; - } - /* Create the Periodic_t Node */ - if (cgi_new_node(cprop->id, "Periodic", "Periodic_t", - &cperio->id, "MT", 0, 0, 0)) return CG_ERROR; - - /* Periodic_t/DataArray_t: RotationCenter, RotationAngle, Translation */ - for (n=0; nnarrays; n++) - if (cgi_write_array(cperio->id, &cperio->array[n])) return CG_ERROR; - return CG_OK; -} - -int cg_1to1_write(int file_number, int B, int Z, char const * connectname, char const * donorname, - int const * range, int const * donor_range, int const * transform, int *I) { - cgns_zone *zone; - cgns_zconn *zconn; - cgns_1to1 *one21; - int index, i, j, index_dim, length; - double T_id; - - /* verify input */ - if (cgi_check_strlen(connectname)) return CG_ERROR; - if (cgi_check_strlen(donorname)) return CG_ERROR; - - /* get memory address of file */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - /* get memory address of zone */ - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return CG_ERROR; - - /* Allocate ZoneGridConnectivity data struct. if not already created */ - if (zone->zconn == 0) { - zone->zconn = CGNS_NEW(cgns_zconn, 1); - zconn = zone->zconn; - strcpy(zconn->name,"ZoneGridConnectivity"); - - /* initialize new ZoneGridConnectivity data structure */ - zconn->id = 0; - zconn->link= 0; - zconn->ndescr = 0; - zconn->n1to1 = 0; - zconn->nconns = 0; - zconn->nholes = 0; - zconn->nuser_data= 0; - - } else zconn = zone->zconn; - - /* verify input */ - index_dim = zone->index_dim; - for (i=0; izone->nijk[i]) { - cgi_error("Invalid input range: %d->%d",range[i], range[i+index_dim]); - return CG_ERROR; - } - if (abs(transform[i])<0 || abs(transform[i])>index_dim) { - cgi_error("Invalid transformation index: %d. The indices must all be between 1 and %d",i, index_dim); - return CG_ERROR; - } - if (abs(transform[i])>0) { - j = abs(transform[i])-1; - if (abs(range[i+index_dim]-range[i])-abs(donor_range[j+index_dim]-donor_range[j]) != 0) { - cgi_error("Invalid input: range = %d->%d and donor_range = %d->%d", - range[i], range[i+index_dim], donor_range[j], donor_range[j+index_dim]); - return CG_ERROR; - } - } - } - - /* Overwrite a GridConnectivity1to1_t Node: */ - for (index=0; indexn1to1; index++) { - if (strcmp(connectname, zconn->one21[index].name)==0) { - - /* in MODE_WRITE, children names must be unique */ - if (cg->mode==MODE_WRITE) { - cgi_error("Duplicate child name found: %s",connectname); - return CG_ERROR; - } - - /* overwrite an existing GridConnectivity1to1_t Node */ - /* delete the existing GridConnectivity1to1_t Node from file */ - if (cgi_delete_node(zconn->id, zconn->one21[index].id)) - return CG_ERROR; - /* save the old in-memory address to overwrite */ - one21 = &(zconn->one21[index]); - /* free memory */ - cgi_free_1to1(one21); - break; - } - } - /* ... or add a GridConnectivity1to1_t Node: */ - if (index==zconn->n1to1) { - if (zconn->n1to1 == 0) { - zconn->one21 = CGNS_NEW(cgns_1to1, zconn->n1to1+1); - } else { - zconn->one21 = CGNS_RENEW(cgns_1to1, zconn->n1to1+1, zconn->one21); - } - one21 = &(zconn->one21[zconn->n1to1]); - zconn->n1to1++; - } - (*I) = index+1; - - /* allocate memory */ - if ((one21->transform = (int *)malloc(index_dim*sizeof(int)))==NULL) { - cgi_error("Error allocating memory in cg_1to1_write"); - return CG_ERROR; - } - - /* write 1to1 info to internal memory */ - strcpy(one21->name,connectname); - one21->ptset.type = PointRange; - strcpy(one21->ptset.data_type,"I4"); - one21->ptset.npts = 2; - - /* ... donor: */ - strcpy(one21->donor,donorname); - one21->dptset.type = PointRangeDonor; - strcpy(one21->dptset.data_type,"I4"); - one21->dptset.npts = 2; - - /* ... transform: */ - memcpy((void *)one21->transform, (void *)transform, index_dim*sizeof(int)); - - /* ... initialize: */ - one21->ptset.id=0; - one21->ptset.link=0; - one21->dptset.id=0; - one21->dptset.link=0; - one21->id = 0; - one21->link=0; - one21->ndescr=0; - one21->ordinal=0; - one21->nuser_data=0; - - /* Create node ZoneGridConnectivity_t node, if not yet created */ - if (zconn->id==0) { - if (cgi_new_node(zone->id, "ZoneGridConnectivity", "ZoneGridConnectivity_t", - &zconn->id, "MT", 0, 0, 0)) return CG_ERROR; - } - - /* Create the node */ - length = strlen(one21->donor); - if (cgi_new_node(zconn->id, one21->name, "GridConnectivity1to1_t", - &one21->id, "C1", 1, &length, one21->donor)) return CG_ERROR; - - /* Create transform node */ - if (cgi_new_node(one21->id, "Transform", "\"int[IndexDimension]\"", &T_id, - "I4", 1, &index_dim, (void *)one21->transform)) return CG_ERROR; - - /* Create RECEIVER Point Set node on disk */ - if (cgi_write_ptset(one21->id, "PointRange", &one21->ptset, index_dim, - (void *)range)) return CG_ERROR; - - /* Create DONOR Point Set node on disk */ - if (cgi_write_ptset(one21->id, "PointRangeDonor", &one21->dptset, index_dim, - (void *)donor_range)) return CG_ERROR; - - return CG_OK; -} - -int cg_boco_write(int file_number, int B, int Z, char const * boconame, BCType_t bocotype, - PointSetType_t ptset_type, int npnts, int const * pnts, int *BC) { - cgns_zone *zone; - cgns_zboco *zboco; - cgns_boco *boco; - int index, i, index_dim, length; - - /* verify input */ -#if 0 /* re-enable ElementList/ElementRange */ - if (ptset_type!= PointList && ptset_type!=PointRange) { - cgi_error("Invalid point set type: %d...?",ptset_type); - return CG_ERROR; - } - if (!(ptset_type==PointRange && npnts==2) && !(ptset_type==PointList && npnts>0)) { - cgi_error("Invalid input: npoint=%d, point set type=%s", - npnts, PointSetTypeName[ptset_type]); - return CG_ERROR; - } -#else - if (ptset_type == PointList || ptset_type == ElementList) { - if (npnts <= 0) { - cgi_error("Invalid input: npoint=%d, point set type=%s", - npnts, PointSetTypeName[ptset_type]); - return CG_ERROR; - } - } else if (ptset_type == PointRange || ptset_type == ElementRange) { - if (npnts != 2) { - cgi_error("Invalid input: npoint=%d, point set type=%s", - npnts, PointSetTypeName[ptset_type]); - return CG_ERROR; - } - } else { - cgi_error("Invalid point set type: %d...?",ptset_type); - return CG_ERROR; - } -#endif - if (bocotype<0 || bocotype>=NofValidBCTypes) { - cgi_error("Invalid BCType: %d",bocotype); - return CG_ERROR; - } - if (cgi_check_strlen(boconame)) return CG_ERROR; - - /* get memory address of file */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - /* get memory address of zone */ - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return CG_ERROR; - - /* Allocate ZoneBC data struct. if not already created */ - if (zone->zboco == 0) { - zone->zboco = CGNS_NEW(cgns_zboco, 1); - zboco = zone->zboco; - strcpy(zboco->name,"ZoneBC"); - zboco->id=0; - zboco->link=0; - zboco->ndescr=0; - zboco->nbocos=0; - zboco->state=0; - zboco->data_class=DataClassNull; - zboco->units=0; - zboco->nuser_data=0; - } else zboco = zone->zboco; - - /* verify input */ - index_dim = zone->index_dim; -#if 0 - if (ptset_type==PointRange) { - for (i=0; izone->nijk[i]) { - cgi_error("Invalid input range: %d->%d",pnts[i], pnts[i+index_dim]); - return CG_ERROR; - } - } - } -#endif - - /* Overwrite a BC_t Node: */ - for (index=0; indexnbocos; index++) { - if (strcmp(boconame, zboco->boco[index].name)==0) { - - /* in MODE_WRITE, children names must be unique */ - if (cg->mode==MODE_WRITE) { - cgi_error("Duplicate child name found: %s",boconame); - return CG_ERROR; - } - - /* overwrite an existing BC_t Node */ - /* delete the existing BC_t Node from file */ - if (cgi_delete_node(zboco->id, zboco->boco[index].id)) - return CG_ERROR; - /* save the old in-memory address to overwrite */ - boco = &(zboco->boco[index]); - cgi_free_boco(boco); - break; - } - } - /* ... or add a BC_t Node: */ - if (index==zboco->nbocos) { - if (zboco->nbocos == 0) { - zboco->boco = CGNS_NEW(cgns_boco, zboco->nbocos+1); - } else { - zboco->boco = CGNS_RENEW(cgns_boco, zboco->nbocos+1, zboco->boco); - } - boco = &(zboco->boco[zboco->nbocos]); - zboco->nbocos++; - } - (*BC) = index+1; - - /* write boco info to internal memory */ - strcpy(boco->name,boconame); - boco->type = bocotype; - boco->ptset = CGNS_NEW(cgns_ptset,1); - boco->ptset->type = ptset_type; - strcpy(boco->ptset->data_type,"I4"); - boco->ptset->npts = npnts; - - /* Record the number of nodes or elements in the point set */ -#if 0 /* re-enable ElementList/ElementRange */ - if (ptset_type==PointList) boco->ptset->size_of_patch=npnts; - else if (ptset_type==PointRange) { - boco->ptset->size_of_patch = 1; - for (i=0; iptset->size_of_patch = boco->ptset->size_of_patch * (pnts[i+index_dim]-pnts[i]+1); - } -#else - if (ptset_type == PointList || ptset_type == ElementList) - boco->ptset->size_of_patch=npnts; - else { - boco->ptset->size_of_patch = 1; - for (i=0; iptset->size_of_patch = boco->ptset->size_of_patch * (pnts[i+index_dim]-pnts[i]+1); - } -#endif - - /* ... initialize: */ - boco->normal = 0; - boco->Nindex = 0; - boco->id=0; - boco->link = 0; - boco->location = Vertex; - boco->ptset->id = 0; - boco->ptset->link = 0; - boco->ndescr = 0; - boco->ndataset = 0; - boco->state = 0; - boco->data_class = DataClassNull; - boco->units = 0; - boco->ordinal = 0; - boco->family_name[0]='\0'; - boco->nuser_data = 0; - boco->bprop = 0; - - /* Create ZoneBC_t node if it doesn't yet exist */ - if (zboco->id==0) { - if (cgi_new_node(zone->id, "ZoneBC", "ZoneBC_t", - &zboco->id, "MT", 0, 0, 0)) return CG_ERROR; - } - /* Create the BC_t Node */ - length = strlen(BCTypeName[boco->type]); - if (cgi_new_node(zboco->id, boco->name, "BC_t", &boco->id, "C1", 1, - &length, BCTypeName[boco->type])) return CG_ERROR; - - /* Save Point-Set on Disk */ - if (npnts>0) { - char_33 PointSetName; - strcpy(PointSetName, PointSetTypeName[boco->ptset->type]); - if (cgi_write_ptset(boco->id, PointSetName, boco->ptset, index_dim, - (void *)pnts)) return CG_ERROR; - } - - return CG_OK; -} - -int cg_boco_normal_write(int file_number, int B, int Z, int BC, int const * NormalIndex, - int NormalListFlag, DataType_t NormalDataType, void const * NormalList) { - cgns_boco *boco; - int npnts, n, index_dim, phys_dim; - - /* get memory address of file */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - boco = cgi_get_boco(cg, B, Z, BC); - if (boco==0) return CG_ERROR; - npnts = boco->ptset->size_of_patch; - - phys_dim=cg->base[B-1].phys_dim; - - if (NormalListFlag && npnts) { - cgns_array *normal; - - if (boco->normal) { - if (cg->mode==MODE_WRITE) { - cgi_error("InwardNormalList is already defined under BC_t '%s'", - boco->name); - return CG_ERROR; - } - if (cgi_delete_node(boco->id, boco->normal->id)) - return CG_ERROR; - cgi_free_array(boco->normal); - } else - boco->normal = CGNS_NEW(cgns_array, 1); - normal = boco->normal; - - strcpy(normal->data_type, cgi_adf_datatype(NormalDataType)); - normal->data = (void *)malloc(npnts*phys_dim*size_of(normal->data_type)); - if (!normal->data) { - cgi_error("Error allocating normal->data"); - return CG_ERROR; - } - memcpy(normal->data, NormalList, npnts*phys_dim*size_of(normal->data_type)); - strcpy(normal->name, "InwardNormalList"); - normal->data_dim =2; - normal->dim_vals[0]=phys_dim; - normal->dim_vals[1]=npnts; - - /* initialize other fields */ - normal->id=0; - normal->link=0; - normal->ndescr=0; - normal->data_class=DataClassNull; - normal->units=0; - normal->exponents=0; - normal->convert=0; - - if (cgi_new_node(boco->id, "InwardNormalList", "IndexArray_t", - &normal->id, normal->data_type, 2, normal->dim_vals, - (void *)normal->data)) return CG_ERROR; - } - if (boco->Nindex) { - if (cg->mode==MODE_WRITE) { - cgi_error("InwardNormalIndex is already defined under BC_t '%s'", - boco->name); - return CG_ERROR; - } else { - if (cgi_delete_node(boco->id, boco->index_id)) - return CG_ERROR; - free(boco->Nindex); - } - } - index_dim=cg->base[B-1].zone[Z-1].index_dim; - boco->Nindex = CGNS_NEW(int, index_dim); - for (n=0; nNindex[n]=NormalIndex[n]; - - if (cgi_new_node(boco->id, "InwardNormalIndex", "\"int[IndexDimension]\"", - &boco->index_id, "I4", 1, &index_dim, (void *)NormalIndex)) return CG_ERROR; - - return CG_OK; -} - -int cg_dataset_write(int file_number, int B, int Z, int BC, char const * name, - BCType_t BCType, int *Dset) { - - cgns_boco *boco; - cgns_dataset *dataset; - int index, length; - - /* verify input */ - if (BCType<0 || BCType>=NofValidBCTypes) { - cgi_error("Invalid BCType: %d",BCType); - return CG_ERROR; - } - if (cgi_check_strlen(name)) return CG_ERROR; - - /* get memory address of file */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - boco = cgi_get_boco(cg, B, Z, BC); - if (boco==0) return CG_ERROR; - - /* Overwrite a BCDataSet_t node : */ - for (index=0; indexndataset; index++) { - if (strcmp(name, boco->dataset[index].name)==0) { - - /* in MODE_WRITE, children names must be unique */ - if (cg->mode==MODE_WRITE) { - cgi_error("Duplicate child name found: %s",name); - return CG_ERROR; - } - - /* overwrite an existing solution */ - /* delete the existing dataset from file */ - if (cgi_delete_node(boco->id, boco->dataset[index].id)) - return CG_ERROR; - /* save the old in-memory address to overwrite */ - dataset = &(boco->dataset[index]); - /* free memory */ - cgi_free_dataset(dataset); - break; - } - } - /* ... or add a BCDataSet_t Node: */ - if (index==boco->ndataset) { - if (boco->ndataset == 0) - boco->dataset = CGNS_NEW(cgns_dataset, boco->ndataset+1); - else - boco->dataset= CGNS_RENEW(cgns_dataset, boco->ndataset+1, boco->dataset); - dataset= &boco->dataset[boco->ndataset]; - boco->ndataset++; - } - (*Dset) = index+1; - - /* save data in memory */ - dataset->type = BCType; - strcpy(dataset->name, name); - - /* initialize other fields */ - dataset->id = 0; - dataset->link=0; - dataset->ndescr=0; - dataset->dirichlet=0; - dataset->neumann=0; - dataset->state=0; - dataset->data_class=DataClassNull; - dataset->units=0; - dataset->nuser_data=0; - - /* save data in file */ - length = strlen(BCTypeName[dataset->type]); - if (cgi_new_node(boco->id, dataset->name, "BCDataSet_t", &dataset->id, - "C1", 1, &length, (void *)BCTypeName[dataset->type])) return CG_ERROR; - return CG_OK; -} - -int cg_bcdata_write(int file_number, int B, int Z, int BC, int Dset, - BCDataType_t BCDataType) { - - cgns_dataset *dataset; - cgns_bcdata *bcdata; - - /* verify input */ - if (BCDataType<0 || BCDataType>=NofValidBCDataTypes) { - cgi_error("BCDataType %d not valid",BCDataType); - return CG_ERROR; - } - - /* get memory address of file */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - dataset = cgi_get_dataset(cg, B, Z, BC, Dset); - if (dataset==0) return CG_ERROR; - - if (BCDataType==Dirichlet) { - if (dataset->dirichlet) { - if (cg->mode == MODE_WRITE) { - cgi_error("Dirichlet data already defined under BCDataSet_t '%s'", - dataset->name); - return CG_ERROR; - } - if (cgi_delete_node(dataset->id, dataset->dirichlet->id)) - return CG_ERROR; - cgi_free_bcdata(dataset->dirichlet); - } else - dataset->dirichlet = CGNS_NEW(cgns_bcdata,1); - strcpy(dataset->dirichlet->name, "DirichletData"); - bcdata = dataset->dirichlet; - } else { - if (dataset->neumann) { - if (cg->mode == MODE_WRITE) { - cgi_error("Neumann data already defined under BCDataSet_t '%s'", - dataset->name); - return CG_ERROR; - } - if (cgi_delete_node(dataset->id, dataset->neumann->id)) - return CG_ERROR; - cgi_free_bcdata(dataset->neumann); - } else - dataset->neumann = CGNS_NEW(cgns_bcdata,1); - strcpy(dataset->neumann->name, "NeumannData"); - bcdata = dataset->neumann; - } - - /* initialize other fields */ - bcdata->id = 0; - bcdata->link=0; - bcdata->ndescr=0; - bcdata->data_class=DataClassNull; - bcdata->units=0; - bcdata->narrays=0; - bcdata->nuser_data=0; - - if (cgi_new_node(dataset->id, bcdata->name, "BCData_t", &bcdata->id, - "MT", 0, 0, 0)) return CG_ERROR; - return CG_OK; -} - -int cg_bc_wallfunction_write(int file_number, int B, int Z, int BC, - WallFunctionType_t WallFunctionType) { - - cgns_bprop *bprop; - cgns_bcwall *bcwall; - cgns_boco *boco; - int length; - double dummy_id; - - /* verify input */ - if (WallFunctionType<0 || WallFunctionType>=NofValidWallFunctionTypes) { - cgi_error("Invalid WallFunctionType: %d",WallFunctionType); - return CG_ERROR; - } - - /* get memory address of file */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - /* get memory address of BC_t node */ - boco = cgi_get_boco(cg, B, Z, BC); - if (boco==0) return CG_ERROR; - - /* Allocate BCProperty_t data struct. if not already created */ - if (boco->bprop == 0) { - boco->bprop = CGNS_NEW(cgns_bprop, 1); - bprop = boco->bprop; - strcpy(bprop->name,"BCProperty"); - bprop->id=0; - bprop->link=0; - bprop->ndescr=0; - bprop->nuser_data=0; - bprop->bcarea=0; - bprop->bcwall=0; - } else bprop = boco->bprop; - - /* Overwrite a WallFunction_t Node: */ - if (bprop->bcwall) { - /* in MODE_WRITE, children names must be unique */ - if (cg->mode==MODE_WRITE) { - cgi_error("WallFunction_t already defined under BCProperty_t."); - return CG_ERROR; - } - - /* overwrite an existing WallFunction_t Node */ - /* delete the existing WallFunction_t Node from file */ - if (cgi_delete_node(bprop->id, bprop->bcwall->id)) - return CG_ERROR; - cgi_free_bcwall(bprop->bcwall); - } else - bprop->bcwall = CGNS_NEW(cgns_bcwall, 1); - bcwall = bprop->bcwall; - - /* write bcwall info to internal memory */ - bcwall->type = WallFunctionType; - - /* initialize other fields */ - strcpy(bcwall->name,"WallFunction"); - bcwall->id = 0; - bcwall->link = 0; - bcwall->ndescr = 0; - bcwall->nuser_data = 0; - - /* Create BCProperty_t node if it doesn't yet exist */ - if (bprop->id==0) { - if (cgi_new_node(boco->id, "BCProperty", "BCProperty_t", - &bprop->id, "MT", 0, 0, 0)) return CG_ERROR; - } - - /* Create the WallFunction_t Node */ - if (cgi_new_node(bprop->id, "WallFunction", "WallFunction_t", - &bcwall->id, "MT", 0, 0, 0)) return CG_ERROR; - - /* WallFunction_t/WallFunctionType_t */ - length = strlen(WallFunctionTypeName[bcwall->type]); - if (cgi_new_node(bcwall->id, "WallFunctionType", "WallFunctionType_t", &dummy_id, - "C1", 1, &length, (void *)WallFunctionTypeName[bcwall->type])) return CG_ERROR; - - return CG_OK; -} - - -int cg_bc_area_write(int file_number, int B, int Z, int BC, - AreaType_t AreaType, float SurfaceArea, char const *RegionName) { - cgns_boco *boco; - cgns_bprop *bprop; - cgns_bcarea *bcarea; - int n, len; - char *RegionName32; - double dummy_id; - - /* verify input */ - if (AreaType<0 || AreaType>=NofValidAreaTypes) { - cgi_error("Invalid AreaType: %d",AreaType); - return CG_ERROR; - } - - /* get memory address of file */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - /* get memory address of BC_t node */ - boco = cgi_get_boco(cg, B, Z, BC); - if (boco==0) return CG_ERROR; - - /* Allocate BCProperty_t data struct. if not already created */ - if (boco->bprop == 0) { - boco->bprop = CGNS_NEW(cgns_bprop, 1); - bprop = boco->bprop; - strcpy(bprop->name,"BCProperty"); - bprop->id=0; - bprop->link=0; - bprop->ndescr=0; - bprop->nuser_data=0; - bprop->bcarea=0; - bprop->bcwall=0; - } else bprop = boco->bprop; - - /* Overwrite a Area_t Node: */ - if (bprop->bcarea) { - /* in MODE_WRITE, children names must be unique */ - if (cg->mode==MODE_WRITE) { - cgi_error("Area_t already defined under BCProperty_t."); - return CG_ERROR; - } - - /* overwrite an existing Area_t Node */ - /* delete the existing Area_t Node from file */ - if (cgi_delete_node(bprop->id, bprop->bcarea->id)) - return CG_ERROR; - cgi_free_bcarea(bprop->bcarea); - } else - bprop->bcarea = CGNS_NEW(cgns_bcarea, 1); - bcarea = bprop->bcarea; - - /* write bcarea info to internal memory */ - bcarea->type = AreaType; - /* initialize other fields */ - strcpy(bcarea->name,"Area"); - bcarea->id = 0; - bcarea->link = 0; - bcarea->ndescr = 0; - bcarea->nuser_data = 0; - bcarea->narrays = 2; - - /* Create DataArray_t SurfaceArea & RegionName under Area_t */ - bcarea->array = CGNS_NEW(cgns_array, 2); - - strcpy(bcarea->array[0].data_type, "R4"); - bcarea->array[0].data = (void *)malloc(sizeof(float)); - if (!bcarea->array[0].data) { - cgi_error("Error allocating bcarea->array[0].data"); - return CG_ERROR; - } - memcpy(bcarea->array[0].data, &SurfaceArea, sizeof(float)); - /* *((float *)bcarea->array[0].data) = SurfaceArea; */ - strcpy(bcarea->array[0].name, "SurfaceArea"); - bcarea->array[0].data_dim=1; - bcarea->array[0].dim_vals[0]=1; - - strcpy(bcarea->array[1].data_type, "C1"); - bcarea->array[1].data = (void *)malloc(32*sizeof(char)); - if (!bcarea->array[1].data) { - cgi_error("Error allocating bcarea->array[1].data"); - return CG_ERROR; - } - - /* check length of RegionName and fill in with blanks */ - RegionName32 = (char *)bcarea->array[1].data; - len = strlen(RegionName); - for (n=0; narray[1].name, "RegionName"); - bcarea->array[1].data_dim=1; - bcarea->array[1].dim_vals[0]=32; - - /* initialize other fields of bcarea->array[n] */ - for (n=0; nnarrays; n++) { - bcarea->array[n].id=0; - bcarea->array[n].link=0; - bcarea->array[n].ndescr=0; - bcarea->array[n].data_class=DataClassNull; - bcarea->array[n].units=0; - bcarea->array[n].exponents=0; - bcarea->array[n].convert=0; - } - - /* Create BCProperty_t node if it doesn't yet exist */ - if (bprop->id==0) { - if (cgi_new_node(boco->id, "BCProperty", "BCProperty_t", - &bprop->id, "MT", 0, 0, 0)) return CG_ERROR; - } - /* Create the Area_t Node */ - if (cgi_new_node(bprop->id, "Area", "Area_t", - &bcarea->id, "MT", 0, 0, 0)) return CG_ERROR; - - /* Area_t/AreaType_t */ - len = strlen(AreaTypeName[bcarea->type]); - if (cgi_new_node(bcarea->id, "AreaType", "AreaType_t", &dummy_id, - "C1", 1, &len, (void *)AreaTypeName[bcarea->type])) return CG_ERROR; - - /* Area_t/DataArray_t: SurfaceArea & RegionName */ - for (n=0; nnarrays; n++) - if (cgi_write_array(bcarea->id, &bcarea->array[n])) return CG_ERROR; - - return CG_OK; -} - -int cg_rigid_motion_write(int file_number, int B, int Z, char const * rmotionname, - RigidGridMotionType_t type, int *R) { - cgns_zone *zone; - cgns_rmotion *rmotion; - int index, length; - - /* verify input */ - if (cgi_check_strlen(rmotionname)) return CG_ERROR; - - if (type<0 || type >= NofValidRigidGridMotionTypes) { - cgi_error("Invalid input: RigidGridMotionType=%d ?",type); - return CG_ERROR; - } - - /* get memory address for RigidGridMotion_t node */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return CG_ERROR; - - /* Overwrite a RigidGridMotion_t Node: */ - for (index=0; indexnrmotions; index++) { - if (strcmp(rmotionname, zone->rmotion[index].name)==0) { - - /* in MODE_WRITE, children names must be unique */ - if (cg->mode==MODE_WRITE) { - cgi_error("Duplicate child name found: %s",rmotionname); - return CG_ERROR; - } - - /* overwrite an existing rmotion */ - /* delete the existing rmotion from file */ - if (cgi_delete_node(zone->id, zone->rmotion[index].id)) - return CG_ERROR; - /* save the old in-memory address to overwrite */ - rmotion = &(zone->rmotion[index]); - /* free memory */ - cgi_free_rmotion(rmotion); - break; - } - } - /* ... or add a new RigidGridMotion_t Node: */ - if (index==zone->nrmotions) { - if (zone->nrmotions == 0) { - zone->rmotion = CGNS_NEW(cgns_rmotion, 1); - } else { - zone->rmotion = CGNS_RENEW(cgns_rmotion, zone->nrmotions+1, zone->rmotion); - } - rmotion = &(zone->rmotion[zone->nrmotions]); - zone->nrmotions++; - } - (*R) = index+1; - - /* save data for cgns_rmotion *rmotion */ - strcpy(rmotion->name,rmotionname); - rmotion->type = type; - - /* initialize other members of rmotion */ - rmotion->id=0; - rmotion->link=0; - rmotion->ndescr=0; - rmotion->data_class=DataClassNull; - rmotion->units=0; - rmotion->narrays=0; - rmotion->nuser_data=0; - - /* Create node RigidGridMotion_t */ - length = strlen(RigidGridMotionTypeName[rmotion->type]); - if (cgi_new_node(zone->id, rmotion->name, "RigidGridMotion_t", &rmotion->id, - "C1", 1, &length, (void *)RigidGridMotionTypeName[rmotion->type])) return CG_ERROR; - - return CG_OK; -} - -int cg_arbitrary_motion_write(int file_number, int B, int Z, char const * amotionname, - ArbitraryGridMotionType_t type, int *A) { - cgns_zone *zone; - cgns_amotion *amotion; - int index, length; - - /* verify input */ - if (cgi_check_strlen(amotionname)) return CG_ERROR; - - if (type<0 || type >= NofValidArbitraryGridMotionTypes) { - cgi_error("Invalid input: ArbitraryGridMotionType=%d ?",type); - return CG_ERROR; - } - - /* get memory address for ArbitraryGridMotion_t node */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return CG_ERROR; - - /* Overwrite a ArbitraryGridMotion_t Node: */ - for (index=0; indexnamotions; index++) { - if (strcmp(amotionname, zone->amotion[index].name)==0) { - - /* in MODE_WRITE, children names must be unique */ - if (cg->mode==MODE_WRITE) { - cgi_error("Duplicate child name found: %s",amotionname); - return CG_ERROR; - } - - /* overwrite an existing amotion */ - /* delete the existing amotion from file */ - if (cgi_delete_node(zone->id, zone->amotion[index].id)) - return CG_ERROR; - /* save the old in-memory address to overwrite */ - amotion = &(zone->amotion[index]); - /* free memory */ - cgi_free_amotion(amotion); - break; - } - } - /* ... or add a new ArbitraryGridMotion_t Node: */ - if (index==zone->namotions) { - if (zone->namotions == 0) { - zone->amotion = CGNS_NEW(cgns_amotion, 1); - } else { - zone->amotion = CGNS_RENEW(cgns_amotion, zone->namotions+1, zone->amotion); - } - amotion = &(zone->amotion[zone->namotions]); - zone->namotions++; - } - (*A) = index+1; - - /* save data for cgns_amotion *amotion */ - strcpy(amotion->name,amotionname); - amotion->type = type; - - /* initialize other members of amotion */ - amotion->id=0; - amotion->link=0; - amotion->ndescr=0; - amotion->location=Vertex; - amotion->rind_planes=0; - amotion->narrays=0; - amotion->data_class=DataClassNull; - amotion->units=0; - amotion->nuser_data=0; - - /* Create node ArbitraryGridMotion_t */ - length = strlen(ArbitraryGridMotionTypeName[amotion->type]); - if (cgi_new_node(zone->id, amotion->name, "ArbitraryGridMotion_t", &amotion->id, - "C1", 1, &length, (void *)ArbitraryGridMotionTypeName[amotion->type])) return CG_ERROR; - return CG_OK; -} - -int cg_simulation_type_write(int file_number, int B, SimulationType_t type) { - cgns_base *base; - int length; - - /* check input */ - if (type<0 || type >= NofValidSimulationTypes) { - cgi_error("Invalid input: SimulationType=%d ?",type); - return CG_ERROR; - } - - /* get memory address for file */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - /* get memory address for CGNSBase_t node */ - base = cgi_get_base(cg, B); - if (base==0) return CG_ERROR; - - /* write or overwrite SimulationType_t to Base */ - if (base->type) { - if (cg->mode==MODE_WRITE) { - cgi_error("Simulation type already defined under CGNSBase_t '%s'", - base->name); - return CG_ERROR; - } - if (cgi_delete_node(base->id, base->type_id)) - return CG_ERROR; - } - base->type = type; - base->type_id = 0; - - /* save data in file */ - length = strlen(SimulationTypeName[type]); - if (cgi_new_node(base->id, "SimulationType", "SimulationType_t", &base->type_id, - "C1", 1, &length, (void *)SimulationTypeName[type])) return CG_ERROR; - - return CG_OK; -} - -int cg_biter_write(int file_number, int B, char const * bitername, int nsteps) { - cgns_base *base; - cgns_biter *biter; - int length=1; - - /* verify input */ - if (nsteps<=0) { - cgi_error("Invalid input: The number of steps must be a positive integer!"); - return CG_ERROR; - } - - /* get memory address for BaseIterativeData_t node */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - base = cgi_get_base(cg, B); - if (base==0) return CG_ERROR; - - /* If BaseIterativeData_t already exist: */ - if (base->biter) { - if (cg->mode==MODE_WRITE) { - cgi_error("Error: BaseIterativeData_t already defined"); - return CG_ERROR; - } - - /* overwrite an existing rmotion */ - /* delete the existing biter from file */ - if (cgi_delete_node(base->id, base->biter->id)) - return CG_ERROR; - /* save the old in-memory address to overwrite */ - biter = base->biter; - /* free memory */ - cgi_free_biter(biter); - /* ... or add a new BaseIterativeData_t Node: */ - } else { - base->biter = CGNS_NEW(cgns_biter, 1); - biter = base->biter; - } - - /* save data for cgns_biter *biter */ - strcpy(biter->name,bitername); - biter->nsteps = nsteps; - - /* initialize other members of biter */ - biter->id=0; - biter->link=0; - biter->ndescr=0; - biter->narrays=0; - biter->data_class=DataClassNull; - biter->units=0; - biter->nuser_data=0; - - /* Create node BaseIterativeData_t */ - if (cgi_new_node(base->id, biter->name, "BaseIterativeData_t", &biter->id, - "I4", 1, &length, (void *)&nsteps)) return CG_ERROR; - return CG_OK; -} - -int cg_ziter_write(int file_number, int B, int Z, char const * zitername) { - cgns_zone *zone; - cgns_ziter *ziter; - - /* verify input */ - if (cgi_check_strlen(zitername)) return CG_ERROR; - - /* get memory address for ZoneIterativeData_t node */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - zone = cgi_get_zone(cg, B, Z); - if (zone==0) return CG_ERROR; - - /* Overwrite the ZoneIterativeData_t Node: */ - if (zone->ziter) { - if (cg->mode==MODE_WRITE) { - cgi_error("Error: ZoneIterativeData_t already defined"); - return CG_ERROR; - } - /* overwrite an existing ZoneIterativeData_t Node */ - /* delete the existing ziter from file */ - if (cgi_delete_node(zone->id, zone->ziter->id)) - return CG_ERROR; - /* save the old in-memory address to overwrite */ - ziter = zone->ziter; - /* free memory */ - cgi_free_ziter(ziter); - } else { - zone->ziter = CGNS_NEW(cgns_ziter, 1); - ziter = zone->ziter; - } - - /* save data for cgns_ziter *ziter */ - strcpy(ziter->name,zitername); - - /* initialize other members of ziter */ - ziter->id=0; - ziter->link=0; - ziter->ndescr=0; - ziter->narrays=0; - ziter->data_class=DataClassNull; - ziter->units=0; - ziter->nuser_data=0; - - /* Create node ZoneIterativeData_t */ - if (cgi_new_node(zone->id, ziter->name, "ZoneIterativeData_t", &ziter->id, - "MT", 0, 0, 0)) return CG_ERROR; - return CG_OK; -} - -int cg_gravity_write(int file_number, int B, float const *gravity_vector) { - cgns_base *base; - cgns_gravity *gravity; - - /* get memory address for file */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - /* get memory address for base */ - base = cgi_get_base(cg, B); - if (base==0) return CG_ERROR; - - if (base->gravity) { - if (cg->mode==MODE_WRITE) { - cgi_error("Gravity is already defined under CGNSBase_t '%s'", - base->name); - return CG_ERROR; - } - if (cgi_delete_node(base->id, base->gravity->id)) - return CG_ERROR; - cgi_free_gravity(base->gravity); - } else - base->gravity = CGNS_NEW(cgns_gravity, 1); - gravity = base->gravity; - gravity->vector = CGNS_NEW(cgns_array, 1); - - /* Create DataArray_t GravityVector under gravity */ - strcpy(gravity->vector->data_type, "R4"); - gravity->vector->data = (void *)malloc(base->phys_dim*sizeof(float)); - if (!gravity->vector->data) { - cgi_error("Error allocating gravity->vector->data"); - return CG_ERROR; - } - memcpy(gravity->vector->data, gravity_vector, base->phys_dim*sizeof(float)); - strcpy(gravity->vector->name, "GravityVector"); - gravity->vector->data_dim=1; - gravity->vector->dim_vals[0]=base->phys_dim; - - /* initialize other fields of gravity->vector */ - gravity->vector->id=0; - gravity->vector->link=0; - gravity->vector->ndescr=0; - gravity->vector->data_class=DataClassNull; - gravity->vector->units=0; - gravity->vector->exponents=0; - gravity->vector->convert=0; - - /* initialize other fields of gravity */ - strcpy(gravity->name, "Gravity"); - gravity->id=0; - gravity->link=0; - gravity->ndescr=0; - gravity->data_class=DataClassNull; - gravity->units=0; - gravity->nuser_data=0; - gravity->narrays=1; - - /* Write to disk */ - if (cgi_write_gravity(base->id, gravity)) return CG_ERROR; - - return CG_OK; -} - -int cg_axisym_write(int file_number, int B, float const *ref_point, float const *axis) { - int n; - cgns_base *base; - cgns_axisym *axisym; - - /* get memory address for file */ - cg = cgi_get_file(file_number); - if (cg == 0) return CG_ERROR; - - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - /* get memory address for base */ - base = cgi_get_base(cg, B); - if (base==0) return CG_ERROR; - - /* Verify that this is a bidimensional base */ - if (base->phys_dim != 2) { - cgi_error("Error: Axisymmetry_t can only be specified for bidimensional bases"); - return CG_ERROR; - } - - if (base->axisym) { - if (cg->mode==MODE_WRITE) { - cgi_error("Axisymmetry is already defined under CGNSBase_t '%s'", - base->name); - return CG_ERROR; - } - if (cgi_delete_node(base->id, base->axisym->id)) - return CG_ERROR; - cgi_free_axisym(base->axisym); - } else - base->axisym = CGNS_NEW(cgns_axisym, 1); - axisym = base->axisym; - axisym->array = CGNS_NEW(cgns_array, 2); - axisym->narrays=2; - - /* Create DataArray_t AxisymmetryReferencePoint & AxisymmetryAxisVector under axisym */ - for (n=0; nnarrays; n++) { - strcpy(axisym->array[n].data_type, "R4"); - axisym->array[n].data = (void *)malloc(base->phys_dim*sizeof(float)); - if (!axisym->array[n].data) { - cgi_error("Error allocating axisym->array[n].data"); - return CG_ERROR; - } - axisym->array[n].data_dim=1; - axisym->array[n].dim_vals[0]=base->phys_dim; - } - memcpy(axisym->array[0].data, ref_point, base->phys_dim*sizeof(float)); - memcpy(axisym->array[1].data, axis, base->phys_dim*sizeof(float)); - strcpy(axisym->array[0].name, "AxisymmetryReferencePoint"); - strcpy(axisym->array[1].name, "AxisymmetryAxisVector"); - - /* initialize other fields of axisym->array[n] */ - for (n=0; nnarrays; n++) { - axisym->array[n].id=0; - axisym->array[n].link=0; - axisym->array[n].ndescr=0; - axisym->array[n].data_class=DataClassNull; - axisym->array[n].units=0; - axisym->array[n].exponents=0; - axisym->array[n].convert=0; - } - - /* initialize other fields of axisym */ - strcpy(axisym->name, "Axisymmetry"); - axisym->id=0; - axisym->link=0; - axisym->ndescr=0; - axisym->data_class=DataClassNull; - axisym->units=0; - axisym->nuser_data=0; - - /* Write to disk */ - if (cgi_write_axisym(base->id, axisym)) return CG_ERROR; - - return CG_OK; -} - -/*****************************************************************************\ - * Write Multiple path nodes -\*****************************************************************************/ - -int cg_famname_write(char const * family_name) { - char *famname; - int ier=0, dim_vals; - double posit_id, dummy_id; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - if (cgi_check_strlen(family_name)) return CG_ERROR; - - famname = cgi_famname_address(MODE_WRITE, &ier); - if (famname==0) return ier; - - strcpy(famname, family_name); - - /* save data in file */ - if (cgi_posit_id(&posit_id)) return CG_ERROR; - dim_vals = strlen(family_name); - if (cgi_new_node(posit_id, "FamilyName", "FamilyName_t", &dummy_id, - "C1", 1, &dim_vals, (void *)family_name)) return CG_ERROR; - - return CG_OK; -} - - -int cg_convergence_write(int iterations, char const * NormDefinitions) { - cgns_converg *converg; - int ier=0, dim_vals; - double posit_id; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - converg = cgi_converg_address(MODE_WRITE, &ier); - if (converg==0) return ier; - - /* initialize new ConvergenceHistory_t node */ - converg->iterations=0; - converg->id = 0; - converg->link=0; - converg->ndescr=0; - converg->NormDefinitions = 0; - converg->narrays=0; - converg->data_class=DataClassNull; - converg->units=0; - converg->nuser_data=0; - - /* save data in memory */ - converg->iterations = iterations; - if (strlen(NormDefinitions)) { - converg->NormDefinitions=CGNS_NEW(cgns_descr, 1); - converg->NormDefinitions->id=0; - converg->NormDefinitions->link=0; - converg->NormDefinitions->text = CGNS_NEW(char, strlen(NormDefinitions)+1); - strcpy(converg->NormDefinitions->text, NormDefinitions); - strcpy(converg->NormDefinitions->name, "NormDefinitions"); - } - - /* save data in file */ - if (cgi_posit_id(&posit_id)) return CG_ERROR; - dim_vals=1; - if (cgi_new_node(posit_id, converg->name, "ConvergenceHistory_t", &converg->id, - "I4", 1, &dim_vals, (void *)&converg->iterations)) return CG_ERROR; - - /* write NormDefinitions */ - if (converg->NormDefinitions && - cgi_write_descr(converg->id, converg->NormDefinitions)) return CG_ERROR; - return CG_OK; -} - -int cg_state_write(char const * StateDescription) { - cgns_state *state; - int ier=0; - double posit_id; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - state = cgi_state_address(MODE_WRITE, &ier); - if (state==0) return ier; - - /* initialize state */ - strcpy(state->name,"ReferenceState"); - state->id = 0; - state->link=0; - state->ndescr=0; - state->narrays=0; - state->data_class=DataClassNull; - state->units=0; - state->StateDescription=0; - state->nuser_data=0; - - /* Save data in memory */ - if (strlen(StateDescription)) { - state->StateDescription=CGNS_NEW(cgns_descr, 1); - state->StateDescription->id = 0; - state->StateDescription->link = 0; - state->StateDescription->text = CGNS_NEW(char, strlen(StateDescription)+1); - strcpy(state->StateDescription->text, StateDescription); - strcpy(state->StateDescription->name, "ReferenceStateDescription"); - } - - /* save data in file */ - if (cgi_posit_id(&posit_id)) return CG_ERROR; - - /* ReferenceState_t */ - if (cgi_new_node(posit_id, state->name, "ReferenceState_t", &state->id, - "MT", 0, 0, 0)) return CG_ERROR; - - /* ReferenceStateDescription */ - if (state->StateDescription && - cgi_write_descr(state->id, state->StateDescription)) return CG_ERROR; - return CG_OK; -} - -int cg_equationset_write(int EquationDimension) { - cgns_equations *equations; - int ier=0; - double posit_id; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - equations=cgi_equations_address(MODE_WRITE, &ier); - if (equations==0) return ier; - - /* Save data */ - equations->equation_dim=EquationDimension; - - /* initialize other fields */ - strcpy(equations->name, "FlowEquationSet"); - equations->id=0; - equations->link=0; - equations->ndescr=0; - equations->governing=0; - equations->gas=0; - equations->visc=0; - equations->conduct=0; - equations->closure=0; - equations->turbulence=0; - equations->relaxation=0; - equations->chemkin=0; - equations->data_class=DataClassNull; - equations->units=0; - equations->nuser_data=0; - - /* save data in file */ - if (cgi_posit_id(&posit_id)) return CG_ERROR; - if (cgi_write_equations(posit_id, equations)) return CG_ERROR; - return CG_OK; -} - -int cg_governing_write(GoverningEquationsType_t Equationstype) { - cgns_governing *governing; - int ier=0, index_dim, dim_vals; - double posit_id; - - /* verify input */ - if (Equationstype<0 || Equationstype>=NofValidGoverningEquationsTypes) { - cgi_error("Invalid Governing Equations Type: %d",Equationstype); - return CG_ERROR; - } - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - governing = cgi_governing_address(MODE_WRITE, &ier); - if (governing==0) return ier; - - /* Save data */ - governing->type=Equationstype; - - /* initialize other fields */ - strcpy(governing->name, "GoverningEquations"); - governing->id=0; - governing->link=0; - governing->ndescr=0; - governing->diffusion_model=0; - governing->nuser_data=0; - - if (posit_base && posit_zone) { - index_dim = cg->base[posit_base-1].zone[posit_zone-1].index_dim; - - /* If defined under CGNSBase_t node */ - } else if (posit_base) { - index_dim = cg->base[posit_base-1].cell_dim; - - } else { - cgi_error("Can't find IndexDimension in cg_governing_write."); - return CG_NO_INDEX_DIM; - } - if (index_dim==1) governing->dim_vals=1; - else if (index_dim==2) governing->dim_vals=3; - else if (index_dim==3) governing->dim_vals=6; - - /* save data in file */ - if (cgi_posit_id(&posit_id)) return CG_ERROR; - dim_vals = strlen(GoverningEquationsTypeName[governing->type]); - if (cgi_new_node(posit_id, "GoverningEquations", - "GoverningEquations_t", &governing->id, "C1", 1, &dim_vals, - GoverningEquationsTypeName[governing->type])) return CG_ERROR; - return CG_OK; -} - -int cg_diffusion_write(int const * diffusion_model) { - int *diffusion; - int n, ndata, ier=0, index_dim; - double posit_id, dummy_id; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - diffusion = cgi_diffusion_address(MODE_WRITE, &ier); - if (diffusion==0) return ier; - - /* Save data */ - if (posit_base && posit_zone) { - index_dim = cg->base[posit_base-1].zone[posit_zone-1].index_dim; - - /* If defined under CGNSBase_t node */ - } else if (posit_base) { - index_dim = cg->base[posit_base-1].cell_dim; - } else { - cgi_error("Can't find IndexDimension in cg_diffusion_write."); - return CG_NO_INDEX_DIM; - } - if (index_dim==1) ndata=1; - else if (index_dim==2) ndata=3; - else if (index_dim==3) ndata=6; - else { - cgi_error("invalid value for IndexDimension"); - return CG_ERROR; - } - - for (n=0; nfilename, cg->mode, MODE_WRITE)) return CG_ERROR; - if (ModelType<0 || ModelType>=NofValidModelTypes) { - cgi_error("Invalid %s Type: %d",ModelLabel,ModelType); - return CG_ERROR; - } - - /* Validate enums for each model type. */ - if (strcmp(ModelLabel, "GasModel_t")==0) { - if (ModelType!=ModelTypeNull && ModelType!=ModelTypeUserDefined && - ModelType!=Ideal && ModelType!=VanderWaals && - ModelType!=CaloricallyPerfect && ModelType!=ThermallyPerfect && - ModelType!=ConstantDensity && ModelType!=RedlichKwong) { - cgi_error("Model Type '%s' is not supported for %s", - ModelTypeName[ModelType],ModelLabel); - return CG_ERROR; - } - } else if (strcmp(ModelLabel, "ViscosityModel_t")==0) { - if (ModelType!=ModelTypeNull && ModelType!=ModelTypeUserDefined && - ModelType!=Constant && ModelType!=PowerLaw && ModelType!=SutherlandLaw) { - cgi_error("Model Type '%s' is not supported for %s", - ModelTypeName[ModelType],ModelLabel); - return CG_ERROR; - } - } else if (strcmp(ModelLabel, "ThermalConductivityModel_t")==0) { - if (ModelType!=ModelTypeNull && ModelType!=ModelTypeUserDefined && - ModelType!=PowerLaw && ModelType!=SutherlandLaw && ModelType!=ConstantPrandtl) { - cgi_error("Model Type '%s' is not supported for %s", - ModelTypeName[ModelType],ModelLabel); - return CG_ERROR; - } - } else if (strcmp(ModelLabel, "TurbulenceModel_t")==0) { - if (ModelType!=ModelTypeNull && ModelType!=ModelTypeUserDefined && - ModelType!=Algebraic_BaldwinLomax && ModelType!=Algebraic_CebeciSmith && - ModelType!=HalfEquation_JohnsonKing && ModelType!=OneEquation_BaldwinBarth && - ModelType!=OneEquation_SpalartAllmaras && ModelType!=TwoEquation_JonesLaunder && - ModelType!=TwoEquation_MenterSST && ModelType!=TwoEquation_Wilcox) { - cgi_error("Model Type '%s' is not supported for %s", - ModelTypeName[ModelType],ModelLabel); - return CG_ERROR; - } - } else if (strcmp(ModelLabel, "TurbulenceClosure_t")==0) { - if (ModelType!=ModelTypeNull && ModelType!=ModelTypeUserDefined && - ModelType!=EddyViscosity && ModelType!=ReynoldsStress && - ModelType!=ReynoldsStressAlgebraic) { - cgi_error("Model Type '%s' is not supported for %s", - ModelTypeName[ModelType],ModelLabel); - return CG_ERROR; - } - } else if (strcmp(ModelLabel, "ThermalRelaxationModel_t")==0) { - if (ModelType!=ModelTypeNull && ModelType!=ModelTypeUserDefined && - ModelType!=Frozen && ModelType!=ThermalEquilib && - ModelType!=ThermalNonequilib) { - cgi_error("Model Type '%s' is not supported for %s", - ModelTypeName[ModelType],ModelLabel); - return CG_ERROR; - } - } else if (strcmp(ModelLabel, "ChemicalKineticsModel_t")==0) { - if (ModelType!=ModelTypeNull && ModelType!=ModelTypeUserDefined && - ModelType!=Frozen && ModelType!=ChemicalEquilibCurveFit && - ModelType!=ChemicalEquilibMinimization && ModelType!=ChemicalNonequilib) { - cgi_error("Model Type '%s' is not supported for %s", - ModelTypeName[ModelType],ModelLabel); - return CG_ERROR; - } - } - - if (strcmp(ModelLabel, "ChemicalKineticsModel_t") && - strcmp(ModelLabel, "ThermalRelaxationModel_t") && - strcmp(ModelLabel, "TurbulenceClosure_t") && - strcmp(ModelLabel, "TurbulenceModel_t") && - strcmp(ModelLabel, "ThermalConductivityModel_t") && - strcmp(ModelLabel, "ViscosityModel_t") && - strcmp(ModelLabel, "GasModel_t")) { - cgi_error("Invalid Model Label: %s",ModelLabel); - return CG_ERROR; - } - - /* get address */ - model = cgi_model_address(MODE_WRITE, ModelLabel, &ier); - if (model==0) return ier; - - /* Save data */ - model->type = ModelType; - strcpy(ModelName,ModelLabel); - ModelName[strlen(ModelLabel)-2]='\0'; - strcpy(model->name, ModelName); - - /* initialize other fields */ - model->id=0; - model->link=0; - model->ndescr=0; - model->narrays=0; - model->data_class=DataClassNull; - model->units=0; - model->diffusion_model=0; - model->dim_vals=0; - model->nuser_data=0; - - if (strcmp(ModelLabel, "TurbulenceModel_t")==0) { - if (posit_base && posit_zone) { - index_dim = cg->base[posit_base-1].zone[posit_zone-1].index_dim; - /* For TurbulenceModel_t defined under CGNSBase_t */ - } else if (posit_base) { - index_dim = cg->base[posit_base-1].cell_dim; - } else { - cgi_error("Can't find IndexDimension in cg_model_write."); - return CG_NO_INDEX_DIM; - } - if (index_dim==1) model->dim_vals=1; - else if (index_dim==2) model->dim_vals=3; - else if (index_dim==3) model->dim_vals=6; - else { - cgi_error("invalid value for IndexDimension"); - return CG_ERROR; - } - } - - /* save data in file */ - if (cgi_posit_id(&posit_id)) return CG_ERROR; - if (cgi_write_model(posit_id, model)) return CG_ERROR; - return CG_OK; -} - -int cg_array_write(char const * ArrayName, DataType_t DataType, - int DataDimension, int const * DimensionVector, void const * Data) { - cgns_array *array; - int n, ier=0; - double posit_id; - - /* verify input */ - if (cgi_check_strlen(ArrayName)) return CG_ERROR; - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - if (DataType!=RealSingle && DataType!=RealDouble && - DataType!=Integer && DataType!=Character) { - cgi_error("Invalid datatype for data array: %d", DataType); - return CG_ERROR; - } - if (DataDimension>12) { - cgi_error("Data arrays are limited to 12 dimensions"); - return CG_ERROR; - } - for (n=0; nname, ArrayName); - strcpy(array->data_type, cgi_adf_datatype(DataType)); - array->data_dim = DataDimension; - for (n=0; ndim_vals[n]=DimensionVector[n]; - - /* initialize other fields */ - array->link=0; - array->ndescr=0; - array->data_class=DataClassNull; - array->units=0; - array->exponents=0; - array->convert=0; - array->data=0; - - /* write to disk */ - if (cgi_posit_id(&posit_id)) return CG_ERROR; - if (cgi_new_node(posit_id, array->name, "DataArray_t", &array->id, - array->data_type, array->data_dim, array->dim_vals, Data)) return CG_ERROR; - - return CG_OK; -} - -int cg_integral_write(char const * IntegralDataName) { - cgns_integral *integral; - int ier=0; - double posit_id; - - /* verify input */ - if (cgi_check_strlen(IntegralDataName)) return CG_ERROR; - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - integral = cgi_integral_address(MODE_WRITE, 0, IntegralDataName, &ier); - if (integral==0) return ier; - - strcpy(integral->name, IntegralDataName); - - /* initialize other fields */ - integral->id=0; - integral->link=0; - integral->ndescr=0; - integral->narrays=0; - integral->data_class=DataClassNull; - integral->units=0; - integral->nuser_data=0; - - /* save data in file */ - if (cgi_posit_id(&posit_id)) return CG_ERROR; - if (cgi_new_node(posit_id, integral->name, "IntegralData_t", - &integral->id, "MT", 0, 0, 0)) return CG_ERROR; - return CG_OK; -} - -int cg_rind_write(int const * RindData) { - int n, ier=0; - int *rind, index_dim; - double posit_id; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - rind = cgi_rind_address(MODE_WRITE, &ier); - if (rind==0) return ier; - - if (posit_base && posit_zone) { - index_dim = cg->base[posit_base-1].zone[posit_zone-1].index_dim; - } else { - cgi_error("Can't find IndexDimension in cg_rind_write."); - return CG_NO_INDEX_DIM; - } - - for (n=0; n<2*index_dim; n++) rind[n]=RindData[n]; - - /* save data in file & if different from default (6*0) */ - if (cgi_posit_id(&posit_id)) return CG_ERROR; - if (cgi_write_rind(posit_id, rind, index_dim)) return CG_ERROR; - return CG_OK; -} - -int cg_descriptor_write(char const * descr_name, char const * descr_text) { - cgns_descr *descr; - int ier=0; - double posit_id; - - /* verify input */ - if (cgi_check_strlen(descr_name)) return CG_ERROR; - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - descr = cgi_descr_address(MODE_WRITE, 0, descr_name, &ier); - if (descr==0) return ier; - - /* Save Descriptor_t data */ - strcpy(descr->name, descr_name); - if ((descr->text = (char *)malloc((strlen(descr_text)+1)*sizeof(char)))==NULL) { - cgi_error("Error allocating memory for Descriptor..."); - return CG_ERROR; - } - strcpy(descr->text, descr_text); - - /* initialize other fields */ - descr->id=0; - descr->link=0; - - /* save data in file */ - if (cgi_posit_id(&posit_id)) return CG_ERROR; - if (cgi_write_descr(posit_id, descr)) return CG_ERROR; - return CG_OK; -} - -int cg_units_write(MassUnits_t mass, LengthUnits_t length, TimeUnits_t time, - TemperatureUnits_t temperature, AngleUnits_t angle) { - int ier=0; - cgns_units *units; - double posit_id; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - if (mass < 0 || mass >= NofValidMassUnits) { - cgi_error("Invalid input: mass unit %d not supported",mass); - return CG_ERROR; - } - if (length < 0 || length >= NofValidLengthUnits) { - cgi_error("Invalid input: length unit %d not supported", length); - return CG_ERROR; - } - if (time < 0 || time >= NofValidTimeUnits) { - cgi_error("Invalid input: time unit %d not supported", time); - return CG_ERROR; - } - if (temperature < 0 || temperature >= NofValidTemperatureUnits) { - cgi_error("Invalid input: temperature unit %d not supported", temperature); - return CG_ERROR; - } - if (angle < 0 || angle >= NofValidAngleUnits) { - cgi_error("Invalid input: angle unit %d not supported", angle); - return CG_ERROR; - } - - /* get address */ - units = cgi_units_address(MODE_WRITE, &ier); - if (units==0) return ier; - - /* save data in memory */ - units->mass = mass; - units->length = length; - units->time = time; - units->temperature = temperature; - units->angle = angle; - - /* initialize other fields */ - strcpy(units->name, "DimensionalUnits"); - units->id = 0; - units->link=0; - - /* save data in file */ - if (cgi_posit_id(&posit_id)) return CG_ERROR; - if (cgi_write_units(posit_id, units)) return CG_ERROR; - return CG_OK; -} - -int cg_exponents_write(DataType_t DataType, void const * exponents) { - cgns_exponent *exponent; - int ier=0, dim_vals=5; - double posit_id; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - exponent = cgi_exponent_address(MODE_WRITE, &ier); - if (exponent==0) return ier; - - /* Save Data */ - strcpy(exponent->data_type, cgi_adf_datatype(DataType)); - exponent->data = (void *)malloc(5*size_of(exponent->data_type)); - if (!exponent->data) { - cgi_error("Error allocating exponent->data"); - return CG_ERROR; - } - - if (DataType==RealSingle) { - (*((float *)exponent->data+0)) = (*((float *) exponents+0)); - (*((float *)exponent->data+1)) = (*((float *) exponents+1)); - (*((float *)exponent->data+2)) = (*((float *) exponents+2)); - (*((float *)exponent->data+3)) = (*((float *) exponents+3)); - (*((float *)exponent->data+4)) = (*((float *) exponents+4)); - - } else if (DataType==RealDouble) { - (*((double *)exponent->data+0)) = (*((double *) exponents+0)); - (*((double *)exponent->data+1)) = (*((double *) exponents+1)); - (*((double *)exponent->data+2)) = (*((double *) exponents+2)); - (*((double *)exponent->data+3)) = (*((double *) exponents+3)); - (*((double *)exponent->data+4)) = (*((double *) exponents+4)); - } - - /* initialize other fields */ - strcpy(exponent->name, "DimensionalExponents"); - exponent->id = 0; - exponent->link = 0; - - /* save data in file */ - if (cgi_posit_id(&posit_id)) return CG_ERROR; - if (cgi_new_node(posit_id, "DimensionalExponents", - "DimensionalExponents_t", &exponent->id, - exponent->data_type, 1, &dim_vals, exponent->data)) - return CG_ERROR; - return CG_OK; -} - -int cg_conversion_write(DataType_t DataType, void const * ConversionFactors) { - cgns_conversion *conversion; - int ier=0, dim_vals=2; - double posit_id; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - conversion = cgi_conversion_address(MODE_WRITE, &ier); - if (conversion==0) return ier; - - /* Save data */ - strcpy(conversion->data_type, cgi_adf_datatype(DataType)); - conversion->data = (void *)malloc(2*size_of(conversion->data_type)); - if (!conversion->data) { - cgi_error("Error allocating conversion->data"); - return CG_ERROR; - } - - if (DataType==RealSingle) { - *((float *) conversion->data+0) = *((float *)ConversionFactors+0); - *((float *) conversion->data+1) = *((float *)ConversionFactors+1); - - } else if (DataType==RealDouble) { - *((double *) conversion->data+0) = *((double *)ConversionFactors+0); - *((double *) conversion->data+1) = *((double *)ConversionFactors+1); - } - - /* initialize other fields */ - strcpy(conversion->name, "DataConversion"); - conversion->id=0; - conversion->link=0; - - /* save data in file */ - if (cgi_posit_id(&posit_id)) return CG_ERROR; - if (cgi_new_node(posit_id, "DataConversion", "DataConversion_t", - &conversion->id, conversion->data_type, 1, &dim_vals, - conversion->data)) return CG_ERROR; - return CG_OK; -} - -int cg_dataclass_write(DataClass_t dataclass) { - DataClass_t *DataClass; - int ier=0; - double posit_id; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - DataClass = cgi_dataclass_address(MODE_WRITE, &ier); - if (DataClass==0) return ier; - - (*DataClass) = dataclass; - - /* save data in file */ - if (cgi_posit_id(&posit_id)) return CG_ERROR; - if (cgi_write_dataclass(posit_id, dataclass)) return CG_ERROR; - return CG_OK; -} - -int cg_gridlocation_write(GridLocation_t GridLocation) { - GridLocation_t *location; - int ier=0, dim_vals; - double posit_id, dummy_id; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - location = cgi_location_address(MODE_WRITE, &ier); - if (location==0) return ier; - - if ((GridLocation == IFaceCenter || GridLocation == JFaceCenter || - GridLocation == KFaceCenter) && - cg->base[posit_base-1].zone[posit_zone-1].type != Structured) { - cgi_error("GridLocation [IJK]FaceCenter only valid for Structured Grid"); - return CG_ERROR; - } - - ier = 0; - if (strcmp(posit_label,"FlowSolution_t")==0 || - strcmp(posit_label,"DiscreteData_t")== 0 || - strcmp(posit_label,"ArbitraryGridMotion_t")== 0) { - if (GridLocation != Vertex && GridLocation != CellCenter && - GridLocation != IFaceCenter && GridLocation != JFaceCenter && - GridLocation != KFaceCenter) ier = 1; - } - else if (strcmp(posit_label,"OversetHoles_t")==0) { - if (GridLocation != Vertex && GridLocation != CellCenter) - ier = 1; - } - else if (strcmp(posit_label,"GridConnectivity_t")==0) { - if (GridLocation != Vertex && GridLocation != CellCenter && - GridLocation != FaceCenter && GridLocation != IFaceCenter && - GridLocation != JFaceCenter && GridLocation != KFaceCenter) - ier = 1; - } - else if (strcmp(posit_label,"BC_t")==0) { - if (GridLocation != Vertex && GridLocation != FaceCenter && - GridLocation != IFaceCenter && GridLocation != JFaceCenter && - GridLocation != KFaceCenter) - ier = 1; - } - else { - if (GridLocation < 0 || GridLocation >= NofValidGridLocation) - ier = 1; - } - if (ier) { - cgi_error("GridLocation %d not valid for %s", GridLocation, posit_label); - return CG_ERROR; - } - - (*location) = GridLocation; - - /* save data in file */ - if (cgi_posit_id(&posit_id)) return CG_ERROR; - dim_vals = strlen(GridLocationName[GridLocation]); - if (cgi_new_node(posit_id, "GridLocation", "GridLocation_t", &dummy_id, - "C1", 1, &dim_vals, (void *)GridLocationName[GridLocation])) return CG_ERROR; - return CG_OK; -} - -int cg_ordinal_write(int Ordinal) { - int *ordinal; - int ier=0; - double posit_id; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - ordinal = cgi_ordinal_address(MODE_WRITE, &ier); - if (ordinal==0) return ier; - - (*ordinal) = Ordinal; - - /* save data in file */ - if (cgi_posit_id(&posit_id)) return CG_ERROR; - if (cgi_write_ordinal(posit_id, Ordinal)) return CG_ERROR; - return CG_OK; -} - -int cg_link_write(char const * nodename, char const * filename, char const * name_in_file) { - int ierr; - double posit_id, link_id; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - if (cgi_posit_id(&posit_id)) return CG_ERROR; - - /* check for valid posit */ - - if (strcmp(posit_label,"DataArray_t") && - strcmp(posit_label,"UserDefinedData_t") && - strcmp(posit_label,"IntegralData_t") && - strcmp(posit_label,"DiscreteData_t") && - strcmp(posit_label,"ConvergenceHistory_t") && - strcmp(posit_label,"ReferenceState_t") && - strcmp(posit_label,"GasModel_t") && - strcmp(posit_label,"ViscosityModel_t") && - strcmp(posit_label,"ThermalConductivityModel_t") && - strcmp(posit_label,"TurbulenceModel_t") && - strcmp(posit_label,"TurbulenceClosure_t") && - strcmp(posit_label,"ThermalRelaxationModel_t") && - strcmp(posit_label,"ChemicalKineticsModel_t") && - strcmp(posit_label,"GoverningEquations_t") && - strcmp(posit_label,"BCData_t") && - strcmp(posit_label,"BCDataSet_t") && - strcmp(posit_label,"Elements_t") && - strcmp(posit_label,"BC_t") && - strcmp(posit_label,"ZoneBC_t") && - strcmp(posit_label,"OversetHoles_t") && - strcmp(posit_label,"GridConnectivity_t") && - strcmp(posit_label,"GridConnectivity1to1_t") && - strcmp(posit_label,"ZoneGridConnectivity_t") && - strcmp(posit_label,"FlowSolution_t") && - strcmp(posit_label,"GridCoordinates_t") && - strcmp(posit_label,"RigidGridMotion_t") && - strcmp(posit_label,"ArbitraryGridMotion_t") && - strcmp(posit_label,"ZoneIterativeData_t") && - strcmp(posit_label,"BaseIterativeData_t") && - strcmp(posit_label,"Zone_t") && - strcmp(posit_label,"GeometryReference_t ") && - strcmp(posit_label,"Family_t") && - strcmp(posit_label,"CGNSBase_t") && - strcmp(posit_label,"Gravity_t") && - strcmp(posit_label,"Axisymmetry_t") && - strcmp(posit_label,"RotatingCoordinates_t") && - strcmp(posit_label,"BCProperty_t") && - strcmp(posit_label,"WallFunction_t") && - strcmp(posit_label,"Area_t") && - strcmp(posit_label,"GridConnectivityProperty_t") && - strcmp(posit_label,"Periodic_t") && - strcmp(posit_label,"AverageInterface_t")) { - cgi_error("Links not supported under '%s' type node",posit_label); - return CG_INCORRECT_PATH; - } - -#if DEBUG_LINKS - printf("Modify link %s -> \"%s>%s\"\n", - nodename, filename, name_in_file); -#endif - - /* Create the ADF link. */ - /* If a node already exists by that name, this will fail. */ - /* Need to fix this to allow modifying an existing node */ - /* but that's going to take a bit of work to keep the */ - /* in-core information current */ - - ADF_Link(posit_id, nodename, filename, name_in_file, &link_id, &ierr); - if (ierr > 0) { - adf_error("ADF_Link",ierr); - return CG_ERROR; - } - (cg->added)++; - return CG_OK; -} - - -int cg_user_data_write(char const * UserDataName) { - cgns_user_data *user_data; - int ier=0; - double posit_id; - - /* verify input */ - if (cgi_check_strlen(UserDataName)) return CG_ERROR; - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - user_data = cgi_user_data_address(MODE_WRITE, 0, UserDataName, &ier); - if (user_data==0) return ier; - - strcpy(user_data->name, UserDataName); - - /* initialize other fields */ - user_data->id=0; - user_data->link=0; - user_data->ndescr=0; - user_data->narrays=0; - user_data->data_class=DataClassNull; - user_data->units=0; - - /* save data in file */ - if (cgi_posit_id(&posit_id)) return CG_ERROR; - if (cgi_new_node(posit_id, user_data->name, "UserDefinedData_t", - &user_data->id, "MT", 0, 0, 0)) return CG_ERROR; - - return CG_OK; -} - -int cg_rotating_write(float const *rot_rate, float const *rot_center) { - cgns_rotating *rotating; - cgns_base *base; - int ier=0, n; - double posit_id; - - /* verify input */ - if (cgi_check_mode(cg->filename, cg->mode, MODE_WRITE)) return CG_ERROR; - - rotating=cgi_rotating_address(MODE_WRITE, &ier); - if (rotating==0) return ier; - - if (posit_base) { - base = &cg->base[posit_base-1]; - } else { - cgi_error("Can't find the base"); - return CG_ERROR; - } - - rotating->array = CGNS_NEW(cgns_array, 2); - rotating->narrays=2; - - /* Create DataArray_t RotationCenter & RotationRateVector under rotating */ - for (n=0; nnarrays; n++) { - strcpy(rotating->array[n].data_type, "R4"); - rotating->array[n].data = (void *)malloc(base->phys_dim*sizeof(float)); - if (!rotating->array[n].data) { - cgi_error("Error allocating rotating->array[n].data"); - return CG_ERROR; - } - rotating->array[n].data_dim=1; - rotating->array[n].dim_vals[0]=base->phys_dim; - } - memcpy(rotating->array[0].data, rot_center, base->phys_dim*sizeof(float)); - memcpy(rotating->array[1].data, rot_rate, base->phys_dim*sizeof(float)); - strcpy(rotating->array[0].name, "RotationCenter"); - strcpy(rotating->array[1].name, "RotationRateVector"); - - /* initialize other fields of rotating->array[n] */ - for (n=0; nnarrays; n++) { - rotating->array[n].id=0; - rotating->array[n].link=0; - rotating->array[n].ndescr=0; - rotating->array[n].data_class=DataClassNull; - rotating->array[n].units=0; - rotating->array[n].exponents=0; - rotating->array[n].convert=0; - } - - /* initialize other fields of rotating */ - strcpy(rotating->name, "RotatingCoordinates"); - rotating->id=0; - rotating->link=0; - rotating->ndescr=0; - rotating->data_class=DataClassNull; - rotating->units=0; - rotating->nuser_data=0; - - /* Write to disk */ - if (cgi_posit_id(&posit_id)) return CG_ERROR; - if (cgi_write_rotating(posit_id, rotating)) return CG_ERROR; - - return CG_OK; -} - - -/****************************************************************************/ -int cg_npe(ElementType_t type, int *npe) { - static int el_size[NofValidElementTypes] = { - 0, /* ElementTypeNull */ - 0, /* ElementTypeUserDefined */ - 1, /* NODE */ - 2, /* BAR_2 */ - 3, /* BAR_3 */ - 3, /* TRI_3 */ - 6, /* TRI_6 */ - 4, /* QUAD_4 */ - 8, /* QUAD_8 */ - 9, /* QUAD_9 */ - 4, /* TETRA_4 */ - 10, /* TETRA_10 */ - 5, /* PYRA_5 */ - 14, /* PYRA_14 */ - 6, /* PENTA_6 */ - 15, /* PENTA_15 */ - 18, /* PENTA_18 */ - 8, /* HEXA_8 */ - 20, /* HEXA_20 */ - 27, /* HEXA_27 */ - 0, /* MIXED */ - 0, /* NGON_n */ }; - if(type < 0) { - cgi_error("Invalid element type"); - return CG_ERROR; - - } else if (type>=NofValidElementTypes) - (*npe) = type - NGON_n; - - else (*npe) = el_size[type]; - return CG_OK; -} - -/*****************************************************************************\ - * General Delete Function -\*****************************************************************************/ - -int cg_delete_node(char *node_name) { - int n, m, ierr=0, index_dim; - double posit_id, node_id; - char_33 node_label; - - /* verify input */ - if (cg->mode != MODE_MODIFY) { - cgi_error("File %s must be opened in mode modify to delete a node", cg->filename); - return CG_ERROR; - } - /* ADF ID of parent = posit_id */ - if (cgi_posit_id(&posit_id)) return CG_ERROR; - - /* ADF ID of node */ - ADF_Get_Node_ID(posit_id, node_name, &node_id, &ierr); - if (ierr>0) { - adf_error("ADF_Get_Node_ID",ierr); - return CG_ERROR; - } - /* Get label of node to be deleted */ - ADF_Get_Label(node_id, node_label, &ierr); - if (ierr>0) { - adf_error("ADF_Get_Label",ierr); - return CG_ERROR; - } - -/* Nodes that can't be deleted */ - if ( - (strcmp(posit_label,"Zone_t")==0 && - strcmp(node_label,"ZoneType_t")==0 ) || - - (strcmp(posit_label,"GridConnectivity1to1_t")==0 && - (strcmp(node_name,"PointRange")==0 || - strcmp(node_name,"PointRangeDonor")==0) ) || - - (strcmp(posit_label,"OversetHoles_t")==0 && - (strcmp(node_label,"IndexRange_t")==0 || - strcmp(node_name,"PointList")==0) ) || - - (strcmp(posit_label,"GridConnectivity_t")==0 && - (strcmp(node_name,"PointRange")==0 || - strcmp(node_name,"PointList")==0 || - strcmp(node_name,"CellListDonor")==0 || - strcmp(node_name,"PointListDonor")==0 || - strcmp(node_name,"InterpolantsDonor")==0) ) || - - (strcmp(posit_label,"BC_t")==0 && - (strcmp(node_name,"PointList")==0 || - strcmp(node_name,"PointRange")==0 || - strcmp(node_name,"ElementList")==0 || - strcmp(node_name,"ElementRange")==0) ) || - - (strcmp(posit_label,"GeometryReference_t")==0 && - (strcmp(node_name,"GeometryFile")==0 || - strcmp(node_name,"GeometryFormat")==0) ) || - - (strcmp(posit_label,"Elements_t")==0 && - (strcmp(node_name,"ElementRange")==0 || - strcmp(node_name,"ElementConnectivity")==0) ) || - - (strcmp(posit_label,"Gravity_t")==0 && - strcmp(node_name,"GravityVector")==0) || - - (strcmp(posit_label,"Axisymmetry_t")==0 && - (strcmp(node_name,"AxisymmetryReferencePoint")==0 || - strcmp(node_name,"AxisymmetryAxisVector")==0) ) || - - (strcmp(posit_label,"RotatingCoordinates_t")==0 && - (strcmp(node_name,"RotationCenter")==0 || - strcmp(node_name,"RotationRateVector")==0) ) || - - (strcmp(posit_label,"WallFunction_t")==0 && - strcmp(node_label,"WallFunctionType_t")==0) || - - (strcmp(posit_label,"Area_t")==0 && - (strcmp(node_label,"AreaType_t")==0 || - strcmp(node_label,"DataArray_t")==0) ) || - - (strcmp(posit_label,"Periodic_t")==0 && - strcmp(node_label,"DataArray_t")==0) || - - (strcmp(posit_label,"AverageInterface_t")==0 && - strcmp(node_label,"AverageInterfaceType_t")==0) - - ) { - cgi_error("Node '%s' under '%s' can not be deleted",node_name,posit_label); - return CG_ERROR; - } - - /* Delete node_id under posit_id */ - if (cgi_delete_node(posit_id, node_id)) { - /*printf("posit_label=%s, node_name=%s\n",posit_label,node_name);*/ - return CG_ERROR; - } - -/* Remove from internal database */ -/* Children of CGNSBase_t */ - if (strcmp(posit_label,"CGNSBase_t")==0) { - cgns_base *parent = (cgns_base *)posit; - - /* Case 1: node_label = can have multiple occurence: */ - if (strcmp(node_label,"Zone_t")==0) CGNS_DELETE_SHIFT(nzones, zone) - else if (strcmp(node_label,"Family_t")==0) CGNS_DELETE_SHIFT(nfamilies, family) - else if (strcmp(node_label,"IntegralData_t")==0) CGNS_DELETE_SHIFT(nintegrals, integral) - else if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - - /* Case 2: node_label = can only occur once under parent: */ - else if (strcmp(node_name,"SimulationType")==0) { - parent->type = SimulationTypeNull; - parent->type_id = 0; - } - else if (strcmp(node_label,"BaseIterativeData_t")==0) parent->biter=0; - else if (strcmp(node_name,"GlobalConvergenceHistory")==0) parent->converg=0; - else if (strcmp(node_name,"FlowEquationSet")==0) parent->equations=0; - else if (strcmp(node_name,"DimensionalUnits")==0) parent->units=0; - else if (strcmp(node_name,"ReferenceState")==0) parent->state=0; - else if (strcmp(node_name,"DataClass")==0) parent->data_class = DataClassNull; - else if (strcmp(node_name,"Gravity")==0) parent->gravity=0; - else if (strcmp(node_name,"Axisymmetry")==0) parent->axisym=0; - else if (strcmp(node_name,"RotatingCoordinates")==0) parent->rotating=0; - -/* Children of Zone_t */ - } else if (strcmp(posit_label,"Zone_t")==0) { - cgns_zone *parent = (cgns_zone *)posit; - if (strcmp(node_label,"GridCoordinates_t")==0) CGNS_DELETE_SHIFT(nzcoor, zcoor) - else if (strcmp(node_label,"DiscreteData_t")==0) CGNS_DELETE_SHIFT(ndiscrete, discrete) - else if (strcmp(node_label,"Elements_t")==0) CGNS_DELETE_SHIFT(nsections, section) - else if (strcmp(node_label,"FlowSolution_t")==0) CGNS_DELETE_SHIFT(nsols, sol) - else if (strcmp(node_label,"RigidGridMotion_t")==0)CGNS_DELETE_SHIFT(nrmotions, rmotion) - else if (strcmp(node_label,"ArbitraryGridMotion_t")==0) CGNS_DELETE_SHIFT(namotions, amotion) - else if (strcmp(node_label,"IntegralData_t")==0) CGNS_DELETE_SHIFT(nintegrals, integral) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_name,"ZoneBC")==0) parent->zboco=0; - else if (strcmp(node_name,"Ordinal")==0) parent->ordinal=0; - else if (strcmp(node_name,"ZoneGridConnectivity")==0) parent->zconn=0; - else if (strcmp(node_label,"ZoneIterativeData_t")==0) parent->ziter=0; - else if (strcmp(node_name,"ReferenceState")==0) parent->state=0; - else if (strcmp(node_name,"DataClass")==0) parent->data_class = DataClassNull; - else if (strcmp(node_name,"FamilyName")==0) parent->family_name[0]='\0'; - else if (strcmp(node_name,"DimensionalUnits")==0) parent->units=0; - else if (strcmp(node_name,"FlowEquationSet")==0) parent->equations=0; - else if (strcmp(node_name,"ZoneConvergenceHistory")==0) parent->converg=0; - else if (strcmp(node_name,"RotatingCoordinates")==0) parent->rotating=0; - /* ZoneType can not be deleted */ - -/* Children of GridCoordinates_t */ - } else if (strcmp(posit_label,"GridCoordinates_t")==0) { - cgns_zcoor *parent = (cgns_zcoor *)posit; - if (strcmp(node_label,"DataArray_t")==0) CGNS_DELETE_SHIFT(ncoords, coord) - else if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_name,"Rind")==0) { - if (posit_base && posit_zone) { - index_dim = cg->base[posit_base-1].zone[posit_zone-1].index_dim; - } else { - cgi_error("Can't find IndexDimension in cg_delete"); - return CG_NO_INDEX_DIM; - } - for (n=0; n<2*index_dim; n++) parent->rind_planes[n] = 0; - } - else if (strcmp(node_name,"DataClass")==0) parent->data_class = DataClassNull; - else if (strcmp(node_name,"DimensionalUnits")==0) parent->units=0; - -/* Children of DataArray_t */ - } else if (strcmp(posit_label,"DataArray_t")==0) { - cgns_array *parent = (cgns_array *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_name,"DataClass")==0) parent->data_class = DataClassNull; - else if (strcmp(node_name,"DimensionalExponents")==0) parent->exponents=0; - else if (strcmp(node_name,"DataConversion")==0) parent->convert=0; - else if (strcmp(node_name,"DimensionalUnits")==0) parent->units=0; - -/* Children of FlowSolution_t */ - } else if (strcmp(posit_label,"FlowSolution_t")==0) { - cgns_sol *parent = (cgns_sol *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_label,"DataArray_t")==0) CGNS_DELETE_SHIFT(nfields, field) - else if (strcmp(node_name,"DataClass")==0) parent->data_class = DataClassNull; - else if (strcmp(node_name,"DimensionalUnits")==0) parent->units=0; - else if (strcmp(node_name,"GridLocation")==0) parent->location=GridLocationNull; - else if (strcmp(node_name,"Rind")==0) { - if (posit_base && posit_zone) { - index_dim = cg->base[posit_base-1].zone[posit_zone-1].index_dim; - } else { - cgi_error("Can't find IndexDimension in cg_delete"); - return CG_NO_INDEX_DIM; - } - for (n=0; n<2*index_dim; n++) parent->rind_planes[n] = 0; - } - -/* Children of ZoneGridConnectivity_t */ - } else if (strcmp(posit_label,"ZoneGridConnectivity_t")==0) { - cgns_zconn *parent = (cgns_zconn *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_label,"GridConnectivity1to1_t")==0) CGNS_DELETE_SHIFT(n1to1, one21) - else if (strcmp(node_label,"GridConnectivity_t")==0) CGNS_DELETE_SHIFT(nconns, conn) - else if (strcmp(node_label,"OversetHoles_t")==0) CGNS_DELETE_SHIFT(nholes, hole) - -/* Children of OversetHoles_t */ - } else if (strcmp(posit_label,"OversetHoles_t")==0) { - cgns_hole *parent = (cgns_hole *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_name,"GridLocation")==0) parent->location=GridLocationNull; - /* IndexRange_t & IndexArray_t can't be deleted */ - -/* Children of GridConnectivity_t */ - } else if (strcmp(posit_label,"GridConnectivity_t")==0) { - cgns_conn *parent = (cgns_conn *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) -/* test */ else if (strcmp(node_name,"InterpolantsDonor")==0) { - if (parent->dptset.type==CellListDonor) { - cgi_error("Node '%s' under '%s' can not be deleted",node_name,posit_label); - return CG_ERROR; - } else { - CGNS_DELETE_SHIFT(narrays, interpolants) - } - } - else if (strcmp(node_name,"GridLocation")==0) parent->location=GridLocationNull; - else if (strcmp(node_name,"Ordinal")==0) parent->ordinal=0; -/* test */ else if (strcmp(node_name,"GridConnectivityType")==0) parent->type=GridConnectivityTypeNull; - else if (strcmp(node_name,"GridConnectivityProperty")==0) parent->cprop=0; - /* IndexArray_t & IndexRange_t can't be deleted */ - -/* Children of GridConnectivity1to1_t */ - } else if (strcmp(posit_label,"GridConnectivity1to1_t")==0) { - cgns_1to1 *parent = (cgns_1to1 *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_name,"Ordinal")==0) parent->ordinal=0; - /* PointRange, PointRangeDonor, Transform can't be deleted */ - -/* Children of ZoneBC_t */ - } else if (strcmp(posit_label,"ZoneBC_t")==0) { - cgns_zboco *parent = (cgns_zboco *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_label,"BC_t")==0) CGNS_DELETE_SHIFT(nbocos, boco) - else if (strcmp(node_name,"DataClass")==0) parent->data_class = DataClassNull; - else if (strcmp(node_name,"DimensionalUnits")==0) parent->units=0; - else if (strcmp(node_name,"ReferenceState")==0) parent->state=0; - -/* Children of BC_t */ - } else if (strcmp(posit_label,"BC_t")==0) { - cgns_boco *parent = (cgns_boco *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_label,"BCDataSet_t")==0) CGNS_DELETE_SHIFT(ndataset, dataset) - else if (strcmp(node_name,"DataClass")==0) parent->data_class = DataClassNull; - else if (strcmp(node_name,"DimensionalUnits")==0) parent->units=0; - else if (strcmp(node_name,"GridLocation")==0) parent->location=GridLocationNull; - else if (strcmp(node_name,"InwardNormalIndex")==0) parent->Nindex=0; - else if (strcmp(node_name,"InwardNormalList")==0) parent->normal=0; - else if (strcmp(node_name,"ReferenceState")==0) parent->state=0; - else if (strcmp(node_name,"FamilyName")==0) parent->family_name[0]='\0'; - else if (strcmp(node_name,"Ordinal")==0) parent->ordinal=0; - else if (strcmp(node_name,"BCProperty")==0) parent->bprop=0; - /* IndexRange_t PointRange & IndexArray_t PointList can't be deleted */ - -/* Children of BCDataSet_t */ - } else if (strcmp(posit_label,"BCDataSet_t")==0) { - cgns_dataset *parent = (cgns_dataset *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_name,"DataClass")==0) parent->data_class = DataClassNull; - else if (strcmp(node_name,"DimensionalUnits")==0) parent->units=0; - else if (strcmp(node_name,"DirichletData")==0) parent->dirichlet=0; - else if (strcmp(node_name,"NeumannData")==0) parent->neumann=0; - else if (strcmp(node_name,"ReferenceState")==0) parent->state=0; - -/* Children of BCData_t */ - } else if (strcmp(posit_label,"BCData_t")==0) { - cgns_bcdata *parent = (cgns_bcdata *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_label,"DataArray_t")==0) CGNS_DELETE_SHIFT(narrays, array) - else if (strcmp(node_name,"DataClass")==0) parent->data_class = DataClassNull; - else if (strcmp(node_name,"DimensionalUnits")==0) parent->units=0; - -/* Children of DiscreteData_t */ - } else if (strcmp(posit_label,"DiscreteData_t")==0) { - cgns_discrete *parent = (cgns_discrete *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_label,"DataArray_t")==0) CGNS_DELETE_SHIFT(narrays, array) - else if (strcmp(node_name,"DataClass")==0) parent->data_class = DataClassNull; - else if (strcmp(node_name,"DimensionalUnits")==0) parent->units=0; - else if (strcmp(node_name,"GridLocation")==0) parent->location=GridLocationNull; - else if (strcmp(node_name,"Rind")==0) { - if (posit_base && posit_zone) { - index_dim = cg->base[posit_base-1].zone[posit_zone-1].index_dim; - } else { - cgi_error("Can't find IndexDimension in cg_delete"); - return CG_NO_INDEX_DIM; - } - for (n=0; n<2*index_dim; n++) parent->rind_planes[n] = 0; - } - -/* Children of FlowEquationSet_t */ - } else if (strcmp(posit_label,"FlowEquationSet_t")==0) { - cgns_equations *parent = (cgns_equations *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_name,"DataClass")==0) parent->data_class = DataClassNull; - else if (strcmp(node_name,"DimensionalUnits")==0) parent->units=0; - else if (strcmp(node_name,"GoverningEquations")==0) parent->governing=0; - else if (strcmp(node_name,"GasModel")==0) parent->gas=0; - else if (strcmp(node_name,"ViscosityModel")==0) parent->visc=0; - else if (strcmp(node_name,"ThermalRelaxationModel")==0) parent->relaxation=0; - else if (strcmp(node_name,"ThermalConductivityModel")==0) parent->conduct=0; - else if (strcmp(node_name,"ChemicalKineticsModel")==0) parent->chemkin=0; - else if (strcmp(node_name,"TurbulenceModel")==0) parent->turbulence=0; - else if (strcmp(node_name,"TurbulenceClosure")==0) parent->closure=0; - else if (strcmp(node_name,"EquationDimension")==0) parent->equation_dim=0; - -/* Children of GoverningEquations_t */ - } else if (strcmp(posit_label,"GoverningEquations_t")==0) { - cgns_governing *parent = (cgns_governing *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_name,"DiffusionModel")==0) parent->diffusion_model=0; - -/* Children of xxxModel_t */ - } else if (strcmp(posit_label,"GasModel_t")==0 || - strcmp(posit_label,"ViscosityModel_t")==0 || - strcmp(posit_label,"ThermalConductivityModel_t")==0 || - strcmp(posit_label,"TurbulenceModel_t")==0 || - strcmp(posit_label,"TurbulenceClosure_t")==0 || - strcmp(posit_label,"ThermalRelaxationModel_t")==0 || - strcmp(posit_label,"ChemicalKineticsModel_t")==0) { - cgns_model *parent = (cgns_model *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_label,"DataArray_t")==0) CGNS_DELETE_SHIFT(narrays, array) - else if (strcmp(node_name,"DataClass")==0) parent->data_class = DataClassNull; - else if (strcmp(node_name,"DimensionalUnits")==0) parent->units=0; - else if (strcmp(posit_label,"TurbulenceModel_t")==0 && strcmp(node_name,"DiffusionModel")==0) - parent->diffusion_model=0; - -/* Children of ConvergenceHistory_t */ - } else if (strcmp(posit_label,"ConvergenceHistory_t")==0) { - cgns_converg *parent = (cgns_converg *)posit; - if (strcmp(node_name,"NormDefinitions")==0) parent->NormDefinitions=0; - else if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_label,"DataArray_t")==0) CGNS_DELETE_SHIFT(narrays, array) - else if (strcmp(node_name,"DataClass")==0) parent->data_class = DataClassNull; - else if (strcmp(node_name,"DimensionalUnits")==0) parent->units=0; - -/* Children of IntegralData_t */ - } else if (strcmp(posit_label,"IntegralData_t")==0) { - cgns_integral *parent = (cgns_integral *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_label,"DataArray_t")==0) CGNS_DELETE_SHIFT(narrays, array) - else if (strcmp(node_name,"DataClass")==0) parent->data_class = DataClassNull; - else if (strcmp(node_name,"DimensionalUnits")==0) parent->units=0; - -/* Children of ReferenceState_t */ - } else if (strcmp(posit_label,"ReferenceState_t")==0) { - cgns_state *parent = (cgns_state *)posit; - if (strcmp(node_name,"ReferenceStateDescription")==0) parent->StateDescription=0; - else if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_label,"DataArray_t")==0) CGNS_DELETE_SHIFT(narrays, array) - else if (strcmp(node_name,"DataClass")==0) parent->data_class = DataClassNull; - else if (strcmp(node_name,"DimensionalUnits")==0) parent->units=0; - -/* Children of Family_t */ - } else if (strcmp(posit_label,"Family_t")==0) { - cgns_family *parent = (cgns_family *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_label,"GeometryReference_t")==0) CGNS_DELETE_SHIFT(ngeos, geo) - else if (strcmp(node_label,"FamilyBC_t")==0) CGNS_DELETE_SHIFT(nfambc, fambc) - else if (strcmp(node_name,"Ordinal")==0) parent->ordinal=0; - -/* Children of GeometryReference_t */ - } else if (strcmp(posit_label,"GeometryReference_t")==0) { - cgns_geo *parent = (cgns_geo *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_label,"GeometryEntity_t")==0) CGNS_DELETE_SHIFT(npart, part) - /* GeometryFile and GeometryFormat can not be deleted */ - -/* Children of Elements_t */ - } else if (strcmp(posit_label,"Elements_t")==0) { - cgns_section *parent = (cgns_section *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_name,"ParentData")==0) parent->parent=0; - /* ElementRange and ElementConnectivity can not be deleted */ - -/* Children of RigidGridMotion_t */ - } else if (strcmp(posit_label,"RigidGridMotion_t")==0) { - cgns_rmotion *parent = (cgns_rmotion *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_label,"DataArray_t")==0) CGNS_DELETE_SHIFT(narrays, array) - else if (strcmp(node_name,"DataClass")==0) parent->data_class = DataClassNull; - else if (strcmp(node_name,"DimensionalUnits")==0) parent->units=0; - -/* Children of ArbitraryGridMotion_t */ - } else if (strcmp(posit_label,"ArbitraryGridMotion_t")==0) { - cgns_amotion *parent = (cgns_amotion *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_label,"DataArray_t")==0) CGNS_DELETE_SHIFT(narrays, array) - else if (strcmp(node_name,"DataClass")==0) parent->data_class = DataClassNull; - else if (strcmp(node_name,"DimensionalUnits")==0) parent->units=0; - else if (strcmp(node_name,"GridLocation")==0) parent->location=GridLocationNull; - else if (strcmp(node_name,"Rind")==0) { - if (posit_base && posit_zone) { - index_dim = cg->base[posit_base-1].zone[posit_zone-1].index_dim; - } else { - cgi_error("Can't find IndexDimension in cg_delete"); - return CG_NO_INDEX_DIM; - } - for (n=0; n<2*index_dim; n++) parent->rind_planes[n] = 0; - } - -/* Children of BaseIterativeData_t */ - } else if (strcmp(posit_label,"BaseIterativeData_t")==0) { - cgns_biter *parent = (cgns_biter *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_label,"DataArray_t")==0) CGNS_DELETE_SHIFT(narrays, array) - else if (strcmp(node_name,"DataClass")==0) parent->data_class = DataClassNull; - else if (strcmp(node_name,"DimensionalUnits")==0) parent->units=0; - -/* Children of ZoneIterativeData_t */ - } else if (strcmp(posit_label,"ZoneIterativeData_t")==0) { - cgns_ziter *parent = (cgns_ziter *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_label,"DataArray_t")==0) CGNS_DELETE_SHIFT(narrays, array) - else if (strcmp(node_name,"DataClass")==0) parent->data_class = DataClassNull; - else if (strcmp(node_name,"DimensionalUnits")==0) parent->units=0; - -/* Children of UserDefinedData_t */ - } else if (strcmp(posit_label,"UserDefinedData_t")==0) { - cgns_user_data *parent = (cgns_user_data *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"DataArray_t")==0) CGNS_DELETE_SHIFT(narrays, array) - else if (strcmp(node_name,"DataClass")==0) parent->data_class = DataClassNull; - else if (strcmp(node_name,"DimensionalUnits")==0) parent->units=0; - -/* Children of Gravity_t */ - } else if (strcmp(posit_label,"Gravity_t")==0) { - cgns_gravity *parent = (cgns_gravity *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_name,"DataClass")==0) parent->data_class = DataClassNull; - else if (strcmp(node_name,"DimensionalUnits")==0) parent->units=0; - -/* Children of Axisymmetry_t */ - } else if (strcmp(posit_label,"Axisymmetry_t")==0) { - cgns_axisym *parent = (cgns_axisym *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_label,"DataArray_t")==0) CGNS_DELETE_SHIFT(narrays, array) - else if (strcmp(node_name,"DataClass")==0) parent->data_class = DataClassNull; - else if (strcmp(node_name,"DimensionalUnits")==0) parent->units=0; - -/* RotatingCoordinates_t */ - } else if (strcmp(posit_label,"RotatingCoordinates_t")==0) { - cgns_rotating *parent = (cgns_rotating *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_label,"DataArray_t")==0) CGNS_DELETE_SHIFT(narrays, array) - else if (strcmp(node_name,"DataClass")==0) parent->data_class = DataClassNull; - else if (strcmp(node_name,"DimensionalUnits")==0) parent->units=0; - -/* BCProperty_t */ - } else if (strcmp(posit_label,"BCProperty_t")==0) { - cgns_bprop *parent = (cgns_bprop *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_name,"WallFunction")==0) parent->bcwall = 0; - else if (strcmp(node_name,"Area")==0) parent->bcarea = 0; - -/* WallFunction_t */ - } else if (strcmp(posit_label,"WallFunction_t")==0) { - cgns_bcwall *parent = (cgns_bcwall *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - /* node WallFunctionType can't be deleted */ - -/* Area_t */ - } else if (strcmp(posit_label,"Area_t")==0) { - cgns_bcarea *parent = (cgns_bcarea *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - /* nodes AreaType, SurfaceArea and RegionName can't be deleted */ - -/* GridConnectivityProperty_t */ - } else if (strcmp(posit_label,"GridConnectivityProperty_t")==0) { - cgns_cprop *parent = (cgns_cprop *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_name,"Periodic")==0) parent->cperio=0; - else if (strcmp(node_name,"AverageInterface")==0) parent->caverage=0; - -/* Periodic_t */ - } else if (strcmp(posit_label,"Periodic_t")==0) { - cgns_cperio *parent = (cgns_cperio *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - else if (strcmp(node_name,"DataClass")==0) parent->data_class = DataClassNull; - else if (strcmp(node_name,"DimensionalUnits")==0) parent->units=0; - /* RotationCenter, RotationAngle and Translation can't be deleted */ - -/* AverageInterface_t */ - } else if (strcmp(posit_label,"AverageInterface_t")==0) { - cgns_caverage *parent = (cgns_caverage *)posit; - if (strcmp(node_label,"Descriptor_t")==0) CGNS_DELETE_SHIFT(ndescr, descr) - else if (strcmp(node_label,"UserDefinedData_t")==0) CGNS_DELETE_SHIFT(nuser_data, user_data) - /* AverageInterfaceType can't be deleted */ - - } else { - cgi_error("Unrecognized label: '%s'",posit_label); - return CG_ERROR; - } - return CG_OK; -} diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/cgnslib.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/cgnslib.h deleted file mode 100644 index c0000f8975..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/cgnslib.h +++ /dev/null @@ -1,803 +0,0 @@ -#ifndef CGNSLIB_H -#define CGNSLIB_H - -#define CGNS_VERSION 2300 -#define CGNS_DOTVERS 2.30 - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * modes for cgns file * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -#define MODE_READ 0 -#define MODE_WRITE 1 -#define MODE_CLOSED 2 -#define MODE_MODIFY 3 - -#define CG_OK 0 -#define CG_ERROR 1 -#define CG_NODE_NOT_FOUND 2 -#define CG_INCORRECT_PATH 3 -#define CG_NO_INDEX_DIM 4 - -#define Null 0 -#define UserDefined 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Enumerations: if any of this enumerations need to be modified, * - * the corresponding namelist must also be updated. * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Dimensional Units * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -typedef enum { - MassUnitsNull, MassUnitsUserDefined, - Kilogram, Gram, Slug, PoundMass -} MassUnits_t; - -typedef enum { - LengthUnitsNull, LengthUnitsUserDefined, - Meter, Centimeter, Millimeter, Foot, Inch -} LengthUnits_t; - -typedef enum { - TimeUnitsNull, TimeUnitsUserDefined, Second -} TimeUnits_t; - -typedef enum { - TemperatureUnitsNull, TemperatureUnitsUserDefined, - Kelvin, Celcius, Rankine, Fahrenheit -} TemperatureUnits_t; - -typedef enum { - AngleUnitsNull, AngleUnitsUserDefined, Degree, Radian -} AngleUnits_t; - -#define NofValidMassUnits 6 -#define NofValidLengthUnits 7 -#define NofValidTimeUnits 3 -#define NofValidTemperatureUnits 6 -#define NofValidAngleUnits 4 - -extern char const * MassUnitsName[NofValidMassUnits]; -extern char const * LengthUnitsName[NofValidLengthUnits]; -extern char const * TimeUnitsName[NofValidTimeUnits]; -extern char const * TemperatureUnitsName[NofValidTemperatureUnits]; -extern char const * AngleUnitsName[NofValidAngleUnits]; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Data Class * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -typedef enum { - DataClassNull, DataClassUserDefined, - Dimensional, NormalizedByDimensional, - NormalizedByUnknownDimensional, - NondimensionalParameter, DimensionlessConstant -} DataClass_t; -#define NofValidDataClass 7 -extern char const * DataClassName[NofValidDataClass]; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Grid Location -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -typedef enum { - GridLocationNull, GridLocationUserDefined, - Vertex, CellCenter, FaceCenter, - IFaceCenter, JFaceCenter, KFaceCenter, EdgeCenter -} GridLocation_t; - -#define NofValidGridLocation 9 -extern char const * GridLocationName[NofValidGridLocation]; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * BCData Types: Can not add types and stay forward compatible * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -typedef enum { - BCDataTypeNull, BCDataTypeUserDefined, - Dirichlet, Neumann -} BCDataType_t; -#define NofValidBCDataTypes 4 -extern char const * BCDataTypeName[NofValidBCDataTypes]; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Grid Connectivity Types * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -typedef enum { - GridConnectivityTypeNull, GridConnectivityTypeUserDefined, - Overset, Abutting, Abutting1to1 -} GridConnectivityType_t; - -#define NofValidGridConnectivityTypes 5 -extern char const * GridConnectivityTypeName[NofValidGridConnectivityTypes]; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Point Set Types: Can't add types and stay forward compatible -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -typedef enum { - PointSetTypeNull, PointSetTypeUserDefined, - PointList, PointListDonor, - PointRange, PointRangeDonor, - ElementRange, ElementList, CellListDonor -} PointSetType_t; - -#define NofValidPointSetTypes 9 -extern char const * PointSetTypeName[NofValidPointSetTypes]; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Governing Equations and Physical Models Types * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -typedef enum { - GoverningEquationsNull, GoverningEquationsUserDefined, - FullPotential, Euler, NSLaminar, NSTurbulent, - NSLaminarIncompressible, NSTurbulentIncompressible -} GoverningEquationsType_t; - -/* Any model type will accept both ModelTypeNull and ModelTypeUserDefined. -** The following models will accept these values as vaild... -** -** GasModel_t: Ideal, VanderWaals, CaloricallyPerfect, ThermallyPerfect, -** ConstantDensity, RedlichKwong -** -** ViscosityModel_t: Constant, PowerLaw, SutherlandLaw -** -** ThermalConductivityModel_t: PowerLaw, SutherlandLaw, ConstantPrandtl -** -** TurbulenceModel_t: Algebraic_BaldwinLomax, Algebraic_CebeciSmith, -** HalfEquation_JohnsonKing, OneEquation_BaldwinBarth, -** OneEquation_SpalartAllmaras, TwoEquation_JonesLaunder, -** TwoEquation_MenterSST,TwoEquation_Wilcox -** -** TurbulenceClosure_t: EddyViscosity, ReynoldsStress, ReynoldsStressAlgebraic -** -** ThermalRelaxationModel_t: Frozen, ThermalEquilib, ThermalNonequilib -** -** ChemicalKineticsModel_t: Frozen, ChemicalEquilibCurveFit, -** ChemicalEquilibMinimization, ChemicalNonequilib -*/ - -typedef enum { - ModelTypeNull, ModelTypeUserDefined, - Ideal, VanderWaals, - Constant, - PowerLaw, SutherlandLaw, - ConstantPrandtl, - EddyViscosity, ReynoldsStress, ReynoldsStressAlgebraic, - Algebraic_BaldwinLomax, Algebraic_CebeciSmith, - HalfEquation_JohnsonKing, OneEquation_BaldwinBarth, - OneEquation_SpalartAllmaras, TwoEquation_JonesLaunder, - TwoEquation_MenterSST, TwoEquation_Wilcox, - CaloricallyPerfect, ThermallyPerfect, - ConstantDensity, RedlichKwong, - Frozen, ThermalEquilib, ThermalNonequilib, - ChemicalEquilibCurveFit, ChemicalEquilibMinimization, - ChemicalNonequilib -} ModelType_t; - -#define NofValidGoverningEquationsTypes 8 -#define NofValidModelTypes 29 - -extern char const * GoverningEquationsTypeName[NofValidGoverningEquationsTypes]; -extern char const * ModelTypeName[NofValidModelTypes]; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Boundary Condition Types * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -typedef enum { - BCTypeNull, BCTypeUserDefined, - BCAxisymmetricWedge, BCDegenerateLine, BCDegeneratePoint, - BCDirichlet, BCExtrapolate, BCFarfield, BCGeneral, BCInflow, - BCInflowSubsonic, BCInflowSupersonic, BCNeumann, BCOutflow, - BCOutflowSubsonic, BCOutflowSupersonic, BCSymmetryPlane, - BCSymmetryPolar, BCTunnelInflow, BCTunnelOutflow, BCWall, - BCWallInviscid, BCWallViscous, BCWallViscousHeatFlux, - BCWallViscousIsothermal, FamilySpecified -} BCType_t; - -#define NofValidBCTypes 26 -extern char const * BCTypeName[NofValidBCTypes]; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Data types: Can not add data types and stay forward compatible * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -typedef enum { - DataTypeNull, DataTypeUserDefined, Integer, RealSingle, - RealDouble, Character -} DataType_t; -#define NofValidDataTypes 6 -extern char const * DataTypeName[NofValidDataTypes]; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Element types * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -typedef enum { - ElementTypeNull, ElementTypeUserDefined, /* 0, 1, */ - NODE, BAR_2, BAR_3, /* 2, 3, 4, */ - TRI_3, TRI_6, /* 5, 6, */ - QUAD_4, QUAD_8, QUAD_9, /* 7, 8, 9, */ - TETRA_4, TETRA_10, /* 10, 11, */ - PYRA_5, PYRA_14, /* 12, 13, */ - PENTA_6, PENTA_15, PENTA_18, /* 14, 15, 16, */ - HEXA_8, HEXA_20, HEXA_27, /* 17, 18, 19, */ - MIXED, NGON_n /* 20, 21+ */ -} ElementType_t; -#define NofValidElementTypes 22 -extern char const * ElementTypeName[NofValidElementTypes]; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Zone types * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -typedef enum { - ZoneTypeNull, ZoneTypeUserDefined, - Structured, Unstructured -} ZoneType_t; -#define NofValidZoneTypes 4 -extern char const * ZoneTypeName[NofValidZoneTypes]; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Rigid Grid Motion types * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -typedef enum { - RigidGridMotionTypeNull, RigidGridMotionTypeUserDefined, - ConstantRate, VariableRate -} RigidGridMotionType_t; -#define NofValidRigidGridMotionTypes 4 -extern char const * RigidGridMotionTypeName[NofValidRigidGridMotionTypes]; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Arbitrary Grid Motion types * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -typedef enum { - ArbitraryGridMotionTypeNull, ArbitraryGridMotionTypeUserDefined, - NonDeformingGrid, DeformingGrid -} ArbitraryGridMotionType_t; -#define NofValidArbitraryGridMotionTypes 4 -extern char const * ArbitraryGridMotionTypeName[NofValidArbitraryGridMotionTypes]; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Simulation types * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -typedef enum { - SimulationTypeNull, SimulationTypeUserDefined, - TimeAccurate, NonTimeAccurate -} SimulationType_t; -#define NofValidSimulationTypes 4 -extern char const * SimulationTypeName[NofValidSimulationTypes]; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * BC Property types * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -typedef enum { - WallFunctionTypeNull, WallFunctionTypeUserDefined, - Generic -} WallFunctionType_t; -#define NofValidWallFunctionTypes 3 -extern char const * WallFunctionTypeName[NofValidWallFunctionTypes]; - -typedef enum { - AreaTypeNull, AreaTypeUserDefined, - BleedArea, CaptureArea -} AreaType_t; -#define NofValidAreaTypes 4 -extern char const * AreaTypeName[NofValidAreaTypes]; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Grid Connectivity Property types * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -typedef enum { - AverageInterfaceTypeNull, AverageInterfaceTypeUserDefined, - AverageAll, AverageCircumferential, AverageRadial, AverageI, - AverageJ, AverageK -} AverageInterfaceType_t; -#define NofValidAverageInterfaceTypes 8 -extern char const * AverageInterfaceTypeName[NofValidAverageInterfaceTypes]; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * LIBRARY FUNCTIONS * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_open(char const * filename, int mode, int *fn); -int cg_version(int fn, float *FileVersion); -int cg_close(int fn); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write CGNSBase_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_nbases(int fn, int *nbases); -int cg_base_read(int file_number, int B, char *basename, int *cell_dim, - int *phys_dim); -int cg_base_id(int fn, int B, double *base_id); -int cg_base_write(int file_number, char const * basename, int cell_dim, - int phys_dim, int *B); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write Zone_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_nzones(int fn, int B, int *nzones); -int cg_zone_read(int fn, int B, int Z, char *zonename, int *size); -int cg_zone_type(int file_number, int B, int Z, ZoneType_t *type); -int cg_zone_id(int fn, int B, int Z, double *zone_id); -int cg_zone_write(int fn, int B, char const * zonename, int const * size, - ZoneType_t type, int *Z); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write Family_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_nfamilies(int file_number, int B, int *nfamilies); -int cg_family_read(int file_number, int B, int F, char *family_name, - int *nboco, int *ngeos); -int cg_family_write(int file_number, int B, char const * family_name, int *F); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write FamilyName_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_famname_read(char *family_name); -int cg_famname_write(char const * family_name); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write FamilyBC_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_fambc_read(int file_number, int B, int F, int BC, char *fambc_name, - BCType_t *bocotype); -int cg_fambc_write(int file_number, int B, int F, char const * fambc_name, - BCType_t bocotype, int *BC); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write GeometryReference_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_geo_read(int file_number, int B, int F, int G, char *geo_name, - char **geo_file, char *CAD_name, int *npart); -int cg_geo_write(int file_number, int B, int F, char const * geo_name, - char const * filename, char const * CADname, int *G); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write GeometryEntity_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_part_read(int file_number, int B, int F, int G, int P, - char *part_name); -int cg_part_write(int file_number, int B, int F, int G, char const * part_name, - int *P); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write GridCoordinates_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_ngrids(int file_number, int B, int Z, int *ngrids); -int cg_grid_read(int file_number, int B, int Z, int G, char *gridname); -int cg_grid_write(int file_number, int B, int Z, char const * zcoorname, int *G); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write GridCoordinates_t/DataArray_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_ncoords(int fn, int B, int Z, int *ncoords); -int cg_coord_info(int fn, int B, int Z, int C, DataType_t *type, char *coordname); -int cg_coord_read(int fn, int B, int Z, char const * coordname, DataType_t type, - int const * rmin, int const * rmax, void *coord); -int cg_coord_id(int fn, int B, int Z, int C, double *coord_id); -int cg_coord_write(int fn, int B, int Z, DataType_t type, char const * coordname, - void const * coord_ptr, int *C); - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write Elements_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_nsections(int file_number, int B, int Z, int *nsections); -int cg_section_read(int file_number, int B, int Z, int S, char *SectionName, - ElementType_t *type, int *start, int *end, int *nbndry, int *parent_flag); -int cg_elements_read(int file_number, int B, int Z, int S, int *elements, - int *parent_data); -int cg_section_write(int file_number, int B, int Z, char const * SectionName, - ElementType_t type, int start, int end, int nbndry, int const * elements, int *S); -int cg_parent_data_write(int file_number, int B, int Z, int S, int const * parent_data); -int cg_npe(ElementType_t type, int *npe); -int cg_ElementDataSize(int file_number, int B, int Z, int S, int *ElementDataSize); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write FlowSolution_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - -int cg_nsols(int fn, int B, int Z, int *nsols); -int cg_sol_info(int fn, int B, int Z, int S, char *solname, GridLocation_t *location); -int cg_sol_id(int fn, int B, int Z,int S, double *sol_id); -int cg_sol_write(int fn, int B, int Z, char const * solname, GridLocation_t location, int *S); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write solution DataArray_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_nfields(int fn, int B, int Z, int S, int *nfields); -int cg_field_info(int fn,int B,int Z,int S,int F, DataType_t *type, char *fieldname); -int cg_field_read(int fn, int B, int Z, int S, char *fieldname, DataType_t type, - int *rmin, int *rmax, void *field_ptr); -int cg_field_id(int fn, int B, int Z,int S,int F, double *field_id); -int cg_field_write(int fn,int B,int Z,int S, DataType_t type, char const * fieldname, - void const * field_ptr, int *F); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write OversetHoles_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_nholes(int fn, int B, int Z, int *nholes); -int cg_hole_info(int fn, int B, int Z, int I, char *holename, GridLocation_t *location, - PointSetType_t *ptset_type, int *nptsets, int *npnts); -int cg_hole_read(int fn, int B, int Z, int I, int *pnts); -int cg_hole_id(int fn, int B, int Z, int I, double *hole_id); -int cg_hole_write(int fn, int B, int Z, char const * holename, GridLocation_t location, - PointSetType_t ptset_type, int nptsets, int npnts, int const * pnts, int *I); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write GridConnectivity_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_nconns(int fn, int B, int Z, int *nconns); -int cg_conn_info(int file_number, int B, int Z, int I, char *connectname, - GridLocation_t *location, GridConnectivityType_t *type, - PointSetType_t *ptset_type, int *npnts, char *donorname, - ZoneType_t *donor_zonetype, PointSetType_t *donor_ptset_type, - DataType_t *donor_datatype, int *ndata_donor); -int cg_conn_read(int file_number, int B, int Z, int I, int *pnts, - DataType_t donor_datatype, void *donor_data); -int cg_conn_id(int fn, int B, int Z, int I, double *conn_id); -int cg_conn_write(int file_number, int B, int Z, char const * connectname, GridLocation_t location, - GridConnectivityType_t type, PointSetType_t ptset_type, int npnts, int const * pnts, - char const * donorname, ZoneType_t donor_zonetype, PointSetType_t donor_ptset_type, - DataType_t donor_datatype, int ndata_donor, void const *donor_data, int *I); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write GridConnectivity1to1_t Nodes in a zone * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_n1to1(int fn, int B, int Z, int *n1to1); -int cg_1to1_read(int fn, int B, int Z, int I, char *connectname, char *donorname, - int *range, int *donor_range, int *transform); -int cg_1to1_id(int fn, int B, int Z, int I, double *one21_id); -int cg_1to1_write(int fn, int B, int Z, char const * connectname, char const * donorname, - int const * range, int const * donor_range, int const * transform, int *I); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read all GridConnectivity1to1_t Nodes of a base * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -int cg_n1to1_global(int fn, int B, int *n1to1_global); -int cg_1to1_read_global(int fn, int B, char **connectname, char **zonename, - char **donorname, int **range, int **donor_range, int **transform); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write BC_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_nbocos(int fn, int B, int Z, int *nbocos); -int cg_boco_info(int fn, int B, int Z, int BC, char *boconame, - BCType_t *bocotype, PointSetType_t *ptset_type, int *npnts, - int *NormalIndex, int *NormalListFlag, DataType_t *NormalDataType, - int *ndataset); -int cg_boco_read(int fn, int B, int Z, int BC, int *pnts, void *NormalList); -int cg_boco_id(int fn, int B, int Z, int BC, double *boco_id); -int cg_boco_write(int file_number, int B, int Z, char const * boconame, BCType_t bocotype, - PointSetType_t ptset_type, int npnts, int const * pnts, int *BC); -int cg_boco_normal_write(int file_number, int B, int Z, int BC, int const * NormalIndex, - int NormalListFlag, DataType_t NormalDataType, void const * NormalList); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write BCDataSet_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_dataset_read(int fn, int B, int Z, int BC, int DS, char *name, - BCType_t *BCType, int *DirichletFlag, int *NeumannFlag); -int cg_dataset_write(int file_number, int B, int Z, int BC, char const * name, - BCType_t BCType, int *Dset); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write BCData_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_bcdata_write(int file_number, int B, int Z, int BC, int Dset, - BCDataType_t BCDataType); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write DiscreteData_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_ndiscrete(int file_number, int B, int Z, int *ndiscrete); -int cg_discrete_read(int file_number, int B, int Z, int D, char *discrete_name); -int cg_discrete_write(int file_number, int B, int Z, char const * discrete_name, int *D); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write RigidGridMotion_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_n_rigid_motions(int file_number, int B, int Z, int *n_rigid_motions); -int cg_rigid_motion_read(int file_number, int B, int Z, int R, char *name, - RigidGridMotionType_t *type); -int cg_rigid_motion_write(int file_number, int B, int Z, char const * name, - RigidGridMotionType_t type, int *R); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write ArbitraryGridMotion_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_n_arbitrary_motions(int file_number, int B, int Z, int *n_arbitrary_motions); -int cg_arbitrary_motion_read(int file_number, int B, int Z, int A, char *name, - ArbitraryGridMotionType_t *type); -int cg_arbitrary_motion_write(int file_number, int B, int Z, char const * amotionname, - ArbitraryGridMotionType_t type, int *A); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write SimulationType_t Node * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_simulation_type_read(int file_number, int B, SimulationType_t *type); -int cg_simulation_type_write(int file_number, int B, SimulationType_t type); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write BaseIterativeData_t Node * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_biter_read(int file_number, int B, char *bitername, int *nsteps); -int cg_biter_write(int file_number, int B, char const * bitername, int nsteps); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write ZoneIterativeData_t Node * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_ziter_read(int file_number, int B, int Z, char *zitername); -int cg_ziter_write(int file_number, int B, int Z, char const * zitername); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write Gravity_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_gravity_read(int file_number, int B, float *gravity_vector); -int cg_gravity_write(int file_number, int B, float const *gravity_vector); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write Axisymmetry_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_axisym_read(int file_number, int B, float *ref_point, float *axis); -int cg_axisym_write(int file_number, int B, float const *ref_point, - float const *axis); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write RotatingCoordinates_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_rotating_read(float *rot_rate, float *rot_center); -int cg_rotating_write(float const *rot_rate, float const *rot_center); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write BCProperty_t/WallFunction_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_bc_wallfunction_read(int file_number, int B, int Z, int BC, - WallFunctionType_t *WallFunctionType); -int cg_bc_wallfunction_write(int file_number, int B, int Z, int BC, - WallFunctionType_t WallFunctionType); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write BCProperty_t/Area_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_bc_area_read(int file_number, int B, int Z, int BC, - AreaType_t *AreaType, float *SurfaceArea, char *RegionName); -int cg_bc_area_write(int file_number, int B, int Z, int BC, - AreaType_t AreaType, float SurfaceArea, char const *RegionName); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write GridConnectivityProperty_t/Periodic_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_conn_periodic_read(int file_number, int B, int Z, int I, - float *RotationCenter, float *RotationAngle, float *Translation); -int cg_conn_periodic_write(int file_number, int B, int Z, int I, - float const *RotationCenter, float const *RotationAngle, - float const *Translation); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write GridConnectivityProperty_t/AverageInterface_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_conn_average_read(int file_number, int B, int Z, int I, - AverageInterfaceType_t *AverageInterfaceType); -int cg_conn_average_write(int file_number, int B, int Z, int I, - AverageInterfaceType_t AverageInterfaceType); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Variable Argument List Functions * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_goto(int file_number, int B, ...); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write ConvergenceHistory_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_convergence_read(int *iterations, char **NormDefinitions); -int cg_convergence_write(int iterations, char const * NormDefinitions); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write ReferenceState_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_state_read(char **StateDescription); -int cg_state_write(char const * StateDescription); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write FlowEquationSet_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_equationset_read(int *EquationDimension, - int *GoverningEquationsFlag, int *GasModelFlag, - int *ViscosityModelFlag, int *ThermalConductivityModelFlag, - int *TurbulenceClosureFlag, int *TurbulenceModelFlag); -int cg_equationset_chemistry_read(int *ThermalRelaxationFlag, - int *ChemicalKineticsFlag); -int cg_equationset_write(int EquationDimension); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write GoverningEquations_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_governing_read(GoverningEquationsType_t *EquationsType); -int cg_governing_write(GoverningEquationsType_t Equationstype); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write Diffusion Model Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_diffusion_read(int *diffusion_model); -int cg_diffusion_write(int const * diffusion_model); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write GasModel_t, ViscosityModel_t, * - * ThermalConductivityModel_t, TurbulenceClosure_t, * - * TurbulenceModel_t, ThermalRelaxationModel_t, * - * ChemicalKineticsModel_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_model_read(char *ModelLabel, ModelType_t *ModelType); -int cg_model_write(char const * ModelLabel, ModelType_t ModelType); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write DataArray_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_narrays(int *narrays); -int cg_array_info(int A, char *ArrayName, DataType_t *DataType, - int *DataDimension, int *DimensionVector); -int cg_array_read(int A, void *Data); -int cg_array_read_as(int A, DataType_t type, void *Data); -int cg_array_write(char const * ArrayName, DataType_t DataType, - int DataDimension, int const * DimensionVector, void const * Data); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write UserDefinedData_t Nodes - new in version 2.1 * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_nuser_data(int *nuser_data); -int cg_user_data_read(int Index, char *user_data_name); -int cg_user_data_write(char const * user_data_name); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write IntegralData_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_nintegrals(int *nintegrals); -int cg_integral_read(int IntegralDataIndex, char *IntegralDataName); -int cg_integral_write(char const * IntegralDataName); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write Rind_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_rind_read(int *RindData); -int cg_rind_write(int const * RindData); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write Descriptor_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_ndescriptors(int *ndescriptors); -int cg_descriptor_read(int descr_no, char *descr_name, char **descr_text); -int cg_descriptor_write(char const * descr_name, char const * descr_text); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write DimensionalUnits_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_units_read(MassUnits_t *mass, LengthUnits_t *length, TimeUnits_t *time, - TemperatureUnits_t *temperature, AngleUnits_t *angle); -int cg_units_write(MassUnits_t mass, LengthUnits_t length, TimeUnits_t time, - TemperatureUnits_t temperature, AngleUnits_t angle); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write DimensionalExponents_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_exponents_info(DataType_t *DataType); -int cg_exponents_read(void *exponents); -int cg_exponents_write(DataType_t DataType, void const * exponents); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write DataConversion_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_conversion_info(DataType_t *DataType); -int cg_conversion_read(void *ConversionFactors); -int cg_conversion_write(DataType_t DataType, void const * ConversionFactors); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write DataClass_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_dataclass_read(DataClass_t *dataclass); -int cg_dataclass_write(DataClass_t dataclass); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write GridLocation_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_gridlocation_read(GridLocation_t *GridLocation); -int cg_gridlocation_write(GridLocation_t GridLocation); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Read and write Ordinal_t Nodes * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_ordinal_read(int *Ordinal); -int cg_ordinal_write(int Ordinal); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Link Handling Functions - new in version 2.1 * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_is_link(int *path_length); -int cg_link_read(char **filename, char **link_path); -int cg_link_write(char const * nodename, char const * filename, char const * name_in_file); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * General Delete Function * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -int cg_delete_node(char *node_name); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ - * Error Handling Functions * -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -char const *cg_get_error(void); -void cg_error_exit(void); -void cg_error_print(void); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/cgnslib_f.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/cgnslib_f.h deleted file mode 100644 index f5e717f078..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/cgnslib_f.h +++ /dev/null @@ -1,511 +0,0 @@ -! Fortran version of cgnslib.h - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* modes for cgns file * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - integer MODE_READ, MODE_WRITE, MODE_CLOSED, MODE_MODIFY - parameter (MODE_READ = 0) - parameter (MODE_WRITE = 1) - parameter (MODE_CLOSED = 2) - parameter (MODE_MODIFY = 3) - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* some error code * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - integer ALL_OK, ERROR, NODE_NOT_FOUND, INCORRECT_PATH - parameter (ALL_OK = 0) - parameter (ERROR = 1) - parameter (NODE_NOT_FOUND = 2) - parameter (INCORRECT_PATH = 3) - - integer CG_OK, CG_ERROR, CG_NODE_NOT_FOUND, CG_INCORRECT_PATH - parameter (CG_OK = 0) - parameter (CG_ERROR = 1) - parameter (CG_NODE_NOT_FOUND = 2) - parameter (CG_INCORRECT_PATH = 3) - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Dimensional Units * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - integer UserDefined, Null - parameter (Null = 0) - parameter (UserDefined = 1) - - integer Kilogram, Gram, Slug, PoundMass - character*32 MassUnitsName(0:5) - parameter (Kilogram = 2) - parameter (Gram = 3) - parameter (Slug = 4) - parameter (PoundMass = 5) - - integer Meter, Centimeter, Millimeter - integer Foot, Inch - character*32 LengthUnitsName(0:6) - parameter (Meter = 2) - parameter (Centimeter = 3) - parameter (Millimeter = 4) - parameter (Foot = 5) - parameter (Inch = 6) - - integer Second - character*32 TimeUnitsName(0:2) - parameter (Second = 2) - - integer Kelvin, Celcius, Rankine, Fahrenheit - character*32 TemperatureUnitsName(0:5) - parameter (Kelvin = 2) - parameter (Celcius = 3) - parameter (Rankine = 4) - parameter (Fahrenheit = 5) - - integer Degree, Radian - character*32 AngleUnitsName(0:3) - parameter (Degree = 2) - parameter (Radian = 3) - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Data Class * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - integer Dimensional, NormalizedByDimensional - integer NormalizedByUnknownDimensional - integer NondimensionalParameter, DimensionlessConstant - character*32 DataClassName(0:6) - parameter (Dimensional = 2) - parameter (NormalizedByDimensional = 3) - parameter (NormalizedByUnknownDimensional = 4) - parameter (NondimensionalParameter = 5) - parameter (DimensionlessConstant = 6) - - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Grid Location * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - integer Vertex, CellCenter, FaceCenter - integer IFaceCenter, JFaceCenter, KFaceCenter, EdgeCenter - character*32 GridLocationName(0:8) - parameter (Vertex = 2) - parameter (CellCenter = 3) - parameter (FaceCenter = 4) - parameter (IFaceCenter = 5) - parameter (JFaceCenter = 6) - parameter (KFaceCenter = 7) - parameter (EdgeCenter = 8) - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Grid Connectivity Types * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - integer Overset, Abutting, Abutting1to1 - character*32 GridConnectivityTypeName(0:4) - parameter (Overset = 2) - parameter (Abutting = 3) - parameter (Abutting1to1 = 4) - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Point Set Types * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - integer PointList, PointListDonor, PointRange, PointRangeDonor - integer ElementRange, ElementList, CellListDonor - character*32 PointSetTypeName(0:8) - parameter (PointList = 2) - parameter (PointListDonor = 3) - parameter (PointRange = 4) - parameter (PointRangeDonor = 5) - parameter (ElementRange = 6) - parameter (ElementList = 7) - parameter (CellListDonor = 8) - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Governing Equations and Physical Models Types * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - integer FullPotential, Euler - integer NSLaminar, NSTurbulent - integer NSLaminarIncompressible - integer NSTurbulentIncompressible - character*32 GoverningEquationsTypeName(0:7) - parameter (FullPotential = 2) - parameter (Euler = 3) - parameter (NSLaminar = 4) - parameter (NSTurbulent = 5) - parameter (NSLaminarIncompressible = 6) - parameter (NSTurbulentIncompressible = 7) - -!** Any model type will accept both ModelTypeNull and ModelTypeUserDefined. -!** The following models will accept these values as vaild... -!** -!** GasModel_t: Ideal, VanderWaals, CaloricallyPerfect, ThermallyPerfect, -!** ConstantDensity, RedlichKwong -!** -!** ViscosityModel_t: Constant, PowerLaw, SutherlandLaw -!** -!** ThermalConductivityModel_t: PowerLaw, SutherlandLaw, ConstantPrandtl -!** -!** TurbulenceModel_t: Algebraic_BaldwinLomax, Algebraic_CebeciSmith, -!** HalfEquation_JohnsonKing, OneEquation_BaldwinBarth, -!** OneEquation_SpalartAllmaras, TwoEquation_JonesLaunder, -!** TwoEquation_MenterSST,TwoEquation_Wilcox -!** -!** TurbulenceClosure_t: EddyViscosity, ReynoldsStress, ReynoldsStressAlgebraic -!** -!** ThermalRelaxationModel_t: Frozen, ThermalEquilib, ThermalNonequilib -!** -!** ChemicalKineticsModel_t: Frozen, ChemicalEquilibCurveFit, -!** ChemicalEquilibMinimization, ChemicalNonequilib - - integer Ideal, VanderWaals - integer Constant - integer PowerLaw, SutherlandLaw - integer ConstantPrandtl - integer EddyViscosity, ReynoldsStress, ReynoldsStressAlgebraic - integer Algebraic_BaldwinLomax, Algebraic_CebeciSmith - integer HalfEquation_JohnsonKing, OneEquation_BaldwinBarth - integer OneEquation_SpalartAllmaras, TwoEquation_JonesLaunder - integer TwoEquation_MenterSST, TwoEquation_Wilcox - integer CaloricallyPerfect, ThermallyPerfect - integer ConstantDensity, RedlichKwong - integer Frozen, ThermalEquilib, ThermalNonequilib - integer ChemicalEquilibCurveFit, ChemicalEquilibMinimization - integer ChemicalNonequilib - character*32 ModelTypeName(0:28) - - parameter (Ideal = 2) - parameter (VanderWaals = 3) - parameter (Constant = 4) - parameter (PowerLaw = 5) - parameter (SutherlandLaw = 6) - parameter (ConstantPrandtl = 7) - parameter (EddyViscosity = 8) - parameter (ReynoldsStress = 9) - parameter (ReynoldsStressAlgebraic = 10) - parameter (Algebraic_BaldwinLomax = 11) - parameter (Algebraic_CebeciSmith = 12) - parameter (HalfEquation_JohnsonKing = 13) - parameter (OneEquation_BaldwinBarth = 14) - parameter (OneEquation_SpalartAllmaras = 15) - parameter (TwoEquation_JonesLaunder = 16) - parameter (TwoEquation_MenterSST = 17) - parameter (TwoEquation_Wilcox = 18) - parameter (CaloricallyPerfect = 19) - parameter (ThermallyPerfect = 20) - parameter (ConstantDensity = 21) - parameter (RedlichKwong = 22) - parameter (Frozen = 23) - parameter (ThermalEquilib = 24) - parameter (ThermalNonequilib = 25) - parameter (ChemicalEquilibCurveFit = 26) - parameter (ChemicalEquilibMinimization = 27) - parameter (ChemicalNonequilib = 28) - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Boundary Condition Types * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - integer BCAxisymmetricWedge, BCDegenerateLine, BCDegeneratePoint - integer BCDirichlet, BCExtrapolate, BCFarfield, BCGeneral - integer BCInflow, BCInflowSubsonic, BCInflowSupersonic - integer BCNeumann - integer BCOutflow, BCOutflowSubsonic, BCOutflowSupersonic - integer BCSymmetryPlane, BCSymmetryPolar - integer BCTunnelInflow, BCTunnelOutflow - integer BCWall, BCWallInviscid, BCWallViscous - integer BCWallViscousHeatFlux, BCWallViscousIsothermal - integer FamilySpecified - character*32 BCTypeName(0:25) - parameter (BCAxisymmetricWedge = 2) - parameter (BCDegenerateLine = 3) - parameter (BCDegeneratePoint = 4) - parameter (BCDirichlet = 5) - parameter (BCExtrapolate = 6) - parameter (BCFarfield = 7) - parameter (BCGeneral = 8) - parameter (BCInflow = 9) - parameter (BCInflowSubsonic = 10) - parameter (BCInflowSupersonic = 11) - parameter (BCNeumann = 12) - parameter (BCOutflow = 13) - parameter (BCOutflowSubsonic = 14) - parameter (BCOutflowSupersonic = 15) - parameter (BCSymmetryPlane = 16) - parameter (BCSymmetryPolar = 17) - parameter (BCTunnelInflow = 18) - parameter (BCTunnelOutflow = 19) - parameter (BCWall = 20) - parameter (BCWallInviscid = 21) - parameter (BCWallViscous = 22) - parameter (BCWallViscousHeatFlux = 23) - parameter (BCWallViscousIsothermal = 24) - parameter (FamilySpecified = 25) - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Data types * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - integer Integer, RealSingle, RealDouble, Character - character*32 DataTypeName(0:5) - parameter (Integer = 2) - parameter (RealSingle = 3) - parameter (RealDouble = 4) - parameter (Character = 5) - - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* BCData_t types * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - integer Dirichlet, Neumann - character*32 BCDataTypeName(0:3) - parameter (Dirichlet = 2) - parameter (Neumann = 3) - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Element types * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - integer NODE, BAR_2, BAR_3, TRI_3, TRI_6, QUAD_4, QUAD_8, QUAD_9 - integer TETRA_4, TETRA_10, PYRA_5, PYRA_14 - integer PENTA_6, PENTA_15, PENTA_18, HEXA_8, HEXA_20, HEXA_27 - integer MIXED, NGON_n - character*32 ElementTypeName(0:21) - parameter (NODE = 2) - parameter (BAR_2 = 3) - parameter (BAR_3 = 4) - parameter (TRI_3 = 5) - parameter (TRI_6 = 6) - parameter (QUAD_4 = 7) - parameter (QUAD_8 = 8) - parameter (QUAD_9 = 9) - parameter (TETRA_4 = 10) - parameter (TETRA_10 = 11) - parameter (PYRA_5 = 12) - parameter (PYRA_14 = 13) - parameter (PENTA_6 = 14) - parameter (PENTA_15 = 15) - parameter (PENTA_18 = 16) - parameter (HEXA_8 = 17) - parameter (HEXA_20 = 18) - parameter (HEXA_27 = 19) - parameter (MIXED = 20) - parameter (NGON_n = 21) - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Zone types * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - integer Structured, Unstructured - character*32 ZoneTypeName(0:3) - parameter (Structured = 2) - parameter (Unstructured = 3) - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Rigid Grid Motion types * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - integer ConstantRate, VariableRate - character*32 RigidGridMotionTypeName(0:3) - parameter (ConstantRate = 2) - parameter (VariableRate = 3) - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Arbitrary Grid Motion types * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - integer NonDeformingGrid, DeformingGrid - character*32 ArbitraryGridMotionTypeName(0:3) - parameter (NonDeformingGrid = 2) - parameter (DeformingGrid = 3) - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Simulation type * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - integer TimeAccurate, NonTimeAccurate - character*32 SimulationTypeName(0:3) - parameter (TimeAccurate = 2) - parameter (NonTimeAccurate = 3) - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* BC Property types * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - integer Generic - character*32 WallFunctionTypeName(0:2) - parameter (Generic = 2) - - integer BleedArea, CaptureArea - character*32 AreaTypeName(0:3) - parameter (BleedArea = 2) - parameter (CaptureArea = 3) - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Grid Connectivity Property types * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - integer AverageAll, AverageCircumferential, AverageRadial - integer AverageI, AverageJ, AverageK - character*32 AverageInterfaceTypeName(0:7) - parameter (AverageAll = 2) - parameter (AverageCircumferential = 3) - parameter (AverageRadial = 4) - parameter (AverageI = 5) - parameter (AverageJ = 6) - parameter (AverageK = 7) - -! For portability to Linux Absoft, all data statements were moved after the -! variables and parametres declarations - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Dimensional Units * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - data MassUnitsName /'Null','UserDefined','Kilogram','Gram', & - & 'Slug','PoundMass'/ - data LengthUnitsName / 'Null', 'UserDefined', & - & 'Meter','Centimeter','Millimeter','Foot','Inch'/ - - data TimeUnitsName /'Null','UserDefined','Second'/ - - data TemperatureUnitsName /'Null','UserDefined', & - & 'Kelvin','Celcius','Rankine','Fahrenheit'/ - - data AngleUnitsName /'Null','UserDefined','Degree','Radian'/ - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Data Class * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - data DataClassName / 'Null','UserDefined', & - & 'Dimensional','NormalizedByDimensional', & - & 'NormalizedByUnknownDimensional', & - & 'NondimensionalParameter','DimensionlessConstant'/ - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Grid Location * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - data GridLocationName / 'Null','UserDefined', & - & 'Vertex','CellCenter','FaceCenter','IFaceCenter', & - & 'JFaceCenter','KFaceCenter','EdgeCenter' / - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Grid Connectivity Types * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - data GridConnectivityTypeName / 'Null','UserDefined', & - & 'Overset','Abutting','Abutting1to1'/ - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Point Set Types * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - data PointSetTypeName / 'Null','UserDefined', & - & 'PointList','PointListDonor', & - & 'PointRange','PointRangeDonor', & - & 'ElementRange','ElementList','CellListDonor'/ - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Governing Equations and Physical Models Types * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - data GoverningEquationsTypeName / 'Null','UserDefined', & - & 'FullPotential','Euler', 'NSLaminar', 'NSTurbulent', & - & 'NSLaminarIncompressible', 'NSTurbulentIncompressible'/ - - data ModelTypeName / 'Null','UserDefined', & - & 'Ideal','VanderWaals', 'Constant','PowerLaw', & - & 'SutherlandLaw','ConstantPrandtl','EddyViscosity', & - & 'ReynoldsStress','ReynoldsStressAlgebraic', & - & 'Algebraic_BaldwinLomax','Algebraic_CebeciSmith', & - & 'HalfEquation_JohnsonKing','OneEquation_BaldwinBarth', & - & 'OneEquation_SpalartAllmaras','TwoEquation_JonesLaunder', & - & 'TwoEquation_MenterSST','TwoEquation_Wilcox', & - & 'CaloricallyPerfect', 'ThermallyPerfect', & - & 'ConstantDensity', 'RedlichKwong', 'Frozen', & - & 'ThermalEquilib', 'ThermalNonequilib', & - & 'ChemicalEquilibCurveFit', 'ChemicalEquilibMinimization', & - & 'ChemicalNonequilib'/ - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Boundary Condition Types * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - data BCTypeName / 'Null','UserDefined', & - & 'BCAxisymmetricWedge','BCDegenerateLine', & - & 'BCDegeneratePoint','BCDirichlet','BCExtrapolate', & - & 'BCFarfield','BCGeneral','BCInflow','BCInflowSubsonic', & - & 'BCInflowSupersonic','BCNeumann','BCOutflow', & - & 'BCOutflowSubsonic','BCOutflowSupersonic', & - & 'BCSymmetryPlane','BCSymmetryPolar','BCTunnelInflow', & - & 'BCTunnelOutflow','BCWall','BCWallInviscid', & - & 'BCWallViscous','BCWallViscousHeatFlux', & - & 'BCWallViscousIsothermal','FamilySpecified' / - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Data types * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - data DataTypeName / 'Null','UserDefined', & - & 'Integer','RealSingle','RealDouble','Character' / - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* BCData_t types * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - data BCDataTypeName / 'Null','UserDefined', & - & 'Dirichlet', 'Neumann' / - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Element types * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - data ElementTypeName / 'Null','UserDefined', & - & 'NODE', 'BAR_2', 'BAR_3', 'TRI_3', 'TRI_6', & - & 'QUAD_4', 'QUAD_8', 'QUAD_9', 'TETRA_4', 'TETRA_10', & - & 'PYRA_5', 'PYRA_14', 'PENTA_6', 'PENTA_15', 'PENTA_18', & - & 'HEXA_8', 'HEXA_20', 'HEXA_27', 'MIXED', 'NGON_n' / - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Zone types * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - data ZoneTypeName / 'Null','UserDefined', & - & 'Structured', 'Unstructured' / - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Rigid Grid Motion types * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - data RigidGridMotionTypeName / 'Null','UserDefined', & - & 'ConstantRate', 'VariableRate' / - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Arbitrary Grid Motion types * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - data ArbitraryGridMotionTypeName / 'Null','UserDefined', & - & 'NonDeformingGrid', 'DeformingGrid' / - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Simulation type * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - data SimulationTypeName / 'Null','UserDefined', & - & 'TimeAccurate', 'NonTimeAccurate' / - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* BC Property types * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - data WallFunctionTypeName / 'Null','UserDefined', & - & 'Generic' / - - data AreaTypeName / 'Null','UserDefined', & - & 'BleedArea', 'CaptureArea' / - -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\ -!* Grid Connectivity Property types * -!* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - data AverageInterfaceTypeName / 'Null','UserDefined', & - & 'AverageAll', 'AverageCircumferential', 'AverageRadial', & - & 'AverageI', 'AverageJ', 'AverageK' / diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/cgnswin_f.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/cgnswin_f.h deleted file mode 100644 index 98aa9fa7af..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/cgnswin_f.h +++ /dev/null @@ -1,5 +0,0 @@ -!DEC$ ATTRIBUTES REFERENCE, C, VARYING :: cg_goto_f -!DEC$ ATTRIBUTES REFERENCE, C, VARYING :: cg_array_read_f -!DEC$ ATTRIBUTES REFERENCE, C, VARYING :: cg_array_read_as_f -!DEC$ ATTRIBUTES REFERENCE, C, VARYING :: cg_array_write_f - diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/fortran_macros.h b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/fortran_macros.h deleted file mode 100644 index a76a5bd215..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/fortran_macros.h +++ /dev/null @@ -1,192 +0,0 @@ - -#ifndef FORTRAN_MACROS_H -#define FORTRAN_MACROS_H - -/**************************************************************/ -/* Include file used to interface with FORTRAN */ -/**************************************************************/ - -/* FMNAME is used when you prototype a FORTRAN routine for calling from C */ -/* (which you HAVE to do), or when you create the subroutine */ -/* INTEGER FMNAME(abc,ABC) (INTEGER ival, REAL rval); */ -/* void FMNAME(abc,ABC) (INTEGER ival, REAL rval) */ -/* { *ival = 1; *rval = 2.0; return; } */ -/* FMCALL is used when you call a FORTRAN subroutine from C */ -/* VINTEGER ival; */ -/* VREAL rval; */ -/* FMCALL(abc,ABC) (&ival, &rval); */ - -/* STR_PSTR is used in receiving arguments from FORTRAN */ -/* STR_PLEN is used in end of arguments from FORTRAN (no comma before it) */ -/* STR_PTR is used to get the address of a string from FORTRAN */ -/* STR_LEN is used to get the length of a string from FORTRAN */ -/* INTEGER FMNAME(abc,ABC) (STR_PSTR(str), INTEGER ival */ -/* STR_PLEN(str)) */ -/* { char *pointer = STR_PTR(str); int length = STR_LEN(str); } */ - -#ifdef NO_CONCATENATION -# define IDENTITY(x) x -# define CONCATENATE(a,b) IDENTITY(a)b -#else -# define CONCATENATE(a,b) a##b -#endif - -/* Cray Super Computer */ - -#if defined(_CRAY) || defined(cray) -#ifndef MAKEDEPEND -# include -#endif -# define FMNAME(lname,uname) uname -# define FMCALL(lname,uname) uname -# define STR_PSTR(str) _fcd str -# define STR_PLEN(str) -# define STR_PTR(str) _fcdtocp (str) -# define STR_LEN(str) _fcdlen (str) - -/* Vax VMS */ - -#elif defined(VMS) -#ifndef MAKEDEPEND -# include -#endif -# define FMNAME(lname,uname) uname -# define FMCALL(lname,uname) uname -# define STR_PSTR(str) struct dsc$descriptor_s *str -# define STR_PLEN(str) -# define STR_PTR(str) str->dsc$a_pointer -# define STR_LEN(str) str->dsc$w_length - -/* MS Windows */ - -#elif defined(_WIN32) -# if defined(__WIN32_BINARY__) -# define FMNAME(lname,uname) __cdecl lname -# define STR_PSTR(str) char *str -# define STR_PLEN(str) , int CONCATENATE(Len,str) -# else -# define FMNAME(lname,uname) __stdcall uname -# define STR_PSTR(str) char *str, int CONCATENATE(Len,str) -# define STR_PLEN(str) -# endif -# define FMCALL(lname,uname) uname -# define STR_PTR(str) str -# define STR_LEN(str) CONCATENATE(Len,str) - -/* upper case Fortran name */ - -#elif defined(UPPERCASE) -# define FMNAME(lname,uname) uname -# define FMCALL(lname,uname) uname - -/* upper case Fortran name with trailing underscore */ - -#elif defined(UPPERCASE_) -# define FMNAME(lname,uname) CONCATENATE(uname,_) -# define FMCALL(lname,uname) CONCATENATE(uname,_) - -/* lower case Fortran name */ - -#elif defined(LOWERCASE) -# define FMNAME(lname,uname) lname -# define FMCALL(lname,uname) lname - -/* lower case Fortran name with trailing underscore */ - -#else -# define FMNAME(lname,uname) CONCATENATE(lname,_) -# define FMCALL(lname,uname) CONCATENATE(lname,_) - -#endif - -#ifndef STR_PSTR -# define STR_PSTR(str) char *str -# define STR_PLEN(str) , int CONCATENATE(Len,str) -# define STR_PTR(str) str -# define STR_LEN(str) CONCATENATE(Len,str) -#endif - -/*************/ -/* Datatypes */ -/*************/ - -typedef char VCHARACTER; -typedef int VINTEGER; -typedef double VREAL; -typedef float VFLOAT; - -typedef VCHARACTER * CHARACTER; -typedef VINTEGER * INTEGER; -typedef VREAL * REAL; -#if !defined(_WIN32) || !defined(_WINDEF_) -typedef VFLOAT * PFLOAT; -#endif - -/**************/ -/* Prototypes */ -/**************/ - -#ifdef __cplusplus -extern "C" { -#endif - -/*****************************************************************************/ -/* tocstr - convert a fortran character string into a fortran integer array */ -/* that has a trailing null character to look like a c-string */ -/* */ -/* character str (in) Fortran chacter string */ -/* integer icstr(*) (out) Fortran integer array */ -/* */ -/* notes: */ -/* 1) Trailing blanks are removed, and leading/trailing '"' are also. */ -/* 2) To keep the trailing blanks, quote them '"' */ -/* 3) It is a little faster to call this routine without any trailing */ -/* blanks; ex. call tocstr (abc[1:notblk], icstr) */ -/*****************************************************************************/ - -void FMNAME(tocstr,TOCSTR) ( -STR_PSTR(str), /* (in) Fortran character string */ -CHARACTER icstr /* (out) Fortran integer array */ -STR_PLEN(str) /* (in) Compiler passed len of str */ - ); - -/*****************************************************************************/ -/* frcstr - convert a fortran integer array into a fortran character string */ -/* */ -/* integer icstr(*) (in) Fortran integer array */ -/* character str (out) Fortran chacter string */ -/*****************************************************************************/ - -void FMNAME(frcstr,FRCSTR) ( -CHARACTER icstr, /* (in) Fortran integer array */ -STR_PSTR(str) /* (out) Fortran character string */ -STR_PLEN(str) /* (in) Compiler passed len of str */ - ); - -/*************************************************************************/ -/* fstr_to_cstr - convert a fortran character string into a c character */ -/* string */ -/*************************************************************************/ - -void fstr_to_cstr ( -char *str, /* (in) Pointer to character string */ -int ilen, /* (in) Max length of str */ -char *icstr /* (out) C character string */ - ); - -/*************************************************************************/ -/* cstr_to_fstr - convert a c character string into a fortran character */ -/* string */ -/*************************************************************************/ - -void cstr_to_fstr ( -char *icstr, /* (in) C character string */ -int ilen, /* (in) Max length of str */ -char *str /* (out) Pointer to character string */ - ); - -#ifdef __cplusplus -} -#endif - -#endif /* FORTRAN_MACROS_H */ diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/make.version.sc b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/make.version.sc deleted file mode 100755 index ffb638b6ac..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/make.version.sc +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -grep "CGNS_VERSION" | cut -f3 -d" " | awk '{ major = substr($1,1,1); minor = substr($1,2,2); revision = substr($1,3,4); printf "VERSION=%d.%02d.%03d\n", major, minor, revision; }' diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/qmake.vars b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/qmake.vars deleted file mode 100644 index 2838f06032..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/qmake.vars +++ /dev/null @@ -1,4 +0,0 @@ -Project MESSAGE: Building in Debug mode -Project MESSAGE: Building dynamic libraries -Project MESSAGE: MK_BUILDNAME=linux64_2.4-x86-glibc_2.2.5; export MK_BUILDNAME; -Project MESSAGE: RELEASEMODE=debug-shared; export RELEASEMODE; diff --git a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/version.pro b/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/version.pro deleted file mode 100644 index fb284f859c..0000000000 --- a/applications/utilities/mesh/conversion/ccm26ToFoam/libccmio/libcgns/version.pro +++ /dev/null @@ -1 +0,0 @@ -VERSION=2.30.000